2025-03-03 8:32 AM
Hi!!
I am using ThreadX to develop a project.
As far as I know, when using FreeRTOS, it is highly recommended to switch from SysTick to another timer.
Is it the same for ThreadX?
Therefore, I am using TIM7, which is a simple timer. I was wondering where I can find the TIM7 base function that is called every tick. I want to include a function there, but I cannot find it.
Thanks!
Solved! Go to Solution.
2025-03-04 5:59 AM
Hello @massimoperdigo
Yes, it is recommended to switch from SysTick to another timer when using ThreadX, similar to FreeRTOS. This is because the SysTick is exclusively reserved for ThreadX, and you need to use another time base for the HAL, such as TIM6 or TIM7.
Therefore, I am using TIM7, which is a simple timer. I was wondering where I can find the TIM7 base function that is called every tick. I want to include a function there, but I cannot find it.
The function should be like the snippet code below:
void TIM7_IRQHandler(void)
{
// Call the HAL TIM IRQ handler
HAL_TIM_IRQHandler(&htim7);
}
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
/* USER CODE BEGIN Callback 0 */
/* USER CODE END Callback 0 */
if (htim->Instance == TIM7) {
HAL_IncTick();
}
/* USER CODE BEGIN Callback 1 */
/* USER CODE END Callback 1 */
}
Please refer to the example Projects/NUCLEO-H723ZG/Applications/ThreadX/Tx_Thread_Creation for more details:
2025-03-04 5:59 AM
Hello @massimoperdigo
Yes, it is recommended to switch from SysTick to another timer when using ThreadX, similar to FreeRTOS. This is because the SysTick is exclusively reserved for ThreadX, and you need to use another time base for the HAL, such as TIM6 or TIM7.
Therefore, I am using TIM7, which is a simple timer. I was wondering where I can find the TIM7 base function that is called every tick. I want to include a function there, but I cannot find it.
The function should be like the snippet code below:
void TIM7_IRQHandler(void)
{
// Call the HAL TIM IRQ handler
HAL_TIM_IRQHandler(&htim7);
}
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
/* USER CODE BEGIN Callback 0 */
/* USER CODE END Callback 0 */
if (htim->Instance == TIM7) {
HAL_IncTick();
}
/* USER CODE BEGIN Callback 1 */
/* USER CODE END Callback 1 */
}
Please refer to the example Projects/NUCLEO-H723ZG/Applications/ThreadX/Tx_Thread_Creation for more details:
2025-03-05 7:26 AM
ah, yes, perfect!!!
Thank you so much!