Skip to main content
ST User
Associate III
Feb 14, 2019 6:08 PM UTC
Question

Bus stall when writing/erasing flash on STM32H7

Hello,

I am writing & erasing flash during operation, and this seems to cause a bus stall which prohibits all execution from flash during these operations.

AN4808 seems to indicate that if you use a dual-bank device you can avoid this by executing out of one bank and writing/erasing out of the other. I have tried this, and still seem to experience the bus stall even when running out of Bank 1 and doing write/erase out of Bank 2.

Does it make sense that this still causes a bus stall? Are there other ways around it?

I think perhaps the only solution is to copy my program to RAM and execute from there. Does anyone have examples of how to do this on an STM32 device?

Thank you!

This topic has been closed for replies.

7 replies

Tesla DeLorean
Guru
Feb 14, 2019 6:34 PM UTC

The stall will occur if any running code touches the flash array, so figure interrupt code, vector table, C library code, etc.

I've posted examples of moving code to RAM and running it, but some of this gets to be more involved than free support can cover.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
ST User
ST UserAuthor
Associate III
Feb 19, 2019 10:50 PM UTC

Thank you, I understand that this may be more in depth than we can go into on a message forum.

I'm curious why this still doesn't work when running from Bank1 and writing/erasing to Bank2: do you have any insight on this? Is there a way to configure the flash so that the two banks work more independently? If so this would solve the problem without having to move execution into RAM.

MDrew.1
Visitor II
May 9, 2021 7:16 AM UTC

Hi, I have exactly the same problem in blocking the bus. The whole application code is in bank 2 and any running code does't touches the bank 1. However, erasing any section from bank 1 still block the application. Have you deal with this problem ? 

MDrew.1
Visitor II
Nov 29, 2022 6:48 PM UTC

We didn't have much time to explore this problem and decided to switch Banks. Bus stall will NOT occur when running from Bank2 and writing/erasing to Bank1. Regards

mƎALLEm
ST Technical Moderator
Oct 6, 2025 9:19 AM UTC

Hello,

If someone else lands in this thread, another user has fallen at almost the same behavior and found the root cause of his issue. 

Please refer to this thread. 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.