According to STM32F407 reference manual page 313, memory to memory mode in DMA is a mode that doesn't need any triggering request from a peripheral and it will happen just after the stream enable bit is set. (also we know from the reference that only the DMA2 could handle memory to memory data transfer) :
So the question is for a transfer between two integer array defined in the memory area, which stream of DMA2 must be enabled and which channel of this stream must be used to have a DMA transfer without any peripheral triggering and only when enabling the DMA stream?
In fact what i want is sending some data from a buffer array in the memory area to a GPIO output data register. As is said what i expect to happens is when stream is enabled the transaction just happens but the result was not what i expected and no data is sent to that GPIO output data register. I want to use memory to memory DMA mode because it doesn't need any extra triggering
Best Answer
After one day really hard challenging with the problem! i finally figured out some important points that is i think will be worthy for other people out there so i decided to represent them:
The STM32's DMA is a very quaint tool that i today realized that it can handle almost every kind of data transmission from a memory area to another memory area(such as moving one array members to another one) or from a memory area to a control register of a peripheral(for example i tried to config and initialize a GPIO by DMA and it works absolutely accurate!). The code is placed in the following and that is for STM32F407 Disco Board(PD12 to PD15 are connected to on board LEDs).
We can handle this goal(GPIO initializing using DMA) in either "Memory to Peripheral" mode with a Peripheral request triggering or in "Memory to Memory" mode without any triggering and just after enabling the DMA stream(no matter which stream and all do the job perfectly)
sizeof() operator returns size of an array in bytes, to determine the number of elements in an integer array you must divide the result by 4
The most important point that really annoyed me is that in "Memory to Memory" mode , the DMA peripheral port is the Source of transition and Memory port is the Destination of transition. See the Arrows direction below:
And finally i share my code that does the GPIO Initialization job:
At the end im sorry for my not so good English and i appreciate whom corrects my mistakes. My main aim was just to share my knowledge. Thanks for reading :)