AnsweredAssumed Answered

imx6ULL ADC high CPU

Question asked by chris_f on Sep 19, 2019
Latest reply on Sep 19, 2019 by CarlosCasillas

I'm using a script to read an ADC 1000 times:

root@imx6ul-var-dart:~# cat adc.sh
#!/bin/sh
for i in `seq 1 1000`;
do
cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw > /dev/null
done

 

It takes just over 11 seconds to run so just under 100 samples per second.

root@imx6ul-var-dart:~# time ./adc.sh
real 0m 11.32s
user 0m 0.22s
sys 0m 1.08s
root@imx6ul-var-dart:~# time ./adc.sh
real 0m 11.34s
user 0m 0.21s
sys 0m 1.27s

 

I can cope with the slow sample rate but why does it take 10-20% cpu?

I found similar results using stdio to read in_voltageY_raw data from a c program.

 

Is there a less processor intensive way to read the ADC? It's currently consuming around 500k processor cycles to read a 12 bit number from hardware.

Outcomes