cancel
Showing results for 
Search instead for 
Did you mean: 

Debugger will step OK but loses connection

EAppe.1
Associate II

Issues:

  • target MCU programs correctly.
  • debug aborts on resume or run, then target runs by itself.
  • single-stepping works, but if breakpoints are set then on resuming or running then debugger never stops at the breakpoint(s).

Debugger connection lost.

Shutting down...

  1. The same problem occurs with multiple boards - BluePill (F103C8xx), BlackPill (F411CEUx) and CELEX STM32F407CE.
  2. STM32CubeIDE is being run under Linux Mint 20- Cinnamon version 4.6.7 with kernel 5.4.0-58-generic, howevr an associate reports experiencing the same issue under Windows 10.
  3. STM32CubeIDE is the latest version: Version: 1.5.1  Build: 9029_20201210_1234 (UTC).
  4. The problem doesn't only occur with the Chinese ST-Link V2 - it also occurs with an ST-Link V2 on a Nucleo board.
  5. 3.3V is wired to the target board from the ST-Link in addition to the 3.3V supply for the target.
  6. "Debug" is configured for "Serial wire" under "SYS" in the "Pinout & Configuration" page and therefore both of the TMS_SWDIO and TCK_SWCLK pins are allocated.
  7. The only user code in main() is as follows and there is no other user code. The clocks are all set correctly in the case of each target. :

   /* USER CODE BEGIN 3 */

      HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);

      HAL_Delay(100);

 }

 /* USER CODE END 3 */

The full console output on entering debug mode is as follows:

STMicroelectronics ST-LINK GDB server. Version 5.7.0

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

Starting server with the following options:

       Persistent Mode           : Disabled

       Logging Level             : 1

       Listen Port Number        : 61234

       Status Refresh Delay      : 15s

       Verbose Mode              : Disabled

       SWD Debug                 : Enabled

       InitWhile                 : Enabled

Waiting for debugger connection...

Debugger connected

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

                       STM32CubeProgrammer v2.6.0-RC3                 

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

ST-LINK SN : 53FF6A064989575252252087

ST-LINK FW : V2J37S7

Board      : --

Voltage    : 3.23V

SWD freq   : 4000 KHz

Connect mode: Under Reset

Reset mode : Hardware reset

Device ID  : 0x431

Revision ID : Rev A

Device name : STM32F411xC/E

Flash size : 512 KBytes

Device type : MCU

Device CPU : Cortex-M4

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_gnBnqT.srec

 File         : ST-LINK_GDB_server_gnBnqT.srec

 Size         : 4300 Bytes

 Address      : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sector 0

Download in Progress:

File download complete

Time elapsed during download operation: 00:00:00.344

Verifying ...

Download verified successfully

Debugger connection lost.

Shutting down...

UPDATE

An associate has done some tracing and says that if he uses the low-level drivers then the debugger works as intended, but as soon as he changes to the HAL then the issue appears. I have not had time to verify this.

1 ACCEPTED SOLUTION

Accepted Solutions
EAppe.1
Associate II

I have just managed to resolve this.

It appears that the checkbox "Skip All Breakpoints" under the "Run" menu was inadvertently checked. I don't recall ever checking it so I wonder whether it was set to that state on installation?

View solution in original post

2 REPLIES 2
EAppe.1
Associate II

I have just managed to resolve this.

It appears that the checkbox "Skip All Breakpoints" under the "Run" menu was inadvertently checked. I don't recall ever checking it so I wonder whether it was set to that state on installation?

EJOHA
Senior

Hi EAppe.1,

The installation should not have set "Skip All Breakpoints" so probably it was manually and unintentionally set. Good that you managed to solve it.