cancel
Showing results for 
Search instead for 
Did you mean: 

Debug issue

NASI
Senior

Hello,

I have an issue debug issue in my custom board. The debug session works for a while and then stop to working and suddenly after many tries it works again.

When the debug session doesn't work, I get:

STMicroelectronics ST-LINK GDB server. Version 5.9.1

Copyright (c) 2021, STMicroelectronics. All rights reserved.

Starting server with the following options:

    Persistent Mode      : Disabled

    LogFile Name        : C:\Users\***\Debug\st-link_gdbserver_log.txt

    Logging Level       : 31

    Listen Port Number     : 61234

    Status Refresh Delay    : 15s

    Verbose Mode        : Enabled

    SWD Debug         : Enabled

COM frequency = 4000 kHz

Target connection mode: Attach

Reading ROM table for AP 0 @0xe00fffd0

Hardware watchpoint supported by the target 

ST-LINK Firmware version : V2J38M27

Device ID: 0x418

PC: 0x78f9e0

ST-LINK device status: RUN_MODE

ST-LINK detects target voltage = 3.26 V

ST-LINK device status: RUN_MODE

ST-LINK device initialization OK

Waiting for debugger connection...

Waiting for connection on port 61234...

Waiting for connection on port 61235...

Accepted connection on port 61234...

Debugger connected

Try halt...

ST-LINK device status: HALT_MODE

Enter STM32_HardwareReset() function 

STM32_HardwareReset(), failure reset target.

ST-LINK device status: RESET_MODE

 ------ Switching to STM32CubeProgrammer ----- 

   -------------------------------------------------------------------

            STM32CubeProgrammer v2.8.0          

   -------------------------------------------------------------------

Log output file:  C:\Users\***\AppData\Local\Temp\STM32CubeProgrammer_a14944.log

ST-LINK SN : 0668FF343537424257252146

ST-LINK FW : V2J38M27

Board    : NUCLEO-F302R8

Voltage   : 3.25V

Error: ST-LINK error (DEV_TARGET_CMD_ERR)

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

 ------ Switching context ----- 

Error in STM32CubeProgrammer

Debugger connection lost.

Shutting down...

Stopping port 61235

Received stop for port 61235, not accepting new connections.

I use ST-LINK device and pins SWCLK, SWDIO and NRST are connected to the custom board MCU STM32F105VC. (of course 3.3v and GND).

The debug configuration is attached.

Thank you.

12 REPLIES 12
NASI
Senior

Could be that the MCU goes to deep sleep mode? Because I can program the MCU and suddenly it stopped. Doesn't ST-LINK bring the MCU out off sleep mode?

I write this in first reply. And basic is when you plan use debug you cant use SWD pins in code usw.

Pins and attached flip-flops, etc are generally non-functional when unpowered..

There may be some DBGMCU related settings to keep certain domains and clocks enabled, but generally the processor is going to dump debug connectivity when entering SLEEP or STANDBY states. Frequently LSI is also in a domain that powers down. The manuals should provide specificity.

When doing "debugging" of power or transitional states it is better perhaps to use a serial port for telemetry/diagnostics so you can squawk as you enter and leave low power states. Among other things this is *significantly less invasive*, and more reflective of operation in the field.

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