Hello,
I'm building a small syslog task on FRDM64F board
For each input string i want to add a time stamp with higher resolution then the RTOS time tick (1 msec)
What is the optimal way to get the highest resolution time stamp? (preferably higher then micro seconds)
Thanks!
Hi
I find a very high resolution time stamp can be easily generated by letting a PIT timer channel run with a reload value of 0xffffffff.
The time stamp value is
unsigned long time_tamp = (0xffffffff - PIT_CVALn); // n is the PIT channel
The PIT runs from the bus clock so you have the same resolution as that (eg. 16.667ns at 60MHz).
The PIT will of course overflow after 71.58s (at this speed) but you can also add an overflow counter (PIT interrupt) to make an unsigned long long value for the time stamp which will run for 9'775 years.....(with 16.667ns resolution).
Regards
Mark