cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F722ZE Error: Mass erase operation failed. Please verify flash protection. STM32F722ZE

yellowtomato
Associate II

I debuged my software on the STM32F722ZE, when I suddenly lost connection to it. I tried to connect to it with ST-Link V2 and Segger J-Link.

Error message from J-Link commander is: Can not attach to CPU. Trying connect under reset. Connecting to CPU via connect under reset failed.

Error message from ST-Link V2: Error finishing flash operation. Failed to erase memoy.

See picture: 0693W00000APoBiQAL.pngI then took a look at the config with CubeProgrammer:

0693W00000APo8yQAD.pngHow is it possible to have 0xFF as RDP Byte?

0693W00000APoCHQA1.pngWrite protection is not active are all checked.

When I try to perform a mass erase I get Error: Mass erase operation failed.

How can I recover from this? Is it possible that I locked myself our by acciedent? I would say it is rather unlikely to do this while debugging. What else could have happend?

Thank you in advance for every answer.

0693W00000APo8oQAD.png

23 REPLIES 23

@molecule.192g​, please edit out from your post that long e-mail spam (history of replies)!

Zaher
Senior II

I just encountered the same error when I was trying to do "Erase Chip" from within CubeProgrammer. I have the latest version downloaded yesterday. This was on the STM32H747-DISCO board with STLink-V3.

Error message: "Mass erase operation failed. Please verify flash protection" but no protection has been applied to any sector of the flash whatsoever. I did full chip erase/programming dozens of times yesterday, but suddenly today it didn't work out. After spending some time trying to figure out what happened, I found that the problem lies in the FW of the STLINK. One of the demo projects opened in the IDE asked me to upgrade its firmware, which I did. After that, the problem appeared.

Here's what I did to solve it:

1- Open ST-Link Utility

2- From ST-LINK drop down menu go to > Firmware update

3- Click on Device Connect

4- Make sure MCO output is set to "Default (HSI/2 8MHz)

5- Click "yes>>>>" to upgrade FW and restart the tool

That's it. Now, I can do full chip erase in both of ST-Link Utility and CubeProgrammer.

Zaher

GF Ho.1
Associate

Hold Reset button while Connecting to the device in cubeprogramer. then full erase the internal flash. if using external flash use a programe that implement full chip erase.

EveRed
Associate

One of my STM32F730Z8T6 got corrupted for a mysterious reason and I get the "Mass erase operation failed. Please verify flash protection" when I try to erase it with:

STM32_Programmer_CLI -c port=SWD freq=4000 --erase all

This used to work on the same device. I toggled the RDP protection level option byte to 0xBB and back to 0xAA, to get my memory back in read/write mode, but the issue persists.

Oddly enough, clearing the memory by blocks still works perfectly ("Existing specified sectors are erased successfully. Protected sectors are not erased")

STM32_Programmer_CLI -c port=SWD freq=4000 --erase 0 1 2 3