AnsweredAssumed Answered

imx6ul adc driver with selected pins only

Question asked by Krzysztof Lukaszewicz on Jul 12, 2016
Latest reply on Sep 15, 2016 by Zongbiao Liao

Good morning,

 

I am trying to set up the ADC on iMX6UL on my custom board and I based on the following thread imx6ul adc driver.

I would like to run ADC on the following pins:

GPIO1_IO02 to GPIO1_IO07.

 

GPIO1_IO00 to GPIO1_IO01 I want to use as I2C pins.

GPIO1_IO08 to GPIO1_IO09 I want to use as output pins.

 

I understand that I need to modify in imx6ul.dtsi as follow:

num-channels = <6>;

 

But doing so I have the following files in

/sys/bus/iio/devices/iio:device0#

-rw-r--r--1 root root      4096 May 21 10:42 in_voltage0_raw                                            
-rw-r--r--1 root root      4096 May 21 10:42 in_voltage1_raw                                            
-rw-r--r--1 root root      4096 May 21 10:42 in_voltage2_raw                                            
-rw-r--r--1 root root      4096 May 21 10:42 in_voltage3_raw                                            
-rw-r--r--1 root root      4096 May 21 10:42 in_voltage4_raw
-rw-r--r--1 root root      4096 May 21 10:42 in_voltage5_raw

which correspond to pins GPIO1_IO00 to GPIO1_IO05.

 

How to apply the offset to not start from channel 0 but 2 to read pins GPIO1_IO02 to GPIO1_IO07?

Or shall I set channel number to 8 and read only files from in_voltage2_raw to in_voltage7_raw? Can I then still use GPIO1_IO00 to GPIO1_IO01 I2C pins?

 

How to use adc to read ADC continiously? How should I read /dev/iio:device0 to get access to desired channels?

 

 

Best Regards,

 

Krzysztof Lukaszewicz

Outcomes