Skip to main content
Associate II
Question

HAL_GetTick rate changes from 1ms to 10ms when threadx starts

I am developing an app for the STM32H562 which is configured using STM32CubeMX and uses threadx, As threadx takes over systick, I have set SYS->Timebase Source to TIM6. I have a routine that is used during startup, before threadx is running, and HAL_GetTick () returns a tick count incremented every millisecond. When the same routine is used after threadx is started, HAL_GetTick () returns a tick count incremented every ten milliseconds.  Isn’t HAL supposed to use TIM6 both before and after threadx starts up?  

1 reply

ST Technical Moderator

Hello ​@javalatte 

Yes, with Timebase Source = TIM6, HAL should keep using TIM6 before and after ThreadX starts. In the HAL timebase implementation, TIM6_IRQHandler() → HAL_TIM_PeriodElapsedCallback() → HAL_IncTick() increments uwTick every 1 ms. HAL_GetTick() returns uwTick. ThreadX using SysTick for its own tick should not affect that path.

Could you please check if the TIM6 interrupt is occurring every 1ms after ThreadX starts ? 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om