cancel
Showing results for 
Search instead for 
Did you mean: 

Debug error only at second session, but without even first run the program

MAesc.1
Associate II

Hello

I have a strange bug when I try to debug. The first time I can start (only start, not run!) the debugger. The second time I receive an error message when I start the debugger (only start, not run!) :

"Failed to execute MI Command. Error Message from debugger back end: Error finishing flash operation"

I have a very simple program with only three lines of code added:

HAL_FLASH_Unlock();

FLASH_Erase_Sector(11, FLASH_VOLTAGE_RANGE_3);

HAL_FLASH_Lock();

With the fallowing Code I can start the debugger multiple times without error messages:

HAL_FLASH_Unlock();

//FLASH_Erase_Sector(11, FLASH_VOLTAGE_RANGE_3);

HAL_FLASH_Lock();

The strange thing is, in don't run the program, so the Erase-Command won't erase anything.

Remark: When I debug when the error message appears, the code did not even reach the startup-code.

After the error message I have to erase the flash with the STM32 ST-LINK Utility.

I have an STM32F207ZG Nucleo, I use STM32CubeIDE V.1.10 with St-Link GDB-Server and SWD

Does anyone have an idea what steps I could do to get to the source of this error?

0 REPLIES 0