Skip to main content
TKebi.1
Associate
May 15, 2021
Solved

Debugger connection lost. Shutting down... monitor flash mass_erase didnt help

Hello,

Im just starting with the nucleo board STM32L476RG using mac (10.13.6) and cube IDE 1.6.1. I also updated the firmware on the ST-link to the newest one when prompted.

For the very first program I just wanted to make it blink to see if it works, so I created a project according to the tutorials, added:

HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);

  HAL_Delay(1000);

to the while (1) loop (user code begin 3) in the main and set LD2 pin as output in the pinout view.

Building is without a problem:

12:11:40 **** Incremental Build of configuration Debug for project first_blinking_LED ****

make -j3 all 

arm-none-eabi-size  first_blinking_LED.elf 

  text  data   bss   dec   hex filename

 12036   20  1700  13756  35bc first_blinking_LED.elf

Finished building: default.size.stdout

12:11:41 Build Finished. 0 errors, 0 warnings. (took 221ms)

But when I hit Run main I get (onboard LD1 blinking red and green):

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...

I tried adding "monitor flash mass_erase" to the initialization commands, but it didnt help. Also what is really strange, every time I try to Run or Debug, I have aprox. 1,28 GB less free space on my HDD! And I cant find from where this space was taken as neither the repository, neither the workspace_1.6.1 folder, neither the app increased in size.

Anny suggestions on how to get it unstucked? Would be much appreciated. Thanks

This topic has been closed for replies.
TKebi.1
TKebi.1Best answer
Associate
May 28, 2021

@mattias norlander​ 

  • no just, the monitor flash mass_erase? and log to file
  • I actually already tried reinstalling the whole IDE :)
  • uff, Im just a beginner, this sounds a bit too complex
  • good idea, but I dont have at the moment

@LaurentL​  I have "connect under reset" selected by default.

interestingly, I tried selecting the "Shared ST-LINK" in the Debugger configuration (just to see what it does) and suddenly it worked. Now its working even without the shared st-linked checked and without the monitor flash mass_erase. I dont know what exactly does the option do (in the manual I see the communication should go via server?) and whether it solved the problem correctly, but I can upload the program and the LED is blinking as expected.

12 replies

TKebi.1
TKebi.1Author
Associate
May 31, 2021

Sure, @mattias norlander​ , @LaurentL​ thanks a lot for advices