AnsweredAssumed Answered

KL26Z PIT, ADC, Two Channel DMA Ping-Pong Buffer

Question asked by Gavin Lowes on Sep 25, 2018
Latest reply on Sep 27, 2018 by Hui_Ma



I am using the FRDM-KL26Z development board with MCUXpresso IDE to sample a signal using the ADC triggered via PIT. I plan to use two DMA buffers in a ping-pong arrangement to collect ADC samples. The idea is to process data in Buffer A whilst Buffer B is being filled in a continuous ping-pong fashion. The problem I am having is linking the two buffers to automatically start and stop transferring data from the ADC. The only way I have achieved this is to use the DMA Callback function to manually Stop and Start transfer which is not ideal because I think this should happen in hardware using the DMA_SetChannelLinkConfig function.


Whilst trying the DMA_SetChannelLinkConfig function to establish a link, Buffer A fills as normal being the first buffer initiated and a link is indeed created to Buffer B but only the last sample taken from Buffer A is placed into the array and then nothing more. I believe the problem is down to the Buffer B not having ERQ bit set in the DMA_DCR register but the only other way I can see of setting this is manually via the DMA Callback function. I am aiming for a full hardware routine with minimal interrupt intervention to maintain a low power operation.


I am fairly new to this platform so I hope this makes sense and I appreciate any help.