cancel
Showing results for 
Search instead for 
Did you mean: 

How to unbrick STM32C0

EP.2
Associate III

How to unbrick a C0 if user firmware reprograms SWD pins as IO? Because by default BOOT0 pin is disabled so there's no way to enter the bootloader unless it's enabled in OPTIONS bytes. I've added a failsafe 2 second delay at bootup before running any GPIO config, but I'm curious if there's any other way to unbrick. Or if RDP1 is enabled, how to change it back to RDP0 if you can't get in via SWD or into bootloader because BOOT0 isn't enabled? Or am I missing something?

BOOT0 pin by default is disabled in OPTION bytes, but you can't enable it, or erase the firmware/flash if SWD is not working...

I'm using STM32C071 but I assume it's all C0 if they don't have the BOOT0 pin enabled by default.

3 REPLIES 3
KnarfB
Super User

If you are short in pins and have only SDWIO and SWCLK connected, the only way is to use SWD in "connect under reset" mode using STM32CubeProgrammer or such. You may be able to connect in the short period after power-on and before the firmware has booted and reprograms those pins to another function. This may require several attempts. Adding a short delay will clearly help here.

hth

KnarfB

EP.2
Associate III

Thanks, didn't know about "Connect under reset", so I just looked it up, seems like it should work, so in theory should allow SWD before firmware boots. Thanks!

I am adding an extra startup delay, but I was just curious what would happen if I forgot the delay, how I would go about recovering a device without actually deliberately trying to brick one because I've only got 1 to test with for the time being...

It may be a tedious procedure or hindered by external components depending on the board. So, you should test it before going to mass production.

hth

KnarfB