cancel
Showing results for 
Search instead for 
Did you mean: 

Option Bytes: Is it possible to program user data bytes without system reset?

Rafael Bachmann
Associate II

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?

3 REPLIES 3
K M
Associate II

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.

Rafael Bachmann
Associate II

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!

Rafael Bachmann
Associate II

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.