Circular DMA reading ADC
Posted: Wed Jun 29, 2022 10:39 pm
I have a system where I am reading the ADC (via DMA using I2S driver) and copying the data to a circular buffer until I receive an external interrupt.
Once the interrupt is received, I wait for a time, then stop the ADC/DMA. I then process a section of the circular buffer from before and after the interrupt point.
I 'd like to avoid the copy overhead from the DMA buffers to the big circular buffer.
It seems like this should be feasible using a circular linked list of DMA buffers, but there is no support for this in the driver and getting it to work by experimentation with the DMA registers could be very time consuming.
Does anyone have a relevant example of similar code? Could someone familiar with the hardware and the I2S driver give me some tips as to what is required to make this work?
In particular:
1.How should I modify the DMA setup?
2.How to stop the ADC/DMA?
3.How can I read the location it had got to in the buffers when stopped?
4.Can I use a single large DMA buffer in a circular mode?
Thanks very much in advance!
Once the interrupt is received, I wait for a time, then stop the ADC/DMA. I then process a section of the circular buffer from before and after the interrupt point.
I 'd like to avoid the copy overhead from the DMA buffers to the big circular buffer.
It seems like this should be feasible using a circular linked list of DMA buffers, but there is no support for this in the driver and getting it to work by experimentation with the DMA registers could be very time consuming.
Does anyone have a relevant example of similar code? Could someone familiar with the hardware and the I2S driver give me some tips as to what is required to make this work?
In particular:
1.How should I modify the DMA setup?
2.How to stop the ADC/DMA?
3.How can I read the location it had got to in the buffers when stopped?
4.Can I use a single large DMA buffer in a circular mode?
Thanks very much in advance!