2019-07-09 12:38 AM
I want to save a single bit persistently on my F042. I can use one entire flash page for that, but that is wasteful and messes up my bootloader CRC checking.
If I use the option byte user data byte 1, do I need to issue a system reset after it? Since I have to erase all option bytes to be able to write, can I just reprogram the old values with just one byte changed without calling HAL_FLASH_OB_Launch?
2019-07-09 01:44 AM
It is a flash block, so you should reprogram all option bytes after the erase. The reset is necessary to update the flash registers, and for the new settings to be used. If you only want the user byte for storage, this is not needed.
Remember that the RDP protection level has an influence: level 2 protection will disable option flash erase, and so prevent option byte updates.
2019-07-09 02:21 AM
That is a good point on the RDP level.
So the only purpose of the FLASH_OB_Launch function is to reset so that the new settings apply?
Thanks for your help!
2019-07-09 05:36 AM
Apparently, when I program the user data option bytes, the change only becomes apparent on next boot. That is unfortunate for me, since I just need a persistent storage area.