cancel
Showing results for 
Search instead for 
Did you mean: 

erase and write internal flash

xiewenliang
Associate II

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

 

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

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

 

 

 

 

 

 

2 REPLIES 2
Dor_RH
ST Employee

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

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