We're trying to set up ThreadX for the first time and we're trying to understand all the timer settings that. Although there are basically two constants that we need to set, they are not really clear to us...

Our MCU is the STM32H7, and we're using CubeMX to generate the initial code. We've set the core clock to 400MHz, and the Timebase Source was set to Timer6 - Timer6 Interrupt Period = 1ms

ThreadX timer setup is defined in tx_initialize_low_level.s, and there are two settings:

  • SYSTEM_CLOCK: Should be the same as the core clock

In the manual there is no clear information on what this setting should be, only that by default it is 10ms.

Should we set the SYSTICK_CYCLES to 1ms like the timer interrupt? What is the purpose of the setting? Is there a difference between this setting and the hardware timer interrupt? Are there any 'best practices' for ThreadX timing settings?

Thanks in advance, Trout


1 Answer 1


Ok, so after some more digging around I think we've figured out the answer to this:

  • Regardless of the Timebase Source setting in CubeMX, HAL initializes the SysTick timer and enables his interrupt in the NVIC.
  • After ThreadX loads for the first time, it overwrites the values in the NVIC to fit the value of SYSTICK_CYCLES.

This means that basically, when using the function HAL_Delay() it will count the interrupts created with the Timebase Source. When calling tx_thread_sleep(n) the CPU will sleep for n SYSTICK_CYCLES cycles.

So short answer, there is no immediate connection between SYSTICK_CYCLES and the CPU SysTick. But if you want to use the HAL_Delay() function, make sure that it's set correctly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.