cancel
Showing results for 
Search instead for 
Did you mean: 

External Flash Loader gets "failed to download Segment[0]" error on STM32CubeIDE

ARost.9
Associate III

Hello, I have made a custom external flash loader(.stldr) file for my STM32 based board and this file works great with ST Link Utility(Read, Write and Erase) are work fine and i can Program the board correctly. But when i try to use the created .stldr file by STM32CubeIDE the erasing process well done but when the downloading process gets start then "failed to download Segment[0]" error pups up.

Could any one help me with the problem?

MCU = STM32H743iit6

QSPI Flash = W25Q256

 
STMicroelectronics ST-LINK GDB server. Version 6.0.0
Copyright (c) 2021, STMicroelectronics. All rights reserved.
 
Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled
        InitWhile                  : Enabled
 
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.9.0-RC01                  
      -------------------------------------------------------------------
 
ST-LINK SN  : 48FF6D068366565223471581
ST-LINK FW  : V2J39S7
Board       : --
Voltage     : 3.24V
SWD freq    : 4000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x450
Revision ID : Rev V
Device name : STM32H7xx
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M7
BL Version  : 0x90
 
 
 
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a23188.srec
  File          : ST-LINK_GDB_server_a23188.srec
  Size          : 389352 Bytes
  Address       : 0x08000000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sector 0
Erasing memory corresponding to segment 1:
Erasing external memory sectors [0 3]
Download in Progress:
 
 
Error: failed to download Segment[0]
Error: failed to download the File
Shutting down...
Exit.

1 ACCEPTED SOLUTION

Accepted Solutions

OK, I eventually found the solution. Alternative to downgrading stm32CubeIDE from 1.8 to 1.7 version, you can only copy and replace the below directory contents of the STM32CubeIDE 1.7:

C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.0.202105311346\tools\bin

to the directory :

C:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.100.202110141430\tools\bin

of the STM32CubeIDE 1.8 and every things will work well.

View solution in original post

12 REPLIES 12

The interactions here are going to be complex. The external loader can change the system state,and that might be a problem for the programmer.

You'll need to increase the verbose reporting level, and see if you can glean any information that way.

Perhaps instrument the code, and output via a UART or something, and understand how the system is functioning. The QSPI could be mid-erase.

Be conscious about what you're doing with the clocks, and how the QSPI is mapping. I'd generally recommend keeping things simple.

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

I faced this problem, I think some think wrong with STM32CubeIDE 1.8 ... Downgrade to 1.7 and it will work.

ARost.9
Associate III

@MHaji.1​ 

Absolutely you are right. The Problem was for the version of STM32CubeIDE 1.8

I downgraded to the STM32CubeIDE1.7 and the problem is solved.

ARost.9
Associate III

I found the problem. According to these pictures(First for STM32CubeIDE 1.8 and Second for STM32CubeIDE 1.7)

0693W00000HocHrQAJ.jpg 0693W00000HocI6QAJ.png 

The STM32CubeIDE 1.8 uses the STM32CubeProgrammer 2.9 and this makes the problems but the STM32CubeIDE 1.7 uses STM32CubeProgrammer 2.8 and makes every things work fine.

If there are other redeeming features of IDE 1.8, you might be able to substitute the v2.8.0 STM32 Cube Programmer in the binaries area

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

Yes I tried, but again the 1.8 one does not work. I think the GDB version is also effective on the existing problem

OK, I eventually found the solution. Alternative to downgrading stm32CubeIDE 1.8 to 1.7 version, you can only copy and replace the below directory contents of STM32CubeIDE 1.7:

C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.0.202105311346\tools\bin

to the directory :

C:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.100.202110141430\tools\bin

of STM32CubeIDE 1.8 and every things will work well.

OK, I eventually found the solution. Alternative to downgrading stm32CubeIDE from 1.8 to 1.7 version, you can only copy and replace the below directory contents of the STM32CubeIDE 1.7:

C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.0.202105311346\tools\bin

to the directory :

C:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.100.202110141430\tools\bin

of the STM32CubeIDE 1.8 and every things will work well.

Roberto C
Associate III

Hello!,

I'm having the same problem.

I'm using

STM32H743XI + MX25L51245G

STM32H743XI + MTQL2512

I made 2 custom external loaders for my board (one for each memory type), following the instructions descripted in a ST online course.

I tried STM32CubeProgrammer v2.9 and v2.11 but in both cases i'm having the error: "failed to download Segment[0]".

Only with version 2.7 it run ok.

Just to test, I have also tried to modify the Loader_Src.c/write(..) function to return always LOADER_OK, but the Programmer returning always the same error.

The erasing phase is ok.

Anyone can explain this problem and how to fix it for programmers version >2.7 ?

Best Regards.

Roberto.