Linux ADC driver

Moderator: nferre

cmcraeslo
Posts: 9
Joined: Wed Mar 19, 2014 11:16 pm

Linux ADC driver

Sat May 03, 2014 6:22 pm

I'm running xplained board out of the box with no mods and can't seem to get the ADC working. I get "Connection timed out" if I try to cat in_voltage0_raw. Does anyone have this adc working on sama5d3 (xplnd) ? Thanks!
abelloni
Posts: 15
Joined: Sat May 03, 2014 7:34 pm

Re: Linux ADC driver

Sat May 03, 2014 7:44 pm

Hi,

I think that VDDANA is not powered on by default, can you try to follow the following steps?

https://plus.google.com/104934465431918 ... Jog7JxnpVp
cmcraeslo
Posts: 9
Joined: Wed Mar 19, 2014 11:16 pm

Re: Linux ADC driver

Mon May 05, 2014 9:21 pm

That actually worked. I'm now getting readings from channels. That said, they are way off and they don't correspond to actual analog values. I need to check whether I did something wrong with the I/O board. 

I also checked this i2c link and noticed that these are not powered by default, I guess I missed it. What troubles me is where I can find the commands that control this? I can't seem to find it in the datasheet. I need to understand what those numbers are :)

Edit:
I did check the board and everything looks ok. Something's not right with this a/d converter. These are the commands i'm using to power up, set up and read adc:

i2cset -y 1 0x5b 0x54 0x39
i2cset -y 1 0x5b 0x55 0xc1
echo "f8018000.adc-dev0-continuous" > /sys/bus/iio/devices/iio\:device0/trigger/current_trigger
echo "1" > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage6_en
echo "1" > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage7_en
echo "1" > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage8_en
echo "1" > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage9_en
echo "1" > /sys/bus/iio/devices/iio\:device0/scan_elements/in_timestamp_en
echo "100" > /sys/bus/iio/devices/iio\:device0/buffer/length
echo "1" > /sys/bus/iio/devices/iio\:device0/buffer/enable
watch -n 1 /home/root/generic_buffer2 -n f8018000.adc -t f8018000.adc-dev0-continuous;

But it's not working. Do you have a working example of the problem you mentioned in the link above?

Thanks!
abelloni
Posts: 15
Joined: Sat May 03, 2014 7:34 pm

Re: Linux ADC driver

Mon May 12, 2014 5:42 pm

Hi,

what do you exactly mean by it does not work ?

when using the continuous trigger, what could happen is that the board freezes because it gets too many interrupts from the ADC.

You probably don't need that though, you can read /sys/bus/iio/devices/iio\:device0/in_voltage*_raw periodically instead.
cmcraeslo
Posts: 9
Joined: Wed Mar 19, 2014 11:16 pm

Re: Linux ADC driver

Mon May 12, 2014 6:12 pm

Hi. By "not working" I mean the results that I get are not the numbers I expect.. Nowhere near the value on the input. 3V on input pin for example, gets me number 0-20 in random interval. I'm pretty sure the wiring is correct.
abelloni
Posts: 15
Joined: Sat May 03, 2014 7:34 pm

Re: Linux ADC driver

Tue May 20, 2014 12:34 pm

Hi,

Indeed, what is happening is that your ADC driver is compiled in the kernel. At the time the driver is trying to initialize the ADC, it is not powered.

What you can do is compile the ADC driver as a module (CONFIG_AT91_ADC=m) and load it after issuing the i2cset commands:

i2cset -y 1 0x5b 0x54 0x39
i2cset -y 1 0x5b 0x55 0xc1
modprobe industrialio-triggered-buffer
modprobe at91_adc

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 3 guests