Skip to main content
Gabriel T
Senior
Nov 27, 2020 1:00 PM UTC
Solved

STM32H743 write in smth smaller than flash sector

Hi,

I need to write some data in the flash memory of my STM32H743ZI MCU, for example serial number

Can I write this data in something smaller than a whole flash sector ?

Regards,

Gabriel

This topic has been closed for replies.
TDK
TDKBest answer
Nov 27, 2020 1:39 PM UTC

You can write individual bytes if you want, but the area you're writing needs to be erased before it is written, and you cannot erase less than a full page/sector of flash.

"If you feel a post has answered your question, please click ""Accept as Solution""."

2 replies

TDK
TDKBest answer
Nov 27, 2020 1:39 PM UTC

You can write individual bytes if you want, but the area you're writing needs to be erased before it is written, and you cannot erase less than a full page/sector of flash.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Pavel A.
Nov 27, 2020 7:13 PM UTC

On STM32H7 the optimal write unit is so called "flash word" which is 32 bytes (256 bits).

The HAL library function HAL_FLASH_Program() does not accept other variants such as individual bytes.

So, ensure that you write in multiples of 32 bytes, at address aligned on 32 bytes.

-- pa