Skip to main content
Gabriel T
Senior
November 27, 2020
Solved

STM32H743 write in smth smaller than flash sector

  • November 27, 2020
  • 2 replies
  • 1098 views

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.
Best answer by TDK

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.

2 replies

TDK
TDKBest answer
November 27, 2020

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.
November 27, 2020

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