Skip to main content
Associate III
Nov 11, 2026 2:05 PM UTC
Solved

STM32U575 External Loader (.stldr): Init() timeout

Hello. I'm developing a custom STM32CubeProgrammer External Loader for an STM32U575 board connected to an AT25SF641B SPI NOR Flash (8 MB).

The loader is recognized by STM32CubeProgrammer and loaded into RAM correctly, but I'm experiencing a mix of issues and I'm running out of ideas.

  • MCU: STM32U575
  • External Flash: AT25SF641B
  • Interface: SPI1 + GPDMA
  • STM32CubeProgrammer: v2.23.0
  • Toolchain: GCC (STM32CubeIDE)

The loader is correctly detected by CubeProgrammer.


CubeProgrammer executes:

Init flashloader...
run ap 0

and after about 100 seconds reports:

Init function fail with timeout

 

A minimal Init():

int Init(void)
{
return LOADER_OK;
}

works correctly.

The problem appears only when initialization code is enabled.

Current implementation:

int Init(void)
{
extern uint32_t __isr_vector_start__;
extern uint32_t _sbss;
extern uint32_t _ebss;

ERROR_T ErrorValue;

SystemInit();
SystemCoreClockUpdate();

SCB->VTOR = (uint32_t)&__isr_vector_start__;

__DSB();
__ISB();

ErrorValue = CUBEMX_Init();

if (ErrorValue != E_OK)
{
return LOADER_FAIL;
}

ErrorValue = Loader_FLASH_Init();

if (ErrorValue != E_OK)
{
return LOADER_FAIL;
}

return LOADER_OK;
}

The SPI driver is DMA-based.

During initialization, Loader_FLASH_Init() registers SPI callbacks. The AT25SF641B driver performs SPI transfers through HAL_SPI_TransmitReceive_DMA().

When the project is executed under STM32CubeIDE debugger, the DMA transfer completes correctly and the SPI callbacks are invoked.

When the same code is executed as a .stldr through STM32CubeProgrammer, the behavior is different.

pa0grgBest answer
Associate III
Nov 17, 2026 11:22 AM UTC

Solved not using DMA on SPI Transfer.

3 replies

KDJEM.1
ST Technical Moderator
Nov 13, 2026 2:53 PM UTC
To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
ST Employee
Nov 13, 2026 3:56 PM UTC

Hello ​@pa0grg ,

Since a minimal Init() succeeds, try narrowing down which initialization step hangs by adding checkpoints around CUBEMX_Init() and Loader_FLASH_Init().

If SPI uses DMA, verify the loader’s vector table and both GPDMA and SPI1 interrupt handlers are correctly configured. The SPI completion callback may depend on the SPI end-of-transfer interrupt after DMA completes. Also check .bss initialization and whether the HAL tick advances in the loader.

Kind regards, 

KD

"Please mark my answer as best by clicking on the “Accept as solution"" button if it fully answered your question. This will help other users find this solution faster.​"
pa0grgAuthorBest answer
Associate III
Nov 17, 2026 11:22 AM UTC

Solved not using DMA on SPI Transfer.