cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to execute MI command

I am trying to debug my hardware for the first time. I was working in TrueStudio 9.3.0 as I had started this project in it before STM32CubeIDE came out. When I started to try to debug my program to day I got an error. OK, maybe I should try STM32CubeIDE instead. Loaded this up and got the project migrated with no problem. But when I go into the debugger it generates the same error and exits. I am not sure where to start to track this down. The console shows this:

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

The detailed error message gives me this:

Error in final launch sequence:

Failed to execute MI command:

target remote localhost:61234

Error message from debugger back end:

Remote communication error. Target disconnected.: Success.

Failed to execute MI command:

target remote localhost:61234

Error message from debugger back end:

Remote communication error. Target disconnected.: Success.

Remote communication error. Target disconnected.: Success.

I am using an ST-LINK\V2. I can download the program just fine using STM32CubeProg so I know the ST-LINK and the interface is working correctly. Where do I go next to figure this out? Thanks.

22 REPLIES 22
Ricarry
Associate

I solved that error by activating serial wire in pinout and configurations > sys > debug: serial wire

Had the same problem. When I connected both usb ports [one through ST-LINK\V3-SWD and one directly to other USB VCP it works!], when I disconnect USB VCP it does not work. Seems to be current/voltage related.

No CubeIDE reset helped. 

No Cubeprogrammer erase helped.

No PC restart helped.

No debugger server port reset helped.

Luckilly my board had two (2) usb ports => more current to put MCU in configuration mode!

[some other guy even connected pull up resistors, or SWD flying wires].

 

mkrk
Associate III

I got this error because I defined a sector in linker script for external memory-mapped PSRAM memory without NOINIT attributes and without placing init values into Flash. It caused elf and hex file to contain zeroes on memory mapped address and obviously debugger failed to write those.