cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to execute MI command

Robert Ritchey
Associate III

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.

18 REPLIES 18
Not sure but I have been playing and it’s now working for me. I did two things (1) I slowed down the ST-Link speed and (2) I disconnect the board (USB cable) and shut down the IDE and then restarted again. I am not sure now why it’s working. When I did (1) it didn’t work but after (2) it’s working so maybe I had to exit before the changes to ST-Link took effect or maybe it was just the restart that worked better this time?
Your luck may vary.
Lawrence

I solved my problem. Firstly, I deleted Keil IDE and then upload it again. Secondly, I downloaded necessary packs and driver. Thus , I solved problem :)

Graham1904
Associate III

I am getting exactly the same problem. A program using the Nucleo-64 with STM32L073RZ gives no problems, another program, even a blank new project, with Nucleo-64 with STM32L476RG gives

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

VKais.1
Associate II

I am using STM32CubeIDE 1.4.2, a Nucleo STM32F072RB, and the ST-LINK GDB server debugger.

I had a project that worked fine. I created a new project to test a weird issue I was having with the other project, and had no problems (no error, no weirdness). When I went back to the original project - I started getting this error about the .elf file. I tried everything - I spent more than half a day on the #$%^ing thing.

What ended up working for me (your results may vary) was copying the STM32F072RBTX_FLASH.ld file from the working project to the broken project. My original project never had it (I checked my git history), but for some reason when I copied it from the working project to the broken project - problem fixed.

I'm not sure whether that's THE fix, or one element in everything else. The original project had a .cfg file the new project never had, and I definitely cleared out files created by debugging to reset them. None of those on their own fixed it.

I think some setting was changed when I created the new project and it affected the original.

Good luck!

SPoly.1
Associate

Erasing the whole flash using Stm32Cubeporgrammer has helped me to solve this problem

MRahi.3
Associate II

Hello, I hope someone had an answer to this problem since it was posted a year ago. I am currently trying to program an STEVAL-ESC001v1 board with an STLINK V2 ISOL probe. The IDE I use is the STM32CubeIDE. Before that, I used a regular STLINK V2 probe and the debugging of my program worked perfectly. Ever since I switched to the STLINK V2 ISOL (for isolation from power), I have been getting these errors on the console :

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

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Target is not responding, retrying...

Debugger connection lost.

Shutting down...

0693W00000BaQ4tQAF.png 

I tried using the STM32CubeProgrammer software, but It seems like the ISOL probe doesn't recognize the target :

0693W00000BaQCJQA3.png0693W00000BaQCTQA3.png 

Can anyone help me out with this issue ? Thank you very much

Thanks! Your first hint had solved the problem on my HW-setup (ST-Link V3 on STM32U5 board). After setting the ST-Link speed at min. (constant value, not auto), the problem did not occur, so far.

I too am getting the same problem.

The things I have noticed are:

1. A lot of us are getting this problem.

2. Those lucky enough to solve it did it entirely with no help from STM.

3. The solutions they found seem weird, random and all over the place with no consistent pattern.

For me, I had a perfectly healthy project with lots of files.  My Windows10 PC died and I replaced it with Windows 11.

When I ran STM CubeIDE, I was forced into upgrading the project.

Details of error message "Failed to execute MI command" are next to useless:

Error in final launch sequence:

 

Failed to execute MI command:

load ...\\SDV1B\\Debug\\SDV1B.elf

 

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load ...\\SDV1B\\Debug\\SDV1B.elf

 

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load ...\\SDV1B\\Debug\\SDV1B.elf

 

Error message from debugger back end:

Error finishing flash operation

Error finishing flash operation

@BillE After upgrade of Windows, please check the USB connection to the board (the drivers... you know). Use the CubeProgrammer, as other people did above, or other program that works with ST-LINK. Validate that it can connect to the board and load a program.