cancel
Showing results for 
Search instead for 
Did you mean: 

DMA starting and stoping

hamed_solar
Associate II
Posted on July 01, 2016 at 18:20

Hi

I use DMA for transferring data from ADC to ADCConverted[300] .

I stop DMA somewhere in my program and get the position of the current transferred value by this command:  Current_Pos2= ((uint16_t)(DMA1_Channel1->CNDTR));

After a while I enable the DMA. I want to know does it begin to transfer the values from the zero index of array or  from the last index of array that it was stop?

Regards
1 REPLY 1
Posted on July 05, 2016 at 11:36

> I stop DMA somewhere in my program

The key question is, how do you do that.

If you disable the DMA channel/stream by clearing DMA_CCRx.EN bit, upon re-enabling it, the *last written* CMAR/CPAR/CNDTR will become active, i.e. in your case it will write to array from the zeroth index up to the full size of array, regardless of what was the *read* value of CNDTR.

If you disable the DMA channel/stream by disabling its trigger/request signal at the source (i.e. in the peripheral which triggers it) or in the multiplexer (this depends on the particular STM32 model you use), after re-enabling DMA will continue where left.

JW