Time tick for syslog

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Time tick for syslog

919 次查看
dotangoldberg
Contributor II

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! 

标记 (1)
0 项奖励
回复
1 回复

833 次查看
mjbcswitzerland
Specialist V

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

0 项奖励
回复