Skip to main content
Associate
Apr 2, 2026 04:35 UTC
Solved

CubeMX 6.16 generated code: HAL_GetTick() always returns 0

Hi,

I use cubemx to generate code for STM32CubeIDE, compile is OK, but the initial process run fail with HAL_Delay function, the HAL_GetTick() always return 0 so the program blocked here.

 

attached is my .ioc file, any anyone help for thie issue?

Jason57Best answer
Associate
Apr 8, 2026 14:37 UTC

thanks for your reply, I add 2 seconds in the "max halt timeout" and the problem solved.

2 replies

TDK
Apr 3, 2026 05:27 UTC

The issue is likely in how and where you're using HAL_Delay in your code. Ensure interrupts stay enabled and ensure the tick interrupt gets serviced.

The TIM6 priority is 0 in the IOC which is the highest. No issues there.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
Jason57AuthorBest answer
Associate
Apr 8, 2026 14:37 UTC

thanks for your reply, I add 2 seconds in the "max halt timeout" and the problem solved.