Skip to main content
Visitor II
February 14, 2019
Question

Bus stall when writing/erasing flash on STM32H7

  • February 14, 2019
  • 3 replies
  • 1756 views

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.

    3 replies

    Graduate II
    February 14, 2019

    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.

    ST UserAuthor
    Visitor II
    February 19, 2019

    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.

    Visitor II
    May 9, 2021

    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 ? 

    Visitor II
    November 29, 2022

    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

    Technical Moderator
    October 6, 2025

    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