2014-08-25 12:18 AM
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 channelDMAInit.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 areCR 0x0C035541
NDTR 0x0000000FPAR 0x40020818M0AR 0x200001E8M1AR 0x00000000FCR 0x00000008And afterCR 0x0C035540
NDTR 0x0000000E
PAR 0x40020818
M0AR 0x200001E8
M1AR 0x00000000
FCR 0x00000020
and LISR now reads 0x00000008Why does it work on DMA2 and not DMA1?What is causing this problem and how is it fixed?Thanks,Chris2014-08-25 04:38 AM
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 TIM82014-08-25 05:29 AM