AnsweredAssumed Answered

How to restart DMA in the fastest way?

Question asked by karoly.kolos on Jun 18, 2014
Latest reply on Aug 6, 2014 by karoly.kolos
Dear Community!

I'm using DMA to transfer the ADC1 results (100 consecutive data) to some incremented memory address. DMA is in Normal mode (not circular), it is transfering 100 data, repeatedly over time.

After the first transfer I found out if I fully reinitialize the DMA, the next transfers are also working. The problem is that it takes "a lot of time", which is too much in my application.

Instead of fully reinitializing the DMA I tried to clear Transfer Complete flag and reload NDTR register, but no luck so far. At this moment this part of code looks something like this:
DMA_Cmd(DMA2_Stream0, DISABLE);

// Wait until DMA is disabled
while( DMA_GetCmdStatus(DMA2_Stream0) );

DMA_ClearFlag(DMA2_Stream0, DMA_FLAG_TCIF0);

DMA_Cmd(DMA2_Stream0, ENABLE);

What is the fastest way to reinitialize DMA? What variables/flags have to be set/cleared exactly?