Showing results for 
Search instead for 
Did you mean: 

Bootloader entry on STM32G07x


Hi all, I'm experiencing a strange issue where every once in a while I am unable to enter bootloader on the STM32G0. I have the option bits set correctly and have a hardware push button connected to both nRst and Boot0. I can normally hold the Boot0 button while toggling reset to enter the ST bootloader in ROM. However, every once in a while I enter a state where no matter how many times I reset, or the state of the BOOT0 pin, the device will boot into my application instead of the ROM. The only way to recover seems to be to fully power down the device, after which the bootloader entry continues to work as expected.

It is reproducible on brand new (blank) parts. They enter bootloader by default but after that aren't able enter bootloader by toggling BOOT0 until a power cycle. Outside of that, I haven't been able to deterministically reproduce it, but it does periodically enter this state.

Some notes that may be relevant

  • The application sets the OB to use BOOT0 to enter the ROM
  • The random occurrences of this state seem to be correlated with using the ST-Link
  • I suspected the SWCLK and BOOT0 sharing a pin as the issue (ie. pin is being reconfigured as an output), although this does not explain the blank flash case, or why hardware reset doesn't recover

Any ideas what this might be or how to debug/resolve?


The bootloader and the startup sequence is in ROM and isn't prone to erratic behavior. I would suggest methodically testing, staying objective.

Blank devices will always boot to the bootloader due to an empty flash check--no surprise there.

Having ST-Link connected during boot is going to control the BOOT0 pin, so you'll need to go the option byte route if you want to choose what should load.

If you feel a post has answered your question, please click "Accept as Solution".