cancel
Showing results for 
Search instead for 
Did you mean: 

Programming flash with DMA

francois06
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

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 Up vote any posts that you find helpful, it shows what's working..

View solution in original post

5 REPLIES 5

Sounds like a bad plan.​

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
francois06
Associate II

What do you mean ?

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 Up vote any posts that you find helpful, it shows what's working..

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

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.