ADCs in Linux
To explain the functioning of ADCs in a GNU/Linux-based system, let's use the SAMA5D3 Xplained board since its ADC support is more complete than the BeagleBone Black's (however, during the explanation, each difference with the BeagleBone Black will be pointed out).
If we take a look at the iio:device0
directory's content in the SAMA5D3 Xplained, we will find the listing shown here:
root@a5d3:~# ls /sys/bus/iio/devices/iio\:device0/ buffer in_voltage1_raw in_voltage6_raw name trigger dev in_voltage2_raw in_voltage7_raw of_node uevent in_voltage0_raw in_voltage3_raw in_voltage8_raw power in_voltage10_raw in_voltage4_raw in_voltage9_raw scan_elements in_voltage11_raw in_voltage5_raw in_voltage_scale subsystem
Files in the in_voltageX_raw
form can be used to read a single ADC input from a particular channel. This interface can be used, as shown here:
root@a5d3:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw 1662