Skip to main content
Associate II
April 24, 2024
Question

erase and write internal flash

  • April 24, 2024
  • 2 replies
  • 1404 views

Do I need to disable global interrupts for internal flash erase and write operations?

 

 __disable_irq();
 erase();
 __enable_irq();

 __disable_irq();
 write();
 __enable_irq();

 

 

 

 

 

 

    This topic has been closed for replies.

    2 replies

    ST Employee
    May 22, 2024

    Hello @xiewenliang,

    Could you specify the product or serie are you looking to reprogram the internal flash memory on? Additionally, could you share the intended purpose and any other relevant information that might aid in offering you the best support.

    Thanks and Best Regards,

    Dorsaf

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Dor_RH
    Tesla DeLorean
    Guru
    May 22, 2024

    Generally NO, but you don't want to erase active code or the vector table.

    If you read data/code from the same bank whilst the write/erase is occuring, it will STALL the MCU, basically stuff wait-states. As this can take a lot of time it can block read-time operation, like servicing a UART properly, or USB repressiveness, etc.

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