cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer won't erase target device flash.

SDiMo.1
Associate

Hi all. I am using STM32CubeProgrammer with an STM32G474VET6 target system on a Windows 10 box with a USB-connected STLink module. The programmer is v2.10.0, and the STL firmware is v2J3757.

My problem is that the Cube programmer doesn't seem to be able to perform a mass erase on the target prior to programming. When I try to program, I get the following message:

Error: failed to erase memory

The Full chip erase button fails as well with

Error: Mass erase operation failed.Please verify flash protection

Flash write protection is not enabled on the target. I can erase and program just fine with the STM32 ST-LINK Utility. Also, Cube programs successfully if the target device flash is blank.

I'm happy to provide any of the target settings on request.

Any ideas?

Thanks,

Mike

2 REPLIES 2
SDiMo.1
Associate

More info - I set the output verbosity level to 3 (highest) and harvested the following:

11:43:44:651 : MASS ERASE ...

 11:43:44:652 : Flash erase...

 11:43:44:655 : halt ap 0

 11:43:44:655 : w ap 0 reg 15 PC  (0x20000000) 

 11:43:44:657 : w ap 0 reg 17 MSP (0x20000500) 

 11:43:44:657 : w ap 0 reg 16 xPSR (0x01000000) 

 11:43:44:667 : w ap 0 @0x20000C80 0x00000200 bytes Data 0x00000000

 11:43:44:668 : w ap 0 @0x20000000 0x00000004 bytes Data 0x0000BE00

 11:43:44:681 : w ap 0 @0x20000004 0x00000848 bytes Data 0xB672B580

 11:43:44:681 : Init flashloader...

 11:43:44:681 : halt ap 0

 11:43:44:681 : w ap 0 reg 0 R0  0x00000001

 11:43:44:681 : w ap 0 reg 1 R1  0x00000000

 11:43:44:681 : w ap 0 reg 2 R2  0x00000000

 11:43:44:682 : w ap 0 reg 3 R3  0x00000000

 11:43:44:682 : w ap 0 reg 4 R4  0x00000000

 11:43:44:682 : w ap 0 reg 5 R5  0x00000000

 11:43:44:683 : w ap 0 reg 6 R6  0x00000000

 11:43:44:683 : w ap 0 reg 7 R7  0x00000000

 11:43:44:683 : w ap 0 reg 8 R8  0x00000000

 11:43:44:683 : w ap 0 reg 9 R9  0x00000000

 11:43:44:686 : w ap 0 reg 10 R10 0x00000000

 11:43:44:688 : w ap 0 reg 11 R11 0x00000000

 11:43:44:688 : w ap 0 reg 12 R12 0x00000000

 11:43:44:689 : w ap 0 reg 13 SP  0x00000000

 11:43:44:690 : w ap 0 reg 14 LR  0x20000001

 11:43:44:690 : w ap 0 reg 15 PC  0x20000005

 11:43:44:690 : w ap 0 reg 16 xPSR 0x01000000

 11:43:44:691 : w ap 0 reg 17 MSP 0x20000C48

 11:43:44:691 : w ap 0 reg 18 PSP 0x00000000

 11:43:44:691 : run ap 0

 11:43:45:648 : halt ap 0

 11:43:45:648 : r ap 0 reg 0 R0  0x00000001

 11:43:45:648 : Loader mass erase...

 11:43:45:648 : Error: Mass erase operation failed.Please verify flash protection

Imen.D
ST Employee

Hello @SDiMo.1​ ,

Did you try to connect under reset?

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen