cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F205 DMA Problem

Posted on August 25, 2014 at 09:18

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
2 REPLIES 2
Posted on August 25, 2014 at 13:38

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

Only DMA2 supports memory-to-memory? GPIO on AHB is not a Peripheral on APB1?

The initialization looks a bit spartan, can you use TIM8

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 25, 2014 at 14:29

Using TIM8 appears to be the only workable solution.  The diagram I was looking at was ambiguous and I thought it suggested GPIO was accessible on both DMA channels