cancel
Showing results for 
Search instead for 
Did you mean: 

memory to memory working but not memory to peripheral (DMA)

rohanlal217
Associate II
Posted on July 01, 2016 at 04:14

I tried editing the simple DMA example in STM32Cube_FW_F7_V1.4.0\Projects\STM32F746ZG-Nucleo\Examples\DMA\DMA_FLASHToRAM

I changed the DMA direction register so its memorytoperipheral

instead of memorytomemory. And I changed the destination

memory address to one of the GPIO ports. 

For some reason its not working though. The GPIO pins aren't being written to at all.

It does however write to the ODR register if I leave it as memory_to_memory. 

The problem with this though is that I can't then have the memory pointer not increment for the destination address with each write.

http://ideone.com/KJTf1v

2 REPLIES 2
rohanlal217
Associate II
Posted on July 01, 2016 at 10:42

I found the problem. It was that 

This line was needed to increment the SDRAM address pointer. 

  DmaHandle.Init.PeriphInc = DMA_PINC_ENABLE;               /* Peripheral increment mode Enable */

And this line was needed to prevent the GPIO->ODR address pointer from 

incrementing.

  DmaHandle.Init.MemInc = DMA_MINC_DISABLE;                  /* Memory increment mode Enable     */

So it's the opposite to what you'd expect it to be.

This is a bug I take it?
re.wolff9
Senior
Posted on July 01, 2016 at 11:51

My guess would be that you reversed the peripheral and memory addresses. 

I don't really understand why ST has done it this way. but the DMA module somehow has an idea about what is the peripheral and what is the memory. It should have just been '' a device that copies data from SRC to DST'' and then you'd be able to set SRC to incremetn or not and the same for DST. As to triggering: you'd want to select what to use as a tirgger. A peripheral as a trigger is obviously useful. But timers or ''always'' is useful as well. The ''always'': is now called ''memtomem''. 

Anyway, it looks as if you reversed the memory and peripheral address. Maybe because you had the direction bit wrong so you reversed the memory and peripheral addresses to get the direction correct....