That is because you are doing this wrong. Reading attributes via sysfs is slow 
and not meant for this purpose. With IIO, you enable a scan element (echo 1 > 
in_voltage0_en) and then you enable the buffer (echo 1 > buffer/enable)and then 
you read the values from /dev/iio:device0. In the BB-ADC overlay, you can 
modify the scan update time by modifying the Oversample (default is 16x), Open 
Delay time (default is 0x98) and sample time (default is 1). Now the IIO ADC 
driver captures samples using interrupts which isn’t ideal, but it will capture 
samples at a much higher rate than can be read from sysfs. If you want to 
capture at full speed, the driver needs to be updated to use DMA. 

Regards,
John




> On Mar 6, 2016, at 12:19 AM, Audrey <[email protected]> wrote:
> 
> Where can I find it (and set it)?
> 
> I'm right now trying to collect voltage readings using beaglebone's internal 
> adc using a bash script and a while loop. Right now the data collection is 
> clocking at around 33 microseconds, but I know that the internal adc should 
> be able to collect data as fast as 5 microseconds. What should I do to make 
> that happen? Is the problem with making while loops move faster, or is it 
> about setting the adc configurations?
> 
> This is my bash script:
> 
> #!/bin/bash
> 
> #echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots
> 
> t0=$(date +%s%6N)
> 
> while true; do
>    t1=$(date +%s%6N)
>    rawVal=$(cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw)
>    voltage=$(bc -l <<< $rawVal/4095*1.8)
>    time=$(expr $t1 - $t0)
>    echo $time $voltage
> done
> 
> 
> -- 
> For more options, visit http://beagleboard.org/discuss 
> <http://beagleboard.org/discuss>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to