cancel
Showing results for 
Search instead for 
Did you mean: 

How can I remove error like 'Waiting for debugger connection... Debugger connected Debugger connection lost. Shutting down...'

Mohan1
Associate III

I am generating code using STM32CubeIDE, but when I start to debug I am getting errors like:

"STMicroelectronics ST-LINK GDB server. Version 5.2.3

Copyright (c) 2019, 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

Waiting for debugger connection...

Debugger connected

Debugger connection lost.

Shutting down..."

I am using the latest version of st-link USB driver(en.stsw link009). Also I am using USB to TTL converter. Initially everything was working very well, near about ten code executed successfully. But now facing the above error. So how can I solve it?

1 ACCEPTED SOLUTION

Accepted Solutions
mattias norlander
ST Employee

We have seen issues with a few number of devices that the user is forced to perform a mass erase before being able to flash a new bianry. This is obviously a bug and we try to fix it for the next version. If you do run into this problem with CubeIDE and ST-LINK GDB server then you can try to add the following to force a mass erase before programming the new binary:

In your debug configuration > Startup tab > Initialization commands > Add: monitor flash mass_erase

This will force CubeProgrammer_CLI version to peform a mass erase before programming new content. At least it automates the procedure you describe @GNels.2​ in your post above.

Other issues leading to debugger connection lost after the initial launch of your application typically includes:

  • Device goes into low-power mode without being configured to allow debug.
  • The application re-assigns the SWD related IO pins to some other function

View solution in original post

22 REPLIES 22
Ozone
Lead

Does you application use sleep mode ?

@Ozone​ thanks for your reply sir.My application not use sleep mode.

Ozone
Lead

From the information provided, it looks like the target disconnects itself somewhere later in your application.

I don't use Cube. nor CubeIDE.

Have you tried to debug your application from the reset vector on ?

@Ozone​ thanks for your reply sir,there is not any reset vector option for debug in IDE.

I don't know your IDE.

Perhaps there is a debugger setting "Run to main".

Disable that, and your debugger will supposedly stop at the reset vector.

@Ozone​ ok,thank you sir.

ATrev
Associate II

I've been tinkering with this problem for two days. I expose before the clumsy attempts I made and in the end my solution.

I recompiled my app and its elf: failed. I upgraded st-link and STM32CubeProgrammer: failed. I changed some settings of elf debugger section: failed. Once I succeded, but the day after, on the same app the problem persisted: not viable. The last app could be debugged and its elf could be used by the other not debuggable apps: just an experiment. For sure the upgrading of some tools has been

a good thing, but doesn't solve the issue.

Then, with some fears about loosing my NUCLEO F446RE, as personal mobility is at present reduced,

I applied STM32CubeIDE ST-LINK GDB server UM2576 3 Troubleshooting pag 8:

 If STM32CubeProgrammer can connect to the target, try to:

1. Erase the Flash with STM32CubeProgrammer.

That's it. Now I can re-program my old apps and their elf debug fine with GDB server.

BChaâ.1
Associate

hello did you found a solution ?

Gbasi.1
Associate II

i dont know about him, but i am having the same problem and i can not find a solution yet