cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve Error Finishing Flash Operation in STM32CubeIDE?

Efty
Associate

Recurring Error Message in STM32CubeIDE When Running or Debugging a Project. It shows-

'Launching pain Debug' Has encountered a problem.

Error in final launch sequence:

Failed to execute MI command: load

C:\\Users\\USER\\STM32CubelDE\\workspace_1.12.1\\pain\\ Debug\\pain.elf

Error message from debugger back end:

Error finishing flash operation.

and also it showing

"Error in final launch sequence:

Failed to execute MI command:

load C:\\Users\\USER\\STM32CubeIDE\\workspace_1.12.1\\try\\Debug\\try.elf 

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load C:\\Users\\USER\\STM32CubeIDE\\workspace_1.12.1\\try\\Debug\\try.elf 

Error message from debugger back end:

Error finishing flash operation

Failed to execute MI command:

load C:\\Users\\USER\\STM32CubeIDE\\workspace_1.12.1\\try\\Debug\\try.elf 

Error message from debugger back end:

Error finishing flash operation

Error finishing flash operation"

How to solve this problem? We are using STM32 NUCLEO-F446RE Board

18 REPLIES 18
HauDO
Associate II

I also encountered a similar issue like you, and I resolved it by connecting the NRST pin of the MCU with the NRST pin of the ST LINK V2.

BMB
Associate II

Same (similar) story (STM32IDE v1.15.1, NUCLEO-U5A5ZJ-Q e.g.: STM32U5A5ZJTQ, Cortex-M33).

Different solution:

just rebooted Windows ... :)

FranzCreva
Senior

Hi Guys,

I had this same problem and I tried all your solution but none of all worked.
There is one problem about STM32CubeIDE and STM32CubeProgrammer.. they don't tell us if the flash memory is in Read Out Protection.

Solution:
I went on the Option Bytes and I found out that my STM32 had a Read Out Protection level 1, so I changed it to 0.
It worked!

I hope this may help someone

Can you show me where is the Option Bytes? How to do find it, and how to change it to 0? Please 

Hi @Daiyujiuhao ,

You have to open the "STM32CubeProgrammer", or the "STM32 ST_Link Utility", and you have to go on the OptionByte voice (step 1), then search for the voice ReadOutProtection (step 2) and change the value to 0 (step 3).

 

I attached a screenshot with the steps.

 

I hope this will help

Thank you for your great help,I"ll give it a try. 

 

Hi buddy, I tried your method, but it didn't work...

Fortunately, the final solution has been found and I will share it with you.

My computer is running on WIN11 system, The toolbar icons of STM32CUBEIDE is too small,like screenshot...

so I privately checked the high DPI scaling option in compatibility,and selected the system (enhanced),just disable the high DPI scaling option in compatibility,it work normally. Thank you again!

 

Hello @Daiyujiuhao ,

I would never have thought (and I still don't think) that this could be the problem, but the world is so strange that it makes me accept your answer.

Best regards,
Francesco

AlexanderAustin
Associate

Hi,

Had a the same issue today and it turns out that I was trying to debug with the project text size that was too big for the micro.

Turned on optimization and it fixed the issue.

Stay Safe!