2024-11-28 02:39 AM
Hi STM Community,
I want to ask if I have to Erase Flash memory sector (HAL_FLASHEx_Erase) before I write into flash memory (HAL_FLASH_Program)?
I tried it and nothing happend. I want to be sure, that is not an accident.
2024-11-28 02:46 AM
Yes - that is the nature of Flash.
In STM32, you probably have to unlock before you can erase or write - check the chip's Reference Manual, and/or the HAL documentation ...
2024-11-28 03:00 AM - edited 2024-11-28 03:01 AM
Hello, As said by @Andrew Neil this is the nature of the NOR Flash memory:
From the reference manual:
You can inspire from this example provided in STM32H7 Cube HAL:
See also this video on how a generic NOR flash memory is working: https://www.youtube.com/watch?v=V1JdpqvUIhk