cancel
Showing results for 
Search instead for 
Did you mean: 

I have been trying to download a program to a Nucleo-STM32L476 and I always get the message debugger connected debugger connection lost

EScha.1
Associate II

In the CubeIDE I have a simple program just to get familiar with the IDE. I have connected the STM32L476 and as the run / debug process starts I see the message below. When the console indicates debugger connected The LED on the ST-Ling part goes green and blinks then turns red and finally the message on the console indicated that the connection is lost. I found a similar question and followed all the suggestions but no success. I appreciate any help.

STMicroelectronics ST-LINK GDB server. Version 5.8.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

Debugger connection lost.

Shutting down...

7 REPLIES 7
ONadr.1
Senior III

Is it allowed debugger port on MCU?

CubeMX, Categories->SYS->Debug

EScha.1
Associate II

Yes, I am using the USB connector on the ST-Link side of the Nucleo module. i also have the jumpers set for that connector and not the CN4 for SWD.

I reviewed all the jumper settings even reviewing the schematics to be sure I understand their usage.

It does appear that the ST-Link is trying to connect and possibly even connecting as the COM LED (LD1) actually blinks green for a second or two and then goes Red with the console message "Connection Lost".

EScha.1
Associate II

When trying to download a program to the Nucleo and getting the message connection lost, is there any way to get a log of what was going on up to the failed connection? That might be helpful to diagnose the problem.

ONadr.1
Senior III

I thought the software configuration. Debug port has its own settings. Try to open MCU configuration in CubeMx and see, if debug is setting and how is setting. You can find it in section Categories->SYS->Debug

EScha.1
Associate II

Yes, debug is set for serial wire.

I had the same problem. My solution was pressing the reset button multiple time on the board while the debug initiates.

mattias norlander
ST Employee

Hi,

About Categories->SYS->Debug. CubeIDE actually does not care about this setting. When we launch debug the IDE itself will try to configure the debug regardless of what is set in Categories->SYS->Debug. Some other IDEs/tools may need to set these options correctly. But not in CubeIDE.

So for sure something else is incorrect there. I cannot see that CubeProgrammer is called at all to carry out any flash load operation.

Is the debug configuration setup to load the binaries?

To help you please do this:

  • Take some screen dumps of the two tabs in the debug configuration:
    • Debugger
    • Startup
  • In the debug config please enable log to file. Make a clean debug launch and then paste/attach the log-file here.
  • Additionally if you have CubeProgrammer stand-alone installed you could try to use it to connect to target and flash the binary to see that there is no problems with this.
  • You could also, as a work-around, in CubeIDE debug configuration switch from Debug probe == ST-LINK GDB-server to OpenOCD

Please feed us with this info and let's see if we can make some progress..