Skip to main content
Graduate II
December 15, 2025
Solved

Changing the ThreadX timebase to 1ms

  • December 15, 2025
  • 2 replies
  • 91 views

Due to more performance requirement, i wanted to change the ThreadX timebase to 1ms. To what i have researched till now i need to make the following #define TX_TIMER_TICKS_PER_SECOND to 1000 which is usually set at 100 which is 10ms. Any idea what else need to be done to make the ThreadX timebase to 1ms other than this or is this enough already?

Thanks a lot for guidance.

    This topic has been closed for replies.
    Best answer by MHoll.2

    You are right, the only change You need is setting TX_TIMER_TICKS_PER_SECOND  to 1000.

    Martin

    2 replies

    MHoll.2Answer
    Graduate II
    December 15, 2025

    You are right, the only change You need is setting TX_TIMER_TICKS_PER_SECOND  to 1000.

    Martin

    Super User
    December 15, 2025

    TX_TIMER_TICKS_PER_SECOND doesn't seem to be used anywhere in the code. As such, changing it won't affect anything.

    TDK_0-1765803100250.png

    Tick frequency looks to be fixed to 1000 to me. You can manually edit the code to change the timer update frequency but doesn't seem to be a way to do this in my version of CubeMX.

    Relevant code would be here:

     htim6.Init.Period = (1000000U / 1000U) - 1U;

     

    Graduate II
    December 15, 2025

    ThreadX is using the System timer (not htim6 or other timers), the tick cycle time is set in tx_initialize_low_level.S, in my case (H725):

    SYSTEM_CLOCK = 400000000
    SYSTICK_CYCLES = ((SYSTEM_CLOCK / 1000) -1)

     This constant's are handled by CubeMX, and are depending on TX_TIMER_TICKS_PER_SECOND.

    So setting 

    TX_TIMER_TICKS_PER_SECOND to 1000 will give You 1ms tick cyles.

    Edit: Sorry I didn't see that You do not use CubeMX. If this is the case then You have to set the time directly in tx_initialize_low_level.S.