Skip to main content
francois06
Associate II
Feb 20, 2019 8:19 AM UTC
Solved

Programming flash with DMA

Hello,

I would like to know if it's possible to write from RAM to FLASH using a DMA.

I tried to configure a DMA as memtomem, using the HAL_DMA_Start function but it doesn't work.

Is it doable ?

Thank you.

François

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Feb 20, 2019 8:56 AM UTC

It adds complication​ without any benefits or advantages, and is not a use case that is likely to work.

Check the error/status thrown by the DMA controller. It is likely not an error that can be resolved by hitting it harder.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

5 replies

Tesla DeLorean
Guru
Feb 20, 2019 8:27 AM UTC

Sounds like a bad plan.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
francois06
Associate II
Feb 20, 2019 8:39 AM UTC

What do you mean ?

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Feb 20, 2019 8:56 AM UTC

It adds complication​ without any benefits or advantages, and is not a use case that is likely to work.

Check the error/status thrown by the DMA controller. It is likely not an error that can be resolved by hitting it harder.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
francois06
Associate II
Feb 20, 2019 9:05 AM UTC

Okay thanks for your explanation.

For those who wants to know more, I found another post which talks about this topic.

https://stackoverflow.com/questions/52773949/dma-to-flash-for-stm32

It explains in detail what you said.

turboscrew
Senior III
Feb 21, 2019 7:07 AM UTC

I don't think DMA is able to wait long enough for a write to be finished. Flash doesn't make requests, so you need to do memtomem, and DMA writes as fast as it can. One write to flash takes microseconds. Flash operations stall the uC, but I don't think they stall DMA.