Unable to capture time stamps properly from tstmr on iMX93EVK board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to capture time stamps properly from tstmr on iMX93EVK board

Jump to solution
639 Views
Vikas7Bal
Contributor II

I am trying to run a driver example of TSTMR module on iMX93EVK board.

The example demonstrates the usage of the timer by introducing a delay of 1 sec (using TSTMR_DelayUs()) and captures the time stamps before and after the delay (using TSTMR_ReadTimeStamp()) and displays them on COM/serial port of Cortex M33

As per the readme.md of the driver example, I am supposed to see a difference of 1 sec between the start and stop time stamps of the delay as follows :

~~~~~~~~~~~~~~~~~~~~~~
 Timestamp1 = 01c98d6

 Test the delay function, delay for 1 second

 Start time = 01cb123

 End time = 02bfbd3
~~~~~~~~~~~~~~~~~~~~~~

(End time - start time = F4AB0 ~ 1 sec)


But in my application I am observing that, the difference is being scaled by a factor of 24 as follows :
~~~~~~~~~~~~~~~~~~~~~~

Timestamp1 = 03f377be6

Test the delay function, delay for 1 second

Start time = 03f3a218d

End time = 040a948e4
~~~~~~~~~~~~~~~~~~~~~~

(End time - start time = 16F 2757 ~ 24 sec)

Also, I noticed that, the TSTMR is operating at 24 MHz (whereas in readme.md it was mentioned as 1 MHz), so I am not sure if the scaling is related to the clock frequency

So, can someone help me in resolving this issue?

Labels (1)
0 Kudos
Reply
1 Solution
572 Views
Darrion
Contributor II

 

You're absolutely right! Since TSTMR operates at 24 MHz, TSTMR_ReadTimeStamp() will return the number of clock cycles. To convert this to microseconds, you need to divide by 24 (since 1 MHz = 1 µs).

So, the time elapsed in microseconds would be:

time_us = TSTMR_ReadTimeStamp() / 24;


This should give you the correct timing in µs. Let me know if you need further clarification!

View solution in original post

0 Kudos
Reply
4 Replies
613 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @Vikas7Bal 

 

I hope you are doing very well.

Thank you for contact to NXP support :).

 

After an investigation, you are right, there is a discrepancy between the Readme and reference Manual.

 

You can see on Table 134. Clock Root Table of Reference Manual, tstmr is running at 24 MHz, not 1MHz as suggest the readme.

 

Please ignore readme file. TSTMR is running at 24 MHz.

 

Best regards,

Salas.

 

0 Kudos
Reply
592 Views
Vikas7Bal
Contributor II

Hi @Manuel_Salas , thanks for your quick reply and explanation.

I have one more question, since now it is confirmed that TSTMR is operating at 24 MHz, so the TSTMR_ReadTimeStamp(), will report the clock cycles, and in order to get the actual time elapsed, I think it needs to be scaled down by 24 to get its equivalent in micro seconds (us).

Can you confirm?

0 Kudos
Reply
573 Views
Darrion
Contributor II

 

You're absolutely right! Since TSTMR operates at 24 MHz, TSTMR_ReadTimeStamp() will return the number of clock cycles. To convert this to microseconds, you need to divide by 24 (since 1 MHz = 1 µs).

So, the time elapsed in microseconds would be:

time_us = TSTMR_ReadTimeStamp() / 24;


This should give you the correct timing in µs. Let me know if you need further clarification!

0 Kudos
Reply
568 Views
Vikas7Bal
Contributor II
Thanks for the support
0 Kudos
Reply