cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 write in smth smaller than flash sector

Gabriel T
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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".

View solution in original post

2 REPLIES 2
TDK
Guru

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.
Evangelist III

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