Hi --
--- In "garaloha211" <>
wrote:
>
> I have been testing the functionality of the TS_7250 and have run
> into issues while sampling analog inputs with the MAX197.
>
> I have been able to collect a single sample accurately. However,
> when I put the same code into a loop, the first sample is accurate
> and the remaining samples are some constant #. (see code and
> execution results below)
>
> for(n = 0; n < num; n++)
> {
> *control = hexVal; //control value
What's your control value?
> // Wait for the conversion to complete
> while((*complete & 0x80) != 0)
> // now store the result on a scale from 0-(2^12-1) in sig array
> res = 0;
> res = *lsb;
> res |= *msb << 8;
> sig[n] = res;
> }
>
> When executed on chn 0 with range from 0-5v and a constant 1V
input
> the results of 20 samples were as seen below.
> result: 848
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
> result: 832
>
> I have consistently had this result with several different inputs
> (AC and DC all within correct range). I have tried adding a sleep
> (1); at the bottom of the loop and found that slowing down the
loop
> execution yields accurate results but not reliably and I need a
much
> higher sampling rate than 1Hz.
Are you saying above values are wrong? If no, then what is a 'bad'
run?
848 to 832 is only about 20mV, or about 1.035 to 1.016 V. I would
think the 832 is a good value after things settle down, and the 848
is maybe due a transient across sampling cap of some sort. Also,
the powerdown mode you choose can affect the REF voltage droop. See
the MAX197 data sheet for details.
>
> Can anyone provide me with some information on this problem and
> propose a solution?
>
> Also, I have seen in the TS-7250 manual that the control register
> for the MAX197 is at 0x1080_0000 (page 29 JUN 2007).
>
> However, in the example code (page 39 Linux for ARM JUL 2007),
> 0x10C0_0000 is used to map the control.
>
> I have tried both and seen that each value 0x1080 and 0x10C0
works,
> at least for the single sample case.
>
> Which address should I be using to properly control the MAX197
chip?
I understood from reading Phil McCarley's driver, that 0x1080 is
used to check for ADC complete, and 0x10C0 is the control register.
>
> It is critical that I am able to maximize the sampling rate of the
> ADC. Please advice on the best solution.
>
> -Thank You
>
To maximize the sampling rate, use Phil's kernel mode driver
mentioned above. It's very flexible, well written, and makes good
use of HW timer3 for sample pacing to get high sample rates without
much CPU load. It is available in the files area of the yahoo
group.
Other (userspace) utils are available too for getting data from the
MAX197, details are in the archive (search for MAX197 ...)
Regards, .......... Charlie
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|