AnsweredAssumed Answered

STM32F205 DMA Problem

Question asked by BinaryChris on Aug 25, 2014
Latest reply on Aug 25, 2014 by BinaryChris
Hello,

I am trying to use DMA to transfer data from a buffer in RAM to a GPIO BSRR port triggered by a timer.  Due to the way the hardware is laid out I am committed to using TIM5 as the trigger.  The DMA trigger is TIM5 Update on channel 6 stream 0 of DMA1.  When I run the software the Number of Data decrements by 1 but the transfer error flag is set and the stream enable bit is reset.  If I change the stream to use TIM1 Update channel 6 stream 5 on DMA2 everything works as expected.  I cannot go over to using TIM1 in the application due to hardware constraints.

Here is the code used to configure the DMA channel

  DMAInit.DMA_Channel = DMA_Channel_6;
  DMAInit.DMA_Memory0BaseAddr = (uint32_t)(&LineCounter[0]);
  DMAInit.DMA_BufferSize = 15;  
  DMAInit.DMA_PeripheralBaseAddr = (uint32_t)&(GPIOC->BSRRL);   
  DMAInit.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
  DMAInit.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
  DMAInit.DMA_Priority = DMA_Priority_VeryHigh;
 
  DMA_Init(DMA1_Stream0, &DMAInit); 

Before enabling the timer the registers of the DMA1 stream 0 are

CR   0x0C035541
NDTR 0x0000000F
PAR  0x40020818
M0AR 0x200001E8
M1AR 0x00000000
FCR  0x00000008

And after
CR   0x0C035540
NDTR 0x0000000E
PAR  0x40020818
M0AR 0x200001E8
M1AR 0x00000000
FCR  0x00000020

and LISR now reads 0x00000008

Why does it work on DMA2 and not DMA1?
What is causing this problem and how is it fixed?

Thanks,
Chris

Outcomes