cancel
Showing results for 
Search instead for 
Did you mean: 

Why SWD stopped working after re-programming?

RLour.1
Associate II

I have an STM32G030 board that I was debugging, and all was going well. Then I started getting an 'unable to connect' message while debugging. Reading some of the forum, the issue appears to be that I checked "Set all free pins as analog (to optimize the power consumption)".

I am using STM32CubeIDE Version: 1.9.0 and device configuration tool.

Under Debug Configurations->Debugger I have:

SWD and ST-LINK selected.

Frequency (khz) Auto

Access port: 0 - Cortex - M0plus

Under reset behavior I have tried all settings.

I have tried with the boot pin pulled high

I have tried holding reset and releasing after launching debugging.

Is my development board bricked?

My sample program turns on an LED (by default from the MXCube tool).

I have unchecked the "Set all free pins as analog (to optimize the power consumption)" in the MXCube view and regenerated the code. As soon as the LED lights, I know it will fail. I have even changed the program so I disable the LED to prove that the code is not loading.

Thanks

Output of the debug session (I released the reset button on the dev board some time after starrting the debug session.

Log output file:  c:\users\richard\appdata\local\temp\stm32cubeprogrammer_a06696.log

ST-LINK SN : 54FF6A064880575747700987

ST-LINK FW : V2J39S7

Board    : --

Voltage   : 3.24V

Error: No STM32 target found!

Encountered Error when opening C:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.200.202202231230\tools\bin\STM32_Programmer_CLI.exe

Error in STM32CubeProgrammer

Shutting down...

Exit.

6 REPLIES 6
MM..1
Chief II

As soon as the LED lights, I know it will fail. I have even changed the program so I disable the LED to prove that the code is not loading.???

SWD pins is shared with GPIO and other func, if you plan debug , this pins require unprogrammed.

In CubeIDE mark in SYS part SWD using.(serial wire)

KnarfB
Principal III

In STM32CubeIDE projects Debug Config try setting Debug Probe ST-LINK (OpenOCD) and Connect under Reset. Or, better, use STM32CubeProgrammer with connect under reset. Connect debugger while reset before your firmware kicks in. Needs a bit experimenting to find the correct timing.

Good luck

KnarfB

Thanks. I see the checkbox. I fear if have bricked my board. I changed my code so that the LED on the dev board defaults to off, so that if the code does happen to load, I will know because the old code (that bricked the board) turns on the LED. New code never loads.

RLour.1
Associate II

STM32CubeProgrammer core dumps when I try to connect (Linux version). I tried the various settings. I give up. Thankfully, I have two more from Aliexpress. They take 30 days to arrive.

I appreciate the assistance the preventative solution by MM..1 will prevent this from happening again.

Use windows PC install STM32CubeProgrammer. Erase "bricked" board with settings connect under reset, but your STLINK need support it.

Piranha
Chief II

For "connect under reset" to work, NRST must be connected to the debugger.