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

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

  • September 4, 2026
  • 6 replies
  • 105 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

 

Best answer by Julian E.

Hi ​@SBaro.11,

 

There is no reason that would make you unable to use the board.

  • Make sure to connect the board via the ST link, not the other USB.
  • You need to put both boot pins to the right (near the edge of the board)
    (if you do it plugged, you need to do a power reset)
  • Use a USB C to USB C cable with data, this could be a voltage issue.
  • Make sure to update CubeMX. There was an issue with the N6firmware package 1.4.0
    Normally this should not have an impact, but you may use another version.

 

In your logs is written “2.77V” which seems very low, we should have 3.3V. The voltage seems to be an issue.

Is your led on the right side of the board green or orange (the bottom one). This should be green.

 

Have a good day,

Julian

6 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.

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

Hi,
I just tried reducing the frequency to 50kHz; I managed to erase the first sector, but if I try to erase multiple sectors, I run into the same problem. Even if I drop it to the lowest setting—5 kHz—I still have the same issue. As it stands, I can't use my board.

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

It’s seem I’ve bought a dev board 237e and I can’t use it 😅

Julian E.
Julian E.Best answer
ST Technical Moderator
September 14, 2026

Hi ​@SBaro.11,

 

There is no reason that would make you unable to use the board.

  • Make sure to connect the board via the ST link, not the other USB.
  • You need to put both boot pins to the right (near the edge of the board)
    (if you do it plugged, you need to do a power reset)
  • Use a USB C to USB C cable with data, this could be a voltage issue.
  • Make sure to update CubeMX. There was an issue with the N6firmware package 1.4.0
    Normally this should not have an impact, but you may use another version.

 

In your logs is written “2.77V” which seems very low, we should have 3.3V. The voltage seems to be an issue.

Is your led on the right side of the board green or orange (the bottom one). This should be green.

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.