Analog Input - ADC
Board | External signals | Precision | Reference voltage** |
---|---|---|---|
iMX6 SoloX COM | 8 signals divided into 2 channels each with 4 inputs | 12 bit | 3.3V |
iMX6 Quad COM | Not supported | ||
iMX6 DualLite COM | Not supported | ||
iMX6 UltraLite COM* | 10 signals divided into 1 channel with 10 inputs | 12 bit | 3.3V |
iMX7 Dual COM | 8 signals divided into 2 channels, each with 4 inputs | 12 bit | 1.8V |
iMX7 Dual uCOM | 4 signals divided into 1 channel with 4 inputs | 12 bit | 1.8V |
iMX7ULP uCOM | Not available in U-Boot and Linux | ||
iMX8M Quad COM | Not supported | ||
iMX8M Mini uCOM | Not supported | ||
iMX8M Nano uCOM | Not supported | ||
iMX93 uCOM | 4 signals divided into 1 channel with 4 inputs | 12 bit | 1.8V |
** - Note that input voltages above max will damage the CPU.
U-Boot
Not currently available.
Linux
Each ADC channel will be represented by a iio:device node in the file system.
ls /sys/bus/iio/devices/
iio:device0 iio:device1
ls /sys/bus/iio/devices/iio\:device0/
buffer name
dev of_node
in_conversion_mode power
in_voltage0_raw sampling_frequency_available
in_voltage1_raw scan_elements
in_voltage2_raw subsystem
in_voltage3_raw trigger
in_voltage_sampling_frequency uevent
in_voltage_scale
In this case (iMX6 SoloX) the 8 signals are divided into two channels (iio:device0 and iio:device1) of 4 inputs each (in_voltage0_raw, in_voltage1_raw, in_voltage2_raw and in_voltage3_raw).
To read the raw value (range is 0 - 4095 for 12 bit precision).
cat /sys/bus/iio/devices/iio\:device0/in_voltage2_raw
302
To see the scale.
cat /sys/bus/iio/devices/iio\:device0/in_voltage_scale
0.805664062
To get the actual value multiply the raw value and the scale: 302 * 0.805664062 = 243.3 mV.