SAMA5D4 Xplained Ultra ADC Buffer under Linux

Moderator: nferre

jancumps
Posts: 15
Joined: Tue Mar 31, 2015 8:47 pm

SAMA5D4 Xplained Ultra ADC Buffer under Linux

Wed May 20, 2015 8:05 pm

I'm trying the "Use of the AT91 ADC driver - Hardware triggers" example explained on
linux4sam/bin/view/Linux4SAM/IioAdcDriver.

I was successful in using the software trigger example, but with the hardware trigger example, I have difficulties setting the right trigger.

When I follow the example and try to enable the buffer as last step, I get this error:

Code: Select all

root@sama5d4-xplained:~# echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable
Buffer not started: no trigger
-sh: echo: write error: Invalid argument
I have doubds on this part of the instruction. I do not understand what's meant by " (it must be the name of one of the triggers present in iio/devices)"

Code: Select all

echo "at91_adc-dev0-external" > /sys/bus/iio/devices/iio:device0/trigger/current_trigger
Here's the listing of what's available in my iio/devices:

Code: Select all

lrwxrwxrwx 1 root root 0 Nov  4 10:29 trigger0 -> ../../../devices/ahb.0/apb.1/fc034000.adc/trigger0
lrwxrwxrwx 1 root root 0 Nov  4 10:29 iio:device0 -> ../../../devices/ahb.0/apb.1/fc034000.adc/iio:device0
The instructions that I submitted:

Code: Select all

sama5d4-xplained login: root
root@sama5d4-xplained:~# modprobe at91_adc
root@sama5d4-xplained:~# echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage0_en
root@sama5d4-xplained:~# echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage1_en
root@sama5d4-xplained:~# echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage2_en
root@sama5d4-xplained:~# echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage3_en
root@sama5d4-xplained:~# echo "at91_adc-dev0-external" > /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
Buffer not started: no trigger
-sh: echo: write error: Invalid argument
root@sama5d4-xplained:~#

Linux image: Poky (Yocto Project Reference Distro) 1.6.1 sama5d4-xplained
jancumps
Posts: 15
Joined: Tue Mar 31, 2015 8:47 pm

Re: SAMA5D4 Xplained Ultra ADC Buffer under Linux

Wed May 20, 2015 8:41 pm

I believe I'm one step further:

Code: Select all

root@sama5d4-xplained:/sys/bus/iio/devices/trigger0# cat name
fc034000.adc-dev0-continuous
jancumps
Posts: 15
Joined: Tue Mar 31, 2015 8:47 pm

Re: SAMA5D4 Xplained Ultra ADC Buffer under Linux

Wed May 20, 2015 8:42 pm

Resolved my own problem.:

Code: Select all

# echo "fc034000.adc-dev0-censored
tinuous" > /sys/bus/iio/devices/iio:device0/trigger/current_trigger
# echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable
blue_z
Location: USA
Posts: 1646
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAMA5D4 Xplained Ultra ADC Buffer under Linux

Wed May 20, 2015 9:14 pm

If you had performed a site search (e.g. on the phrase "no trigger") you would have found this post: discussions/viewtopic.php/p,43006.html#p43006

Regards
jancumps
Posts: 15
Joined: Tue Mar 31, 2015 8:47 pm

Re: SAMA5D4 Xplained Ultra ADC Buffer under Linux

Wed May 20, 2015 9:33 pm

I had actually found that post before posting mine (did a search here before posting), but I couldn't get my thoughts straight by reading that one.
It were the off-topic comments in that post that made it difficult to get a line in the discussion.
As a non-native English speaker, it can be hard to split pun from facts.
jancumps
Posts: 15
Joined: Tue Mar 31, 2015 8:47 pm

Re: SAMA5D4 Xplained Ultra ADC Buffer under Linux

Thu May 21, 2015 9:55 pm

I'm still folowing the instructions on linux4sam/bin/view/Linux4SAM/IioAdcDriver

I've compiled generic_buffer.c and loaded it to the board.

However, when, I run the program, it has troubles with the driver name.
I'm unsure what driver name I should use for the SAMA5D4 Xplained Ultra.

Commands used:

Code: Select all

modprobe at91_adc  
echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage0_en  
echo "fc034000.adc-dev0-continuous" > /sys/bus/iio/devices/iio:device0/trigger/current_trigger  
echo 100 > /sys/bus/iio/devices/iio:device0/buffer/length  
echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable  
./generic_buffer -n at91_adc -t fc034000.adc-dev0-continuous -l 2
error posted by generic_buffer:

Code: Select all

Failed to find the at91_adc
Source used for generic_buffer:
http://www.filewatcher.com/p/kernel-rsb ... fer.c.html
jancumps
Posts: 15
Joined: Tue Mar 31, 2015 8:47 pm

Re: SAMA5D4 Xplained Ultra ADC Buffer under Linux

Fri May 22, 2015 8:56 pm

update: this is now fully resolved.

there were two reasons for the failure:

- when using the device tree version of the yocto distro, the driver is not at_91.adc but fc034000.adc.

Code: Select all

./generic_buffer -n fc034000.adc -t fc034000.adc-dev0-external -l 2 
 

- use the generic_buffer.c from the at91 git:
https://raw.githubusercontent.com/linux ... c_buffer.c

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 1 guest