Skip to main content

Analog Input - ADC

BoardExternal signalsPrecisionReference voltage**
iMX6 SoloX COM8 signals divided into 2 channels each with 4 inputs12 bit3.3V
iMX6 Quad COMNot supported
iMX6 DualLite COMNot supported
iMX6 UltraLite COM*10 signals divided into 1 channel with 10 inputs12 bit3.3V
iMX7 Dual COM8 signals divided into 2 channels, each with 4 inputs12 bit1.8V
iMX7 Dual uCOM4 signals divided into 1 channel with 4 inputs12 bit1.8V
iMX7ULP uCOMNot available in U-Boot and Linux
iMX8M Quad COMNot supported
iMX8M Mini uCOMNot supported
iMX8M Nano uCOMNot supported
iMX93 uCOM4 signals divided into 1 channel with 4 inputs12 bit1.8V
* - To use the ADC channels on iMX6 UltraLite they must first be configured and enabled in the device tree. The scope of how to do that is beyond this document.
** - 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.