nelky22
New Member
- Total Posts : 18
- Reward points : 0
- Joined: 2021/02/08 22:14:48
- Location: 0
- Status: offline
ATSAMA5D27-SOM-EK board how to use its ADC and DMA
Hi, How to use the ADC and DMA of ATSAMA5D27-SOM-EK board? I attach my question in the text file as I can't write it here. Hope to hear from you soon.
|
nelky22
New Member
- Total Posts : 18
- Reward points : 0
- Joined: 2021/02/08 22:14:48
- Location: 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/02/25 02:42:10
(permalink)
Hi, I just use the software trigger method to read from AD6. I adjusted the power supply which is pumped into AD6, I can get the reading. But what if I want it to be dumped into DMA, and later read from the DMA, how can I do it?
|
blue_z
Moderator
- Total Posts : 18
- Reward points : 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/02/25 16:53:50
(permalink)
nelky22I attach my question in the text file as I can't write it here. You're able to post three sentences, so why can't you write your entire question in the same manner? The preferred approach is to present as much information as possible without requiring the reader to expend more effort to simply learn about your problem. IOW more informed readers improves the chances of appropriate responses. Regards
|
nelky22
New Member
- Total Posts : 18
- Reward points : 0
- Joined: 2021/02/08 22:14:48
- Location: 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/02/25 18:38:17
(permalink)
Hi blue_z, If you look at my attached text file, it contains something like this fc030000(dot)adc(dash)dev0(dash)external(underscore)rising. The system just doesn't let me go through. I have checked with the admin. I was advised to use attached-file method. I also wish I can write everything in a single page.
|
nelky22
New Member
- Total Posts : 18
- Reward points : 0
- Joined: 2021/02/08 22:14:48
- Location: 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/02/26 01:42:41
(permalink)
|
blue_z
Moderator
- Total Posts : 18
- Reward points : 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/02/26 16:46:38
(permalink)
nelky22 How can we use software trigger and use DMA also? In theory that could be possible, but: a. it's counterproductive. DMA is employed to reduce CPU overhead during I/O. Hardware triggering also eliminates CPU involvement (once setup). But a software trigger would obviously require the CPU to (repeatedly) execute code to handle an event(s) that in turn would start each conversion cycle. b. the device driver (and maybe even the IIO subsystem) is not implemented to handle that unusual combination. I suppose you could hack the driver by adding an ioctl() to start the conversion if you insist on using this scheme. Working that into the IIO subsystem is another matter. You might be able to kludge it by wiring a GPIO to the ADTRG input, and manipulate that GPIO when you have the software event to start conversion, i.e. turn the software event into an external trigger. Seems like you should be studying the Linux IIO subsystem documentation. Regards
|
nelky22
New Member
- Total Posts : 18
- Reward points : 0
- Joined: 2021/02/08 22:14:48
- Location: 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/02/28 23:33:42
(permalink)
Hi, When we do this hexdump -e '/2 "%d\n"' -v /dev/iio:device0 does it mean we, actually, read from DMA? Regards
|
blue_z
Moderator
- Total Posts : 18
- Reward points : 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/03/01 17:45:06
(permalink)
nelky22When we do this hexdump -e '/2 "%d\n"' -v /dev/iio:device0 does it mean we, actually, read from DMA? Your question doesn't make sense. DMA is a method for transferring data, and is not a device or source of data. So you cannot " read from" it. The device node used in your command is merely a capture buffer. How any data was stored in that buffer depends on the capture setup. Regards
|
nelky22
New Member
- Total Posts : 18
- Reward points : 0
- Joined: 2021/02/08 22:14:48
- Location: 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/03/01 19:39:01
(permalink)
OK. What if I have already performed this... echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage6_en echo fc030000.adc-dev0-external_rising > /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 devmem2 0xfc0300C0 w 0xffff0005
// after a few mins, I do this echo 0 > /sys/bus/iio/devices/iio:device0/buffer/enable Then, how and where should I read my ADC data from? By the way, what is the maximum number I can write to the length in /sys/bus/iio/devices/iio:device0/buffer/? Is this length the maximum the buffer can hold before it new value overwrite the old one? Is there anyway we can know that it has reached the maximum so that we can read out and the values won't be overwritten? Regards
|
blue_z
Moderator
- Total Posts : 18
- Reward points : 0
- Status: offline
Re: ATSAMA5D27-SOM-EK board how to use its ADC and DMA
2021/03/02 13:17:54
(permalink)
nelky22 Then, how and where should I read my ADC data from? (You seem to have forgotten what already has been written.) You can " read my ADC data from" the capture buffer represented by /dev/iio:device0. Unless you develop your own API, the Linux convention is that userspace sees an abstracted ADC through the IIO interface. nelky22 By the way, what is the maximum number I can write to the length in /sys/bus/iio/devices/iio:device0/buffer/? How big does it have to be? What have you tried? nelky22 Is this length the maximum the buffer can hold before it new value overwrite the old one? Essentially yes; there could be a number-of-bytes versus number-of-samples discrepancy. nelky22 Is there anyway we can know that it has reached the maximum so that we can read out and the values won't be overwritten? Yes, there's the buffer/data_available and buffer/watermark sysfs entries. Study the sysfs documentation for IIO. More info and links are at this web page. Regards
|