Skip to main content
Associate
April 2, 2026
Solved

CubeMX 6.16 generated code: HAL_GetTick() always returns 0

  • April 2, 2026
  • 2 replies
  • 193 views

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?

Best answer by Jason57

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

2 replies

TDK
Super User
April 3, 2026

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
April 8, 2026

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