2025-11-09 9:20 PM - edited 2025-11-09 9:28 PM
MCU : STM32U5G9ZJT6Q
External Flash : MX25LM51245G
SPI Interface : HSPI1
When I use STM32_Programmer_CLI.exe I cannot erase the external flash.
Board info:
I get following error from STM32_Programmer_CLI.exe:
STM32_Programmer_CLI.exe -c port=SWD -el "C:\Users\USER\Desktop\Workspace\External_Loader\MX25LM51245G_STM32U5G9ZJ\Project\EWARM\Debug\Exe\MX25LM51245G_STM32U5G9ZJ.stldr" -e all
-------------------------------------------------------------------
STM32CubeProgrammer v2.20.0
-------------------------------------------------------------------
ST-LINK SN : 56FF70067287555130422267
ST-LINK FW : V2J46S7
Board : --
Voltage : 3.21V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x476
Revision ID : Rev Z
Device name : STM32U5Fx/5Gx
Flash size : 4 MBytes
Device type : MCU
Device CPU : Cortex-M33
BL Version : 0x90
Debug in Low Power mode enabled
Mass erase ...
Error: Mass erase operation failed.Please verify flash protection
How can I do that please?
I looked forums and communities and I have to say the info is rather hopeless.
2025-11-13 12:13 AM - edited 2025-11-13 12:15 AM
Hello @Dong_Dong ,
Is TZEN enabled?
This may be a known issue and limitation for STM32U5 when TZEN is enabled:
STM32CubeProgrammer errata 2.20.x
2025-11-13 5:18 PM
TZEN is disabled....
I created an External Loader with reference to that document.
Did I misorganize the file?
https://github.com/STMicroelectronics/stm32-mx25um51245g
Drivers related to flash memory referenced the file.
The "discovery" driver included the file "stm32u5g9j_xx".
Changed "MX66UW1G45G_xx" to "MX25LM51245G_xx".
https://github.com/Dong-Dongs/External_Loader
I will attach my project link together