I'm trying the Buffer and Hardware Trigger capabilities of the SAMA5D4.
I followed the instructions on IioAdcDriver < Linux4SAM < TWiki, but was struggling with one particular command.
I raised a topic on tha at91.com forum. And resolved it myself.
Sometimes writing down your problem leads to the solution.
Instructible
You can read my topic on the at91 site to see where I was in trouble. (jc: At the time of posting this blog, I didn't know yet that I would get the at91.com treatment)
In this blog, I'll post the how-to.
Poky (Yocto Project Reference Distro) 1.6.1 sama5d4-xplained /dev/ttyS0 sama5d4-xplained login: root root@sama5d4-xplained:~# echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage0_en root@sama5d4-xplained:~# echo "fc034000.adc-dev0-continuous" > /sys/bus/iio/devices/iio:device0/trigger/current_trigger root@sama5d4-xplained:~# echo 100 > /sys/bus/iio/devices/iio:device0/buffer/length root@sama5d4-xplained:~# echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable root@sama5d4-xplained:~#
This will start the process. The ADC will now fill the character device /dev/iio:device0 with data.
How did I get the magic name "fc034000.adc-dev0-continuous"? It's different than the name "at91_adc-dev0-external" used in the AT91.com instructions.
By fiddling around a lot, and then by submitting the command
root@sama5d4-xplained:/sys/bus/iio/devices/trigger0# cat name fc034000.adc-dev0-continuous
I still have to write a program that reads the character device.
I have already checked the source of drivers/staging/iio/Documentation/generic_buffer.c
but I haven't been successful in compiling it yet.
I'll also need to learn how I can set the sampling speed.
I'd like to get 128 samples in 3.86ms. Check my previous post to understand why.
I hope that by putting this example here, I can help fellow developers started with the on-board ADC.
Top Comments