Description
I'm using a Swan R5 (STM32L4R5). About 50% of the time when I flash code using the Arduino IDE, then my option bytes are left in such a state that the device will no longer operate.
I can reset the option bytes and flash the firmware using STM32Programmer application, and the Swan will work as expected.
Here is the bad state set by the Arduino IDE when it errors:
Here is the state I am restoring it to:
I'm running Pop!_OS (Debian) Linux 21.10 and Arduino IDE 1.8.19.
This has happened on two separate boards now. Should I be modifying any additional registers to restore the board, and is there something I can do to prevent this from happening in the future. It did not used to happen before (older version of Linux and Arduino IDE), and now it happens quite frequently.