2

I am generating code using STM32CubeIDE, but when I start to debug getting error 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         : Enable


  Waiting for debugger connection...

  Debugger connected

  Debugger connection lost.

  Shutting down...`

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

Thanks in advance.

Akj
  • 7,038
  • 3
  • 28
  • 40
Mohan Khedkar
  • 33
  • 1
  • 6
  • This question has an answer at https://stackoverflow.com/questions/60827602/stm32cubeide-can-only-flash-once-no-swd-debugging – Richard Chambers Oct 10 '21 at 03:03
  • Does this answer your question? [STM32CubeIDE can only flash once, no SWD debugging](https://stackoverflow.com/questions/60827602/stm32cubeide-can-only-flash-once-no-swd-debugging) – Richard Chambers Oct 10 '21 at 03:03

2 Answers2

4

This problems tends to appear sometimes. Based on personal observation, when the device is running in debug mode and is disconnected from power source or closing the IDE while it is in debug mode this tends to happen.

In order to fix it, you can just run a different project (Run as). And then go back to the current project and it should be able to run in debug mode. This fix is based on my personal experience, hope it helps you too.

Ra'w
  • 113
  • 2
  • 10
2

Download STM32CubeProgrammer, use it to do a "Full chip erase". Try if this works.