2025-01-25 10:12 AM - edited 2025-01-26 01:34 AM
Hi,
I'm working on a STM32G030C8T6 based personal project and recently done a revision 2 to fix some annoyances and add some status LEDs. Programming and debugging is done via a STLink V3 and the SWD. I've encountered twice the same strange behaviour, with the second time replicating the first step-by-step:
If this was only a single board I would've concluded that some kind of hardware fault happened but I tried again on a second board, following the same procedure and the same behavior happened: the board is executing the firmware as intended but I'm unable to connect to it. I've tried to lower the SWD frequency but to no avail. Given the repeatability of this I'm now afraid to assemble a third board just to have it soft-bricked again.
Any idea if this is recoverable or what is going on would be appreciated. Thanks
Edit: typos
Solved! Go to Solution.
2025-01-26 05:24 AM
> undocumented error 10061
This seems to be an error number from windows concerning network/sockets, ask your search engine. Guess this error might go away after rebooting the build host.
When your firmware is running, you may attach SWD to the running code without a reset (hot plug). If this succeeds, you regain control over your firmware.
hth
KnarfB
2025-01-25 01:11 PM
> somehow jumps to 0x1FFFxxxx
Sounds like a reset to the system memory boot loader.
Do you use BOOT0 pin / NRST? How are these pins wired? How are the Option Bytes set?
> 18:39:23:166 : Connect mode: Under Reset
> 18:39:23:166 : Reset mode : Hardware reset
So, NRST is wired to the ST-LINK?
Anyway, I would use some minimal firmware first to separate HW from SW issues.
hth
KnarfB
2025-01-26 01:19 AM - edited 2025-01-26 01:19 AM
18:39:23:171 : Debug in Low Power mode is not supported for this device. Have you use it in app? Is some watchdog used in app or activated in options?
2025-01-26 01:59 AM
>Do you use BOOT0 pin / NRST? How are these pins wired?
In this particular chip BOOT0 is aliased with SWCLK, so it's wired to the STLink as such. As the datasheet says:
> Upon reset, these pins are configured as SW debug alternate functions, and the internal pull-up on PA13 (SWDIO) pin and the internal pull-down on PA14 (BOOT0 / SWCLK) pin are activated.
>How are the Option Bytes set?
My code doesn't touch the option bytes, they should be the factory value of 0xDFFFE1AA. However by not being able to connect and actually read them, this is an assumption.
> So, NRST is wired to the ST-LINK?
Yes, NRST is wired.
2025-01-26 02:07 AM
>Have you use it in app?
If you're referring to low power mode, no I'm not using it.
>Is some watchdog used in app or activated in options?
Since the firmware doesn't touch them they should still be the factory value, so no watchdog enabled neither I'm using one.
2025-01-26 04:36 AM
Then only PSU instability result to this issues. Bad soldering or wire... Too STLINK cables require be ok.
2025-01-26 05:24 AM
> undocumented error 10061
This seems to be an error number from windows concerning network/sockets, ask your search engine. Guess this error might go away after rebooting the build host.
When your firmware is running, you may attach SWD to the running code without a reset (hot plug). If this succeeds, you regain control over your firmware.
hth
KnarfB
2025-01-26 05:31 AM
10061 is WSAECONNREFUSED. Means connection refused, usually because there's nobody listening on that address & port.
2025-01-26 05:40 AM
>When your firmware is running, you may attach SWD to the running code without a reset (hot plug). If this succeeds, you regain control over your firmware.
It worked, STM32CubeProgrammer successfully connected this way. At least I know the chips aren't fried but it's still a mystery why random jumping to bootloader and refusal to work under reset.
2025-01-26 07:19 AM
Make a stress test that keeps the MCU busy with trivial (==guaranteed bug free) code, like a busy-wait blinky. If possible, observe if the MCU spontaneously goes through a reset (e.g. with a $10 logic analyzer monitoring the blinky pin). As @MM..1 suggested, validate the new hardware.
hth
KnarfB