New feature: high speed continuous recording
Posted: Sat Oct 18, 2014 1:22 am
When the kickstarter backers unlocked the 512MB stretch goal, I bet many thought "whoa, I can store a full second of 2 channel 14bit samples at 125MS/s in there". I know I did.
For ecosystem version 0.92 and 0.93: ecosystem, components, github
For OS versions of 0.94 and later: rp_remote_acquire + bitstream
For OS versions of 0.96 and later you also need: boot loader replacements from ecosystem 0.94
(replaces the logic analyzer setup, so you can not use the logic analyzer when you boot with these components)
As it turned out, both the RedPitaya scope application and FPGA logic don't work that way.
But this is no longer true, because now there is the "DDR Dump" extension to the RedPitaya.
It comes in two parts:
- An extension to the FPGA design, that adds a direct channel from the ADC to main memory (while maintaining compatibility with existing apps).
- A kernel module that provides DMA-capable memory to the FPGA and allows user-space applications access to the samples.
So, how about a demonstration ?
If anybody wants to take the new function for a ride, download the binaries (files with md5sums), copy them to your RedPitaya's /tmp directory and do the following:
(I hope you will understand that I can accept no responsibility for any and all consequences that arise from the use of the provided binaries, and by using said binaries you implicitly agree to this)
Edit: I just learned (thanks, PiccoLas) that the kernel module is only compatible with ecosystems 0.92-388 and later. There is now a download for earlier ecosystems available, and the pre-0.92-388_rpad.ko binary as a separate file.
This installs the FPGA bitstream and the driver. After the bitstream is loaded, the yellow LED0 will stop flashing. The driver installs /dev/rpad0, which you can use eg. as a source for cp:
Code: Select all
redpitaya> killall nginx redpitaya> cat /tmp/ddrdump.bin > /dev/xdevcfg redpitaya> nginx -p /opt/www redpitaya> insmod /tmp/rpad.ko
Code: Select all
redpitaya> cp /dev/rpad0 /tmp/adcdata.txt
Each time you issue the copy command (to be precise, each time the device is opened anew), the driver will do a one-shot acquisition of one megasample length with the current scope settings. The samples are written as hex numbers to the target textfile, channel A data first, then channel B data.
Code: Select all
redpitaya> cat /dev/rpad0 > /tmp/adcdata.txt redpitaya> cat /dev/rpad0 >> /tmp/adcdata.txt ...
Bear in mind that the acquisition length for the demo is always 1MS, so using the demo while running at high decimation will take a while.
By the way, it is possible to do the copy while the scope application is running (though it sometimes interferes with the scope's trigger).
If you are on a local console (via USB), you will see diagnostic output. If you are connected remotely, you can use dmesg to see the messages.
A note on buffer size:
The FPGA extension will happily use all available RAM if you tell it to do so. I chose to use smaller buffers (2*2MB) because linux does not support allocation of very large chunks of contiguous physical RAM. There are ways to use larger buffers and still play nice with linux and I will gladly discuss specifics with interested users.
This is very much a work in progress. Contributions of opinion, support or ideas are very welcome.
Current state of the project and outlook:
- The FPGA functions have been simulated, tested, and found to work reliably, but new capabilities can and will be added over time. This is in large parts depending on community requests and contributions.
- The kernel module is a proof-of-concept right now, and has been designed to allow testing of the logic, and not much more. My plans are to expand its scope to act as a driver for all of RedPitaya's functions. Progress in this area will also be heavily influenced by user feedback.
- There is currently no web application to access the new functionality. I invite all interested developers to have a go at it and I will do my best to help with advice and code.
(Please note that the kernel module has to be built by hand for now. Go to OS/driver/rpad/src and execute "make" to do that after at least the linux kernel was built successfully.)
Have fun (and please tell me what you think)