Showing results for 
Search instead for 
Did you mean: 

Fail to execute MI command -- error message from debugger back end -- error erasing flash with vFlashErase packet

Jorge Jacome
Associate II

Hi everyone

I start using CubeIde v1.3.1 with a Nucleo board recently , the first project --toogle LED

It was everything OK,was able to download ,debug and run the program into the Nucleo until

I think I did an update of the ST-Link; and since then I am having a headache of what went wrong, with the message reported on the question title.

Using St-link utility v4.5 or CubeProgrammer v2.4 I am able to connect to the Nucleo and see some values on the corresponding addresses which I believe values are corresponding to the last

time was on line with the board.

St-link firmware version V2J36M26.

In the same situation with F103C8T6 blue pill board

Any clues to overcome with this problem, would be appreciated.


Associate II

Can you use CubeProgrammer to clear the flash? Then disconnect CubeProg and instead again try to debug with CubeIDE.

Maybe create a new "empty" (not relying on CubeMX) project in CubeIDE and a corresponding new debug configuration. This would give you a project with a minimal set of resources as a starting ground to just see if flash/debug with CubeIDE now works.

Firmware issue sounds unlikely if CubeProg / ST-Link Utility can be used. The firmware you mention should work in CubeIDE. But if the firmware update procedure failed then maybe...

Is it exactly the same error message with the Bluepill? Reason for asking is that some Bluepill boards embeds fake/cloned STM32 MCUs. the ST-Link firmware and CubeIDE will block these from being used. But that should spawn another error message. CubeProg should also not allow this use case.

Jorge Jacome
Associate II

Thanks for your reply

I have been busy the last couple of days in my job.

I will make comments following your instructions and see how I am going

Jorge Jacome
Associate II

Following your tips

On your first paragraph --- without success.

On your second paragraph ---- that was the solution, and even I went further ; I did delete all the project that has been created on the workbench

New project created tested on Windows 7 , 8 and 10.

CubeIDE software is very complex and touchy , has to follow a certain sequence otherwise got something that not expected, but is very good; specially

for the price paid:D 😁

Thanks a lot for your time ,efforts and comments.


Jorge Jacome
Associate II

Last thing

The solution is only successful on the Nucleo board.

Still have the same problem with the F103C8T6 board, but that is OK, need more studies and understanding

Associate II

@Jorge Jacome​ did you get anything to work on the Blue Pill?

I am currently having something similar, if not I can start a new thread.

I am testing three different Blue Pills and a Nucleo-64. I am new and have been getting inconsistent results. I started with CubeIDE 1.3.(something) and it has now upgraded to 1.4.1. Right now I don't see any differances between the two versions concerning flashing.

First I was trying to use the Nucleo-64's STLink and it will not power up the target. I guess that question will be for another thread. I was able to flash one of the Blue Pills using the serial (Boot0) and the CubeIDE did upgrade the STLink software. So that leaves me with two target boards.

I can connect to both with Demonstrator GUI - serial (Boot0). I have wipe both memory without seeing any errors.

I can connect to one with the STLink software but not the other. While connected with the STLink software I can do all functions to the target, including loading the hex file built by the CubeIDE.

The call confidence tests, because you know what expected results are. I am new to this, so I not sure if I am doing it wrong, software configured wrong, hardware wrong, etc... I did make a jig for the blue pills to help make my tests more repeatable.


Associate III

I see a similar error with STM32CudeIDE 1.4.0 and code generated from TouchGFX 1.14.0 for a STM32H73Bi-DK board.


Error in final launch sequence:
Failed to execute MI command:
load C:\\TouchGFXProjects\\STM32H73Bi-Test1\\STM32CubeIDE\\Debug\\STM32H7B3I_DISCO.elf 
Error message from debugger back end:
Load failed
Failed to execute MI command:
load C:\\TouchGFXProjects\\STM32H73Bi-Test1\\STM32CubeIDE\\Debug\\STM32H7B3I_DISCO.elf 
Error message from debugger back end:
Load failed
Failed to execute MI command:
load C:\\TouchGFXProjects\\STM32H73Bi-Test1\\STM32CubeIDE\\Debug\\STM32H7B3I_DISCO.elf 
Error message from debugger back end:
Load failed

If I tried to do a full chip erase in the CubeProgrammer v2.4.0 , I get an error:

11:33:44 : Time elapsed during the read operation is: 00:00:00.002
11:33:48 : MASS ERASE ...
11:33:53 : Error: Mass erase operation failed.Please verify flash protection

I end up having to downgrade the FW in STM32CubeProgrammer to ST-LINK FW : V3J5M2 and then I am able to erase the FW and load an image.

However, there is an error on the download but the code does run:

12:05:00 : File download complete
12:05:00 : Time elapsed during download operation: 00:00:11.039
12:05:00 : Verifying ...
12:05:00 : Read progress:
12:05:00 : Error: Data mismatch found at address 0x24040000 (byte = 0x31 instead of 0x00)
12:05:00 : Error: Download verification failed
12:05:00 : RUNNING Program ...
12:05:00 : Address: : 0x08000000
12:05:00 : Application is running
12:05:00 : Start operation achieved successfully

@JMors.1​ Please be aware STM32CubeIDE 1.4.1 is available and more than recommended especially if playing with some TouchGFX projects having in mind to perform some project update from .ioc editor:

Yeah, actually it is CubeIDE 1.4.1.

The issue appears to be that the External Loader was not being automagically populated when the the debug config was created. After adding the appropriate values for the STM32H7B3i-DK the debug session started. Also, ensuring the Programmer and ST-Link tools are either installed in the Program folder or at least linked if not there.

One note though, There is a difference between the firmware rev with the CubeProgrammer and CubeIDE applications, so moving between the two means the firmware has to be changed. The firmware rev from CubeIDE 1.4.1 is not compatible with CubeProgrammer v2.4.0.

Yep sounds STM32CubeIDE 1.4.x is CubeProgrammer 2.5.0 based