AnsweredAssumed Answered

STM32F407 - DMA Double Buffer Mode To/From GPIO

Question asked by westmoreland.john on Nov 15, 2017
Latest reply on Nov 15, 2017 by westmoreland.john

Hello All,


I am trying to use double buffer mode on one of the GPIO ports - using the timer method; and I've enabled circular DMA mode and have enabled M0AR and M1AR; but when the first transfer takes place; I'm getting a program exception.


Does the DMA controller automatically make the switch between memory spaces or am I supposed to do that in the IRQ?


I thought once this was set up - the M0AR being Mem_0 and M1AR being Mem_1 did it.  I admit in the std perif lib the description of that being the 'current memory' is a little confusing - but I've tried implementing this several ways and the exception always occurs after the first transfer.


Right now - the DMA controller is copying to both buffers on every transfer - I see that in the debugger.


I am calling these command in my DMA init code:


DMA_DoubleBufferModeConfig(DMA2_Stream1, (uint32_t) &dbRxBuffer0[0], DMA_Memory_0);  // ? Current memory
DMA_DoubleBufferModeConfig(DMA2_Stream1, (uint32_t) &dbRxBuffer1[0], DMA_Memory_1);

DMA_DoubleBufferModeCmd(DMA2_Stream1, ENABLE);


Thanks In Advance,

John W.