-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hello,
I commented in your streaming code, but i realize that this is the more appropriate folder to comment in. I have successfully gotten this code (rpi_adc_dma_test.c) to capture at 2.5Msamples/sec and store into a .csv file. I am now trying to make this continuously stream the data into a FiFo, similar to your other code in "streaming." I am trying to accomplish this by implementing a ping-pong buffer in the function "adc_dma_samples_ads7884" (line 325), but have had no real luck thus far. This is my first experience with DMA, and as such I am not really familiar with what must be done to set this up. My assumption is that I will need to double the number of control blocks and add another buffer (B), so that while A is being written, B can be read and visa-versa.
In looking at your streaming code (rpi_adc_stream.c) for the MCP3008 as a guide, it looks like this is what you are doing in "adc_dma_init" (lines 403+); using several control blocks to write to rxd1, and then several more to write to rxd2, with a few other control blocks used for timing. Since the ADS7884 doesn't take input and is controlled purely by clock cycles, I believe that the timing blocks are unnecessary (that I don't need a third channel for triggering PWM?) though I do need a way to switch between the two. Currently it looks like it is continuously reading from the buffer until it is empty (dma_wait(DMA_CHAN_A)). But I don't think that this method will work for continuous streaming...
I guess my questions are; are my above assumptions correct? what would you recommend in terms of timing/coordinating for the ping-pong buffer?
Once again, thank you so much for your time. I really appreciate the time you have taken already to write this code and its corresponding guide, as well as the time to respond to my previous questions.
Cheers,
Bryce