Skip to main content
SBaro.11
Associate III
September 4, 2026
Question

Failed to erase memory with stm32cube AI studio on stm32n6-dk board

  • September 4, 2026
  • 3 replies
  • 32 views

Hi all,
I’m trying to follow this guide here but when I try to run the model on target I always got an error 

failed to erase memory.Here is the log. I’ve also set external loader from cubeprogrammer to MX66, and if I try to erase memory from cube programmer I also have an error, loose comunication with the board
Saving workspace.

[36m[01m -------------------------------------------------------------------
[39;49m[0m[36m[01m STM32CubeProgrammer v2.23.0
[39;49m[0m[36m[01m -------------------------------------------------------------------

[39;49m[0m
[39;49m[0m
[90mST-LINK SN : 004700233234510E37333934
[39;49m[0m[90mST-LINK FW : V3J17M11
[39;49m[0m
[90mBoard : STM32N6570-DK
[39;49m[0m
[90mVoltage : 2.75V
[39;49m[0m
[90mSWD freq : 8000 KHz
[39;49m[0m[90mConnect mode: Under Reset
[39;49m[0m[90mReset mode : Hardware reset
[39;49m[0m
[90mDevice ID : 0x486
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m[90mRevision ID : Rev B
[39;49m[0m
[39;49m[0m
[39;49mDevice name : ST32N657
[39;49m[0m[39;49mDevice type : MCU
[39;49m[0m[39;49mDevice CPU : Cortex-M55
[39;49m[0m[39;49mBL Version : --
[39;49m[0m[39;49m
[39;49m[0m
[39;49m

[39;49m[0m[39;49mOpening and parsing file: STM32N6570-DK_Appli.elf
[39;49m[0m
[39;49m

[39;49m[0m[39;49mMemory Programming ...
[39;49m[0m[39;49m File : STM32N6570-DK_Appli.elf
[39;49m[0m
[39;49m Size : 3.17 MB
[39;49m[0m[39;49m Address : 0x34000000

[39;49m[0m[39;49m

[39;49m[0m[39;49m[0m[39;49mErasing memory corresponding to segment 0:
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m[39;49m[0m[39;49m[0m[39;49mErasing memory corresponding to segment 1:
[39;49m[0m
[39;49m[0m
[39;49m[0m[39;49m[0m
[39;49m[0m[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49mErasing external memory sectors [16 66]
[39;49m[0m[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[39;49m[0m
[00;31mError: failed to erase memory
[39;49m[0m[39;49m

[39;49m[0mError: failed to erase memory
[39;49m[0m
Run failed: Error: STM32CubeProgrammer exited with code 1

 

3 replies

Explorer
September 4, 2026

It looks like the issue may be related to the external flash or loader configuration, especially since CubeProgrammer also loses communication during the erase. Have you tried lowering the SWD frequency and testing the MX66 external loader separately?

SBaro.11
SBaro.11Author
Associate III
September 4, 2026

Yes I’ve set the external loader as you can see here :

I did a test with 3300KHz frequency setting I have the same issue with cubeprogrammer trying to Full chip erase here is Log output (0x7000000)


 

Visitor II
September 4, 2026

It looks like the board is detected correctly, but the issue is with the external flash communication. Since the MX66 loader is already configured, I’d double-check the external loader version and try lowering the SWD frequency. The fact that CubeProgrammer also fails to erase the memory points more toward a loader/connection issue than AI Studio itself.