Thread: [Linuxptp-users] phc2sys time offset is abnormal
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: <957...@qq...> - 2023-06-12 07:42:09
|
Hi, I am using a embeded board, which contains a mcu and a soc. Two chips communicate through a switch chip. The mcu works as ptp master, the soc works as slave. The period of sync&follow up message is 0.125s. Here is log of ptp slave: # ptp4l -i vlan12 -f automotive-slave.cfg -m ptp4l[72.642]: selected /dev/ptp1 as PTP clock ptp4l[72.684]: port 1: INITIALIZING to SLAVE on INIT_COMPLETE ptp4l[72.684]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[74.660]: rms 366839997034620032 max 733679994069242240 freq +11485 +/- 12041 delay 5472 +/- 0 ptp4l[75.660]: rms 20038 max 34097 freq -14174 +/- 6166 delay 5559 +/- 0 ptp4l[76.660]: rms 10812 max 16500 freq -16497 +/- 4181 delay 5472 +/- 0 ptp4l[77.660]: rms 96835 max 156626 freq +164918 +/- 44143 delay -170404 +/- 0 ptp4l[78.660]: rms 120039 max 178982 freq -145879 +/- 24792 delay 5444 +/- 0 ptp4l[79.660]: rms 23089 max 53916 freq -62634 +/- 25815 delay 5458 +/- 0 ptp4l[80.660]: rms 20165 max 25818 freq -12318 +/- 11425 delay 5444 +/- 0 ptp4l[81.660]: rms 17083 max 24514 freq +2754 +/- 8827 delay 5458 +/- 0 ptp4l[82.660]: rms 7114 max 11930 freq +1333 +/- 3857 delay 5472 +/- 0 ptp4l[83.660]: rms 5359 max 12288 freq -5287 +/- 7348 delay 5480 +/- 0 ptp4l[84.660]: rms 2961 max 4156 freq -6900 +/- 3723 delay 5568 +/- 0 ptp4l[85.660]: rms 6083 max 15115 freq -9199 +/- 7948 delay 5587 +/- 0 ptp4l[86.660]: rms 2939 max 3379 freq -7402 +/- 4030 delay 5691 +/- 0 ptp4l[87.660]: rms 2624 max 3081 freq -7576 +/- 3590 delay 5953 +/- 0 ptp4l[88.660]: rms 2893 max 3773 freq -8457 +/- 3874 delay 6615 +/- 0 ptp4l[89.660]: rms 6104 max 15236 freq -9663 +/- 8280 delay 7718 +/- 0 ptp4l[90.660]: rms 2829 max 3852 freq -8735 +/- 3871 delay 9534 +/- 0 ptp4l[91.660]: rms 6007 max 14548 freq -9671 +/- 8211 delay 10710 +/- 0 # phc2sys -s vlan12 -c CLOCK_REALTIME -f automotive-slave.cfg -m -w phc2sys[137.803]: CLOCK_REALTIME phc offset -733679957069723074 s0 freq +0 delay 750 phc2sys[138.803]: CLOCK_REALTIME phc offset -733679957069730322 s1 freq -7246 delay 750 phc2sys[139.803]: CLOCK_REALTIME phc offset -829 s2 freq -8075 delay 750 phc2sys[140.804]: CLOCK_REALTIME phc offset -5124 s2 freq -12618 delay 750 phc2sys[141.804]: CLOCK_REALTIME phc offset 614 s2 freq -8417 delay 750 phc2sys[142.804]: CLOCK_REALTIME phc offset 2093 s2 freq -6754 delay 750 phc2sys[143.804]: CLOCK_REALTIME phc offset 756 s2 freq -7463 delay 750 phc2sys[144.804]: CLOCK_REALTIME phc offset 1154 s2 freq -6839 delay 750 phc2sys[145.805]: CLOCK_REALTIME phc offset 540 s2 freq -7106 delay 750 phc2sys[146.805]: CLOCK_REALTIME phc offset 660 s2 freq -6824 delay 750 phc2sys[147.805]: CLOCK_REALTIME phc offset 51 s2 freq -7235 delay 750 phc2sys[148.805]: CLOCK_REALTIME phc offset 453 s2 freq -6818 delay 750 phc2sys[149.805]: CLOCK_REALTIME phc offset 67 s2 freq -7068 delay 750 phc2sys[150.806]: CLOCK_REALTIME phc offset 152 s2 freq -6963 delay 750 phc2sys[151.806]: CLOCK_REALTIME phc offset -802 s2 freq -7871 delay 750 phc2sys[152.806]: CLOCK_REALTIME phc offset -1763 s2 freq -9073 delay 750 phc2sys[153.806]: CLOCK_REALTIME phc offset 474 s2 freq -7365 delay 750 phc2sys[154.807]: CLOCK_REALTIME phc offset 1207 s2 freq -6490 delay 750 phc2sys[155.807]: CLOCK_REALTIME phc offset -36 s2 freq -7371 delay 750 phc2sys[156.807]: CLOCK_REALTIME phc offset -66 s2 freq -7411 delay 75 # phc_ctl vlan12 cmp phc_ctl[197.010]: offset from CLOCK_REALTIME is -37000018280ns # phc_ctl vlan12 cmp phc_ctl[297.161]: offset from CLOCK_REALTIME is -36999997815ns Q1, I can only find rms value in log of ptp4l, but no offset value. And this rms value does not converge. Is it normal? How can I get offset log? Q2, as shown by the result of phc_ctl, the offset between sys time and phc time is about 37s, how can I fix it? Thank you! |
From: egg c. <egg...@gm...> - 2023-06-12 07:59:10
|
Hi, > Q1, I can only find rms value in log of ptp4l, but no offset value. And this rms value does not converge. Is it normal? How can I get offset log? The rms value is the statistic value of offset. It depends on whether your test suites supports hwtimestamp or only software timestamp, and the accuracy of the gm(your mcu perhaps), and whether the switch chip supports hw ptp correction or not. > Q2, as shown by the result of phc_ctl, the offset between sys time and phc time is about 37s, how can I fix it? It's the offset between unix ts and TAI ts, don't worry it's okay, the kernel time always offset with TAI-based phc of 37s until the next leap second event (perhaps that'll never gonna happen again...) |