cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the ThreadX timebase to 1ms

Zainulabedeen
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
MHoll.2
Senior III

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

Martin

View solution in original post

3 REPLIES 3
MHoll.2
Senior III

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

Martin

TDK
Super User

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;

 

If you feel a post has answered your question, please click "Accept as Solution".

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.