2024-10-10 01:19 AM
Hi
Because power-off protection is required, the times or variables need to be stored in flash。
Is my solution reasonable?
Create a space inside the flash to define variables, and read the data after powering on the computer. Then there is a problem with data accumulation , inside the my program the define variables be accumulated, because the data is stored inside the flash. Does the change of data require special processing? HAL_FLASH_Unlock()
How to define variables inside flash, please give a program example。
Thank you
2024-10-10 01:25 AM
2024-10-10 01:27 AM
To add, this variable of mine changes while the program is running. and needs to be stored in flash
2024-10-10 01:31 AM
Yes, that is addressed in the threads I linked.
2024-10-10 02:24 AM
NVRAM / BKPRAM might be more practical.
FLASH sectors on the F4 are quite large and time consuming to erase
You'd need to carve holes to use the smaller 16KB sectors.
You can journal writes across the sector, and the enumerate at next startup to find the last saved data.