Skip to main content
MRebo.2
Associate II
April 29, 2022
Solved

Why It's necessary erase the flash before write in code time?

  • April 29, 2022
  • 2 replies
  • 5189 views

When we program the any stm32 mcu, we can choice between erase the memory or no in STM32CubeProgrammer. Why in code time we can't write in flash without erasing the memory?

This topic has been closed for replies.
Best answer by TDK

> Why in code time we can't write in flash without erasing the memory?

Because that is a fundamental hardware limitation of FLASH memory.

https://en.wikipedia.org/wiki/Flash_memory#Block_erasure

2 replies

TDK
TDKBest answer
Super User
April 29, 2022

> Why in code time we can't write in flash without erasing the memory?

Because that is a fundamental hardware limitation of FLASH memory.

https://en.wikipedia.org/wiki/Flash_memory#Block_erasure

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
April 29, 2022

Which STM32?

> Why in code time we can't write in flash without erasing the memory?

You can, but if the FLASH was not erased, the write may/will fail.

The option in CubeProgrammer is for the case that you've erased the FLASH some time before the programming, or you are using a brand new never programmed chip (which is erased from factory).

JW