Skip to main content
Jorge Jacome
Associate
June 29, 2020
Question

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

  • June 29, 2020
  • 19 replies
  • 13832 views

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.

Jorge

This topic has been closed for replies.

19 replies

matte
Associate
June 30, 2020

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
July 3, 2020

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
July 5, 2020

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 :beaming_face_with_smiling_eyes:

Thanks a lot for your time ,efforts and comments.

Jorge

Jorge Jacome
Associate
July 5, 2020

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

PEnright
Associate II
August 3, 2020

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

0693W000003ByFFQA0.jpg

JMors.1
Associate III
August 3, 2020

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

ST-LINK FW : V3J7M2

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
Load

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

Cartu38 OpenDev
Graduate II
August 4, 2020

@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: https://community.st.com/s/question/0D53W00000DiIIjSAN/stm32cubeide-cubemx-deletes-project

JMors.1
Associate III
August 4, 2020

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.

JMors.1
Associate III
August 4, 2020

Perhaps this needs its own thread, but it is interesting they would include a Release Candidate (RC) with the IDE let alone an RC1. That means it is not released. Since I did an upgrade from 1.3.0 to 1.4.1, there are both the 2.4.0 and 2.5.0-RC1 plugins installed. Maybe I'll open another topic for this.

Cartu38 OpenDev
Graduate II
August 4, 2020

Both installed is regular way of working if Eclipse from what I know. Obviously Eclipse always consider the one related to main application bundle not both.

I.e. if 1.4.1 installed only 2.5.0 will be used.

Keeping both is Eclipse way of working allowing you to revert 1.4.1 update back to 1.3.x.

Having RC is not hurting me as far as such RC is final release candidate.

PEnright
Associate II
August 4, 2020

I am sorry, but I am a little lost in this thread, am I doing something wrong or is there an issue with 1.4.1?

I am running the upload through the IDE by right clicking on the project and picking "debug as".

I did see the talk about CubeProg. I found a program "C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32CubeProgrammer.exe" The file properties "Product Version" is 2.4.0. If I double click on it a splash screen flashes and goes away. Should i be able to run it that way or does it have to launch via the IDE? Any suggestions on how to troubleshoot (divide and conquer)?

Again the "C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\STM32 ST-LINK Utility.exe" works. Product version is 4.5.0.0.

As I was typing this I notice one is 64bit and the other is 32. I am running 64bit windows 7. Is this my issue?

JMors.1
Associate III
August 4, 2020

Yeah, sorry, it got off on a different direction.

Are you seeing the "Failed to execute MI command" errors?

If so, check the "External Loader" setting in your Debug Configuration under Debugger.

If it is not set, set it to the appropriate Loader for your board.

PEnright
Associate II
August 4, 2020

No biggie, I tend to do that also. Still got an error, but this time I had the log checked also.

Screen shot of my config page ...

Copy and paste of the details. This makes me think I am misunderstanding the issue. As I said, if I zero out the memory with STLink utility, then program with the IDE, even with the error if I press restart the test blink works or at least the led blinks. :)

 
STMicroelectronics ST-LINK GDB server. Version 5.6.0
Copyright (c) 2020, STMicroelectronics. All rights reserved.
 
Starting server with the following options:
 Persistent Mode : Disabled
 LogFile Name : C:\Users\paulenright\STM32CubeIDE\workspace_1.3.0\testblink\Debug\st-link_gdbserver_log.txt
 Logging Level : 31
 Listen Port Number : 61234
 Status Refresh Delay : 15s
 Verbose Mode : Enabled
 SWD Debug : Enabled
 
Target connection mode: Attach
Hardware watchpoint supported by the target 
COM frequency = 4000 kHz
ST-LINK Firmware version : V2J37S7
Device ID: 0x410
PC: 0x900001
ST-LINK device status: RUN_MODE
ST-LINK detects target voltage = 3.25 V
ST-LINK device status: RUN_MODE
ST-LINK device initialization OK
Waiting for debugger connection...
Waiting for connection on port 61234...
Accepted connection on port 61234...
Debugger connected
Try halt...
ST-LINK device status: HALT_MODE
 ------ Switching to STM32CubeProgrammer ----- 
 -------------------------------------------------------------------
 STM32CubeProgrammer v2.5.0-RC1 
 -------------------------------------------------------------------
 
 
 
Log output file: C:\Users\PAULEN~1\AppData\Local\Temp\STM32CubeProgrammer_a14680.log
ST-LINK SN : 54FF70066782544811281767
ST-LINK FW : V2J37S7
Board : --
Voltage : 3.54V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x410
Revision ID : Rev X
Device name : STM32F101/F102/F103 Medium-density
Flash size : 128 KBytes
Device type : MCU
Device CPU : Cortex-M3
 
 
 
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a14680.srec
 File : ST-LINK_GDB_server_a14680.srec
 Size : 5624 Bytes
 Address : 0x08000000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 5]
Download in Progress:
�������������������������������������������������� 0%
�������������������������������������������������� 100%
 
File download complete
Time elapsed during download operation: 00:00:00.442
 
 
 
Verifying ...
 
 
Read progress:
�������������������������������������������������� 50%
 
 
Error: Failed to read memory at address 0x08000000 during verification
 
 
Error: Download verification failed
 
 
Encountered Error when opening C:\ST\STM32CubeIDE_1.3.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.4.0.202007081208\tools\bin\STM32_Programmer_CLI.exe
 ------ Switching context ----- 
Error in STM32CubeProgrammer
Debugger connection lost.
Shutting down...
 

I was going to post the log but it made the post too long, so I am trying to attach it.

Cartu38 OpenDev
Graduate II
August 4, 2020

Have a try based on OpenOCD usage too ... CubeProgrammer usage is skipped here.

0693W000003C5vXQAS.jpg