Problem with reloading option bytes - STM32L452RE
I want to modify option bytes to set up readout protection. I am programming this device with my own programming tool (UART+BOOT0+RESET pin). Programming works fine using bootloader protocol. Setting readout protection doesn't. After setting it up it doesn't boot, reset doesn't work, only powercycle works.
We cannot powercycle on this device as it will have large hybrid capacitor already soldered before programming. "powercycling" by shorting it for a moment may result in explosion ;)
So i tried to add a function to firmware that set readout protection leve.
Writing option bytes to flash works just as described - no problem. But they need to be reloaded.
AS instruction states on page 92 option bytes are reloaded when
a) BOR reset happens or exit from standby/shutdown mode.
And yes powercycling do work.
b) setting OBL_LAUNCH bit in FLASH_CR. As instruction states it should force system reset.
But it forces system hang instead which can only be resolved by powercycling - which we cannot do.
How to reload option bytes after writing to flash and reset the system WITHOUT disconnecting power?
