Follow the below steps to implement the requirement:
1) ADC Configuration:
a) Configure ADC to sample data for every trigger sent to SOC (trigger can be generated periodically using a timer) and use the EOC output signal to trigger the DMA to transfer data when conversion is complete.
2) DMA Configuration:
a) Connect the EOC of ADC to trigger input of DMA.
b) Configure a descriptor to transfer data from "data output register" of ADC to some buffer location in memory.
c) Disable source address incrementation, auto increment destination by one data element.
d) Configure the descriptor to transfer N data elements ( 'N' is the number of samples required per cycle). Chain the descriptor to itself so that the new data is overwritten on the old ones every cycle.
e) Configure the DMA to generate an interrupt when one cycle of data transfer is complete.
f) Use the above generated interrupt to analyse the samples in M0+ core.
If these steps don't address your problem. Please ping back with more details.
The only issue with this scenario is that I want to have a large buffer of samples and roll it over when it gets to the end of the buffer. For example, say I need to get 8 inputs sampled (at 8-bit resolution) with the ADC. Through sequencing, it should be able to do this. I would assume that the DMA can transfer the 8 samples that get grabbed. I want to be able to store say 100 sample sets so my buffer is 800 bytes in size. I want to fill these 800 bytes then roll over back to the beginning of the buffer and overwrite the oldest data.
Can this be accomplished?
1 of 1 people found this helpful
Yes. This is exactly what the DMA does. Configure one descriptor to transfer 800 bytes of element. Then chain it back to itself. When the descriptor finishes the first 800 bytes of data transmission. It will redo the same process again, rewriting the data from the oldest to newest.
It is close to what you require. If you get any doubts please comment down here.
Thanks Yeshwanth. Our customer is following this thread and will work with the suggestions.
Sure. If exact specifications of the project are provided I can give a more specific project configuration details. Please feel free to post any doubts here.