STM32F407 — Flash erase fails after STM32CubeIDE programming error
Hi everyone,
I’m facing a serious issue with my STM32F407 MCU on a custom PCB.
I was flashing firmware from STM32CubeIDE using the onboard ST-Link from a Discovery board over SWD, and everything was working fine until one upload failed during the erase step.
Since that moment, I can’t erase or reprogram the chip anymore, even from STM32CubeProgrammer or ST-Link Utility.
le programming via STM32CubeIDE, I suddenly got this error in the ST-LINK GDB server console:
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 2]
Error: failed to erase memory
Encountered Error when opening ...\STM32_Programmer_CLI.exe
Error in STM32CubeProgrammer
Shutting down...
Exit.
After this, every subsequent attempt (from CubeIDE, CubeProgrammer, or ST-Link Utility) failed the same way.
I have tried :
Connect under Reset mode, SWD frequencies (from 4 MHz → 950 kHz → 100 kHz), RDP = Level 0 (0xAA), no write protection in Option Bytes, Tried Full Chip Erase several times -> worked few times but can no longer erase
Sometimes says “Flash erased” but still cannot program
My first concern is the MCU still OK and not permanently corrupted
What could be the cause of this problem, all I did was just connecting the SWD wires like before
