2020-09-09 03:27 AM
HI, we are working on STM32H750. in our program, we need to store 5 bytes in the internal flash. this data will be read everytime the device is powered on. the data will be changed whenever the settings are changed by the user. i.e. once in a while.
My question is... is it compulsary to erase and program the whole sector for 5 bytes? do we have any way to erase and reprogram a smaller chunk?
2020-09-09 04:38 AM
You cannot erase less than a full page. You also can't re-write settings to the same location without first erasing.
However, you can write new versions of your settings in different locations, check for and use the latest, and only erase the page when it doesn't have space for a new version. Consider writing 6 bytes, with one of them 0x00 to indicate the settings exist in that location.