There are a number of reasons why the result could be wrong (assuming
the electronics are OK and you have a low impedance signal). I've
had no luck with adc_7250.c either. The various examples of reading
the ADC have many mysterious "quirks", which I'm guessing are due to
the fact that the ADC is designed to be read on an ADC interrupt, but
all of the examples try to do this without interrupts, instead timing
things using pretty coarse approximations.
I've had better luck adapting ADCpoll.c, which can be found in
sources/busybox-1.00-rc2/coreutils/ADCpoll.c on the linux CD.
There is a function there called EP93XX_ADC_microvolts, which does a
conversion from the raw ADC register value to something approaching
the right number of microvolts.
Its not absolutely accurate - you still have to determine the 0-
offset and slope empirically and do a linear correction. But its in
the right ballpark even if you don't.
My board (a TS7260) did not ship with the correction factors
programmed into eeprom, as adc_7250.c assumes.
The on-board ADC desperately cries out for a kernel module. Its
simply not possible to do the timings correctly outside of the
kernel, unless you do everything in calibrated busy-wait loops (and
nothing else, since there will be a 100% CPU load). The best I could
manage outside the kernel is reading two channels at 10 Hz or so - 20
- 50 times slower than what is possible with the hardware. Why the
onboard ADC does not ship with a TS-sanctioned kernel module is one
of those great mysteries.
Something brutally simple, that just dumps the raw ADC register value
into a character device whenever an ADC interrupt occurs would be
great. The channel control, conversion, etc can all be done outside
the kernel. I've done some digging into what interrupt number gets
generated and how to trap it in a kernel module, but there's a lot of
poorly written documentation to dig through so I eventually gave up
(for now).
-Ilya
On Jan 23, 2008, at 7:36 AM, Zombi process wrote:
> Yes this is the sample code that i'm using , but the
> result are wrong .What revition of ep93xx do you have?
> i had ep9302 e1
>
> thanks bye
>
> --- Triffid Hunter <>
> escribió:
>
>> On Wed, 23 Jan 2008, Zombi process wrote:
>>
>>> hello has anyone use the internal ad because i
>> can't
>>> have a correct value when i tried to use it and
>> there
>>> are a very extrange note in the ep9301 manual.
>>>
>>> thanks !
>>>
>>> bye
>>
>> The sample code provided by technologix works fine
>> for me
>>
>>
> ftp://ftp.embeddedarm.com/ts-arm-linux-cd/samples/adc_7250.c
>> and all its includes from the same directory.
>>
>
>
>
> Los referentes más importantes en compra/ venta de autos se
> juntaron:
> Demotores y Yahoo!
> Ahora comprar o vender tu auto es más fácil. Vistá ar.autos.yahoo.com/
>
>
>
> Yahoo! Groups Links
>
>
>
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/
|