Martin
-->DMA checks if ringbuffer is being accessed?*
The DMA circular buffer operation is fully independent of the processor - it will in fact continue operating when the processor is paused with the debugger - see the following ADC-DAC DMA reference which allows audio to be transferred even when the processor is not operating: https://community.freescale.com/message/370676#370676
This means that the circular buffer will indeed be reused if the SW is too slow to handle the data before it is overwritten. Therefore the buffer size should be chosen suitably to ensure that it doesn't happen in the worst case (that is when your software has its longest delay due to other work load).
It is also possible to program the circular buffer to terminate after a single cyle and the SW then needs to restart it each time - this would avoid overwrites but instead adds critical periods where input will not be operating (and single captures lost). It is therefore a system design/tradeoff but usually it shouldn't be a problem to ensure that the buffer is not cleared in time by dimensioning it adequately.
The DMA also supports a half-buffer interrupt that can be useful if polling is to be avoided.
>>but I kind of fear the complexity
The DMA can be a little complicated in case you haven't used it before but there is a complete solution in the uTasker projet for circular buffer operation (free-running or half-buffer interrupt based) which means tht it can be used by any peripheral with only a couple of address changes. Since the uTasker simulator handles also DMA operation it can be simply tested to ensure that it is configured and operating correctly and any interraction with the application is as envisaged. HW operation would then work without any extra investment.
Regards
Mark
Kinetis: µTasker Kinetis support
K20: µTasker Kinetis TWR-K20D72M support / µTasker Kinetis FRDM-K20D50M support / µTasker Kinetis TWR-K20D50M support / µTasker Kinetis support
For the complete "out-of-the-box" Kinetis experience and faster time to market