STM32CubeProgrammer failed to erase memory after one successful download
- January 30, 2019
- 1 reply
- 2450 views
Hi there,
First time to this community, glad to see you!
I have an weird programming issue when using STM32CubeProgrammer.
I use NUCLEO-F302R8, and try to download a blink.elf to the MCU.
I can have successful download, and the LED is blinking. However, if I then try another download, it failed by saying "failed to erase memory", below is the log:
09:57:07 : Memory Programming ...
09:57:07 : Opening and parsing file: STM32F302R8-Nucleo.elf
09:57:07 : File : STM32F302R8-Nucleo.elf
09:57:07 : Size : 3420 Bytes
09:57:07 : Address : 0x08000000
09:57:07 : Erasing memory corresponding to segment 0:
09:57:07 : Erasing internal memory sectors [0 1]
09:57:07 : Download in Progress:
09:57:07 : File download complete
09:57:07 : Time elapsed during download operation: 00:00:00.247
09:57:07 : Verifying ...
09:57:07 : Read progress:
09:57:07 : Download verified successfully
09:57:16 : Memory Programming ...
09:57:16 : Opening and parsing file: STM32F302R8-Nucleo.elf
09:57:16 : File : STM32F302R8-Nucleo.elf
09:57:16 : Size : 3420 Bytes
09:57:16 : Address : 0x08000000
09:57:16 : Erasing memory corresponding to segment 0:
09:57:16 : Erasing internal memory sectors [0 1]
09:57:16 : Error: failed to erase memory
09:57:16 : Error: failed to erase memoryYou can see I started download by 09:57:07, which turns out to be successful.
But when by 09:57:16, I try download again, it failed.
The problem only occurs after one successful download. So if I persist on clicking start programming, it will be: success->fail->success->fail...
I found that there's no problem when I use "hardware reset" instead of "software reset" for "reset mode". But I don't experience this problem by using ST link utility even with "software reset".
I have tried on two win10 PC, STM32CubeProgrammer V1.4.0.
port SWD
frequency 4MHz
mode Normal
reset mode Software reset
firmware version V2J33M25
This seems to be a quite often problem, can you help me?
Thank you!
;) :> :grinning_face_with_sweat:
Edit:
I think I can narrow the problem:
First, it seems related to the specific program I used for download. If I use the blink.elf(uploaded FYI), which is very small, it will always reproduce the problem. I have tried on both 302R8 and a 302CB custom board. However, if I use our custom board's production firmware(on 302CB), there will be no problem at all.
Second, I can also reproduce the similar problem by:
1.successful download blink.elf to 302R8
2. try to erase flash sectors 0,1(which blink.elf occupy) or mass erase
It always says:
Error: Sector erase operation has failed at least for one of the existing specified sectors.Please verify flash memory protection.But of course I don't use flash memory protection!
