cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] SWD pins used by mistake in code, now locked out of chip (G030F6 - TSSOP20). How to revert?

RMaia
Associate III

By mistake, I ended up setting PA14 (SWCLK) as an input GPIO. Didn't catch the mistake until after the MCU had already been flashed. So, after that I can't connect to it anymore using ST-Link.

Since I'm using a STM32G030F6 (TSSOP-20) chip, for this chip the boot0 pin is shared with the same PA14. I did try to connect PA14/BOOT0 to either GND and VCC (and reset the board afterwards each time), but I wasn't able to get it into bootloader mode.

Also attempted to connect with STM32CubeProgrammer via UART (to UART2, on PA2/PA3), but that wasn't successful, despite many attempts. As I understand, to access UART1 I need to set the SysCfg remapping registers so PA11/PA12 become PA9/PA10, so connecting (via CubeProg) to UART1 didn't work either.

So I've run out of options to try to connect to chip and re-flash it with a code that enables PA14 as SWCLK again.

Are there additional procedures I could try?

1 ACCEPTED SOLUTION

Accepted Solutions

Connect Under Reset methods are best hope, needs NRST to be connected to debugger.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

6 REPLIES 6
Paul1
Lead

Not certain but maybe worth a try:

- connect RESET pin to ST link might allow it to take over the chip.

I recall seeing settings in the IDE Tools for what to do with RESET pin during programming.

Paul

Connect Under Reset methods are best hope, needs NRST to be connected to debugger.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
RMaia
Associate III

Thanks guys!!!

Connect under reset did it. Was able to successfully connect and reflash using ST-Link, didn't need to use CubeProgrammer or fiddle with the Boot0 pin. I just put a jumper wire between the RST pins on ST-Link and the MCU and voilá (and of course changed the IDE debug settings to "connect under reset").

Sara BEN HADJ YAHYA
ST Employee

Hello @RMaia​ ,

How to solve debugger connection issues article contain a detailed description about this issue.

What you did is correct and thank you for sharing your finding.

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

The thing that would help people find things faster would be for the Salesforce "Search" tool to actually function. I'd like it to function, so I can find cites and references.

Forums are like "Ground Hog Day", even if something is findable with low effort, it's likely to still be asked over and over.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Yes, sometimes the same question will be asked more than once. Even with a good search feature implemented, sometimes the person just doesn't know what keywords to look for...