From my mislead I put HAL_PWR_EnterSTANDBYMode() in the code whithout any wakeup behaviour, which made my chip unable to debug via SWD interface. So I can not either erase, upload new code or do anything with this chip.

I have an Aliexpress ST-Link V2 dongle for programing and debug. I connected the terget to the dongle with the following wires:

  • 3,3V
  • GND
  • NRST

I hoped that NRST will hold the target from running my broken code, but it is still not programmable and debuggable (I turned Reset behaviour setting to "Connect under reset").

The second thing I tried is to connect BOOT0 pin to VCC while power up. The problem is that my chip is STM32G030F which has BOOT0 and SWCLK on the same pin (PA14). So I tried to power up while PA14 (BOOT0) was connected to VCC and then - I disconnected PA14 from VCC and connected PA14 (SWCLK) to USB dongle. Same thing: no effect.

What else can I do to wake up my chip from standby mode?


1 Answer 1


Connecting the SWD with NRST asserted, halting the core, releasing reset and doing a mass erase will work.

The problem is NRST. A lot of software tools default to commanding reset via an SWD sequence, not using the hardware signal until you find a buried mode option.

Worse, your "fake" ST-Link probably cannot drive its NRST signal at all, as those boards all seem to have a mismatch between physical connection and firmware so the pin toggled by the MCU never makes it to the connector.

Using a fully functional debug adapter that acutally drives NRST is going to be key if you work with suspend modes, as you'll see this issue over and over. You could get a real ST-Link or whip up a CMSIS-DAP in a supported eval board, etc. Black magic firmware might fix your fake, or you can consult schematics and do microsurgery on it, easier if it's a TQFP than QFN inside. Have a raspberry pi? You can use the GPIOs as an SWD under openocd, just don't try to steal its 3v3 but regulate your own.

  • \$\begingroup\$ Can I operate NRST pin with my hand? \$\endgroup\$ Dec 10, 2020 at 18:13
  • \$\begingroup\$ It probably needs more coordination with the SWD, so probably not unless you modify the software operating that. Now that I think about it, manual reset did used to work with ST's old windows GUI tool and the "connect under reset" menu option. \$\endgroup\$ Dec 10, 2020 at 18:26
  • \$\begingroup\$ I've had luck with hand operating the reset (shorting NRST via a test pad) on an STM32F103 in a similar situation (one of the SWD pins turned off in firmware). \$\endgroup\$
    – Timo
    Dec 10, 2020 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.