Showing results for 
Search instead for 
Did you mean: 

STM32L4A6 reading OK but writing failed "error erase memory"

Associate II

Hi everyone,
I'm getting stucked with a programming issue.
I try to load a HEX file into a STM32L4A6 chip on a BMS board.
I've checked the wiring of the st-link/v2 programmer and everything is OK.
The chip can be read from the CUBE software but when i want to write the HEX file, i'm getting an error "failed to erase memory".
The chip cannot be full erased also. The chip is not protected (level 0 "AA").
With ST Link, i can't connect the chip ("No chip found") but the led goes green.
I realy do not understand why it can be read and not write.
If anyone can give me a hint, it would be great because it's too hot for me..
Tomorow, i'll be able to give information about software versions and wiring..


Check supplies and current draw.

The write/erase use a charge pump to generate higher programming voltages used to change the charge states in the FLASH cells/array.

The current draw can be 3.4 mA during write/erase, with peak of 7 mA. Speed may be impacted by voltage, you'll need to dig into the specification.

see "6.3.10 Flash memory characteristics"

Use STM32 Cube Programmer, ST-LINK Utilities probably don't support L4+ and are deprecated/retired

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks for your answer,

I'll check the design today.

I would be surprise if it's a power issue cause i've tryed to feed the board with a decent DC supply but i'll check that.


Re-checked today,

All VAPP pins receive 3.3V,

All VSS to GND. NRST pin is pulled up.

STM32 CUBE programmer version = 2.3.0

ST-LINK/V2 version = V2J35S7.

When i try to flash, i get two errors "failed to erase memory" after two blue messages "Erasing memory corresponding to segment 0" and "Erasing memory sectors [0 42]"


Same issue