Anybody know anything about the ADC?


Anybody have any ideas how to use the ADC? Information seems to be minimal to non-existant, not just for the rockpi4, but for the rk3399 in general. I’ve hooked a potentiometer up to the ADC GPIO pin and can see some kind of response from

cat /sys/bus/iio/devices/iio:device0/in_voltage*

so I know there is something resembling a live driver loaded in the system. I get nothing that makes any sense though. Some of the channels change sort of linearly with the potentiometer voltage, but I can see no overall explanation for the results.

Anybody know anything here? I’m not even certain what the voltage range is, or if a device tree overlay is necessary to properly initialize the device. Thanks.


you can install libmraa

or you can compile it by yourself


Great, seems to work just fine, thank you kindly. I think the thing that was not clear to me is that the ADC input voltage range is 0-1.8v. For for future reference for anybody reading this, the input voltage seem to be directly mirrored into /sys/bus/iio/devices/iio:device0/in_voltage0_raw upto 1.8v. And I’m not sure if this is supported, or likely going to burn something out, but voltages higher than 1.8v get read linearly into /sys/bus/iio/devices/iio:device0/in_voltage2_raw. The other iio voltages change with input to the ADC pin, but now with any logic that I can see.