cancel
Showing results for 
Search instead for 
Did you mean: 

AI Studio: Error during programming: failed to download Sector[0]

Magnus3327
Visitor

Hi everyone,

I'm encountering a blocking issue while trying to start an inference on a NUCLEO-N657X0-Q using STM32Cube AI  Studio and STM32CubeProgrammer.

The connection to the board via SWD seems successful, but the process fails during the memory programming phase.

 

 

      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.22.0                  
 
      -------------------------------------------------------------------
 
 
ST-LINK SN  : 002F00223234510333353533
ST-LINK FW  : V3J17M10
 
Board       : NUCLEO-N657X0-Q
 
Voltage     : 3.28V
 
SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
 
Device ID   : 0x486
 
Revision ID : Rev Z
 
Device name : ST32N657
Device type : MCU
Device CPU  : Cortex-M55
BL Version  : --
 
 
 
 
Opening and parsing file: run-9_Appli.elf
 
 
 
Memory Programming ...
  File          : run-9_Appli.elf
 
  Size          : 3.17 MB 
  Address       : 0x00000000
 
 
 
Erasing memory corresponding to segment 0:
 
Download in Progress:
 
Error: flash loader cannot be loaded.
 
 
 
Reconnecting...
 
ST-LINK SN  : 002F00223234510333353533
ST-LINK FW  : V3J17M10
 
Board       : NUCLEO-N657X0-Q
 
Voltage     : 3.28V
 
SWD freq    : 8000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x486
 
Revision ID : Rev Z
 
 
 
Error: failed to download  Sector[0]
Error: failed to download the File
 
 0%
Run failed: Error: STM32CubeProgrammer exited with code 1

 

2 REPLIES 2
drakeshawn
Associate II

This is a very common STM32N6 issue it seems. The main problem is that the STM32N657 has no internal flash. So STM32CubeProgrammer needs the proper external loader (.stldr) for the external XSPI flash on the NUCLEO board. Usually when you get the message “Your error flash loader can’t be loaded” it means the loader is missing, wrong or the board boot mode is wrong.

Give these fixes a shot:

  • Set boot jumpers to Dev_Boot mode
    BOOT0=1;
    BOOT1 = 0.
    Reduce the SWD speed from 8000 KHz down to 1000-2000 KHz
    STM32CubeProgrammer, select the external loader manually:
    MX25UM51245G_STM32N6570-NUCLEO.stldr
    Make sure you are using STM32CubeProgrammer v2.18+ (2.22 is ok)
    Connect only via ST-LINK USB port
    Do not try to erase/program internal flash addresses like 0x08000000 as there is no internal flash in STM32N6.

 

Many users just solved the exact same problem by changing the boot jumper configuration and choosing the correct external loader.

Hi, thank you very much for the detailed response!

Since this is my first time using an STM32 board (and the N6 specifically), your suggestions were invaluable in helping me understand the issues related to the lack of internal flash memory.

Regarding this, I have two technical questions to ensure I proceed correctly:

  1. Frequency Configuration in AI Studio: Is there a way to set the SWD speed to 1000-2000 KHz directly within STM32CubeAI Studio? Or is it better to bypass the tool's automatic validation and use STM32CubeProgrammer exclusively to manually manage the connection and the loader?

  2. Flashing Procedure: If I understand correctly, once the board is unlocked and the External Loader is set, should I proceed with manually flashing the .bin or .elf file generated by AI Studio? In my case, the log indicates the Octo-SPI address is 0x71000000.

Thanks again for the support!