jclark / rpi-cm4-ptp-guide

Guide to using the hardware PTP support in the Raspberry Pi CM4
MIT License
88 stars 10 forks source link

PHC clock locked/unlocked? #8

Open kondou opened 1 year ago

kondou commented 1 year ago

About a week ago, I placed GNSS antenna on aluminum ground plate (150x200mm) in my veranda which is my best place toward the sky. I didn't see so much difference with and without ground plate in my environment (TimeBeat M8F).

On the other hand, ts2phc has been up and running for over 10 days. ts2phc also left offset information in syslog messages. I sometimes examine how it looks like. I'm not exactly sure what s0/s1/s2 means, but seeing from the explanation for ptp4l, s0 means 'unlocked', s1 means 'clock step' and s2 means 'locked'. If that is also applied to ts2phc, PHC is unlocked when I see s0. Is my understandings is correct? And for s2 state, ts2phc says 'locked', but the offset is fairly large. Is that 'locked' state means that trying to minimize the offset, not fairly small?

What I'm concerned is any PTP message as grandmaster may be useless when it's in s0 state...

And, I'm not sure why this s0 situation happens...

These messages are

# grep "master offset" /var/log/syslog | less Mar 2 05:00:41 gm3 ts2phc: [976276.540] eth0 master offset -5 s2 freq +5257 Mar 2 05:00:42 gm3 ts2phc: [976277.548] eth0 master offset 1 s2 freq +5262 Mar 2 05:00:43 gm3 ts2phc: [976278.556] eth0 master offset -4 s2 freq +5257 Mar 2 05:00:44 gm3 ts2phc: [976279.564] eth0 master offset 3 s2 freq +5263 Mar 2 05:00:45 gm3 ts2phc: [976280.572] eth0 master offset 4 s2 freq +5265 Mar 2 05:00:46 gm3 ts2phc: [976281.580] eth0 master offset 999999996 s0 freq +5265 Mar 2 05:00:47 gm3 ts2phc: [976282.588] eth0 master offset 999999995 s0 freq +5265 Mar 2 05:00:48 gm3 ts2phc: [976283.596] eth0 master offset -6 s2 freq -100000000 Mar 2 05:00:49 gm3 ts2phc: [976284.604] eth0 master offset 87874350 s2 freq -12125650 Mar 2 05:00:51 gm3 ts2phc: [976286.620] eth0 master offset 123500359 s0 freq -12125650 Mar 2 05:00:52 gm3 ts2phc: [976287.629] eth0 master offset 135631336 s0 freq -12125650 Mar 2 05:00:53 gm3 ts2phc: [976288.637] eth0 master offset 147762314 s1 freq -60769523 Mar 2 05:00:54 gm3 ts2phc: [976289.644] eth0 master offset 405384 s2 freq -60364139 Mar 2 05:00:55 gm3 ts2phc: [976290.653] eth0 master offset 51771100 s2 freq -8876808 Mar 2 05:00:56 gm3 ts2phc: [976291.668] eth0 master offset 68442484 s2 freq +23325906 Mar 2 05:00:57 gm3 ts2phc: [976292.676] eth0 master offset 50297065 s2 freq +25713232 Mar 2 05:00:58 gm3 ts2phc: [976293.684] eth0 master offset 24977882 s2 freq +15483169 Mar 2 05:00:59 gm3 ts2phc: [976294.696] eth0 master offset 7816104 s2 freq +5814755 Mar 2 05:01:00 gm3 ts2phc: [976295.706] eth0 master offset 356642 s2 freq +700124 Mar 2 05:01:01 gm3 ts2phc: [976296.712] eth0 master offset -1227949 s2 freq -777474 Mar 2 05:01:02 gm3 ts2phc: [976297.720] eth0 master offset -707854 s2 freq -625764 Mar 2 05:01:03 gm3 ts2phc: [976298.728] eth0 master offset -48683 s2 freq -178949 Mar 2 05:01:04 gm3 ts2phc: [976299.736] eth0 master offset 221990 s2 freq +77119 Mar 2 05:01:05 gm3 ts2phc: [976300.744] eth0 master offset 201739 s2 freq +123465 Mar 2 05:01:06 gm3 ts2phc: [976301.752] eth0 master offset 93250 s2 freq +75498 Mar 2 05:01:07 gm3 ts2phc: [976302.760] eth0 master offset 12543 s2 freq +22766 Mar 2 05:01:08 gm3 ts2phc: [976303.768] eth0 master offset -16914 s2 freq -2928 Mar 2 05:01:09 gm3 ts2phc: [976304.776] eth0 master offset -14768 s2 freq -5856 Mar 2 05:01:10 gm3 ts2phc: [976305.784] eth0 master offset -4360 s2 freq +121 Mar 2 05:01:11 gm3 ts2phc: [976306.540] eth0 master offset 2282 s2 freq +5455 Mar 2 05:01:12 gm3 ts2phc: [976307.548] eth0 master offset 2133 s2 freq +5991 Mar 2 05:01:13 gm3 ts2phc: [976308.556] eth0 master offset 1415 s2 freq +5913 Mar 2 05:01:14 gm3 ts2phc: [976309.564] eth0 master offset 765 s2 freq +5687 Mar 2 05:01:15 gm3 ts2phc: [976310.572] eth0 master offset 326 s2 freq +5478 Mar 2 05:01:16 gm3 ts2phc: [976311.580] eth0 master offset 104 s2 freq +5354 Mar 2 05:01:17 gm3 ts2phc: [976312.588] eth0 master offset 0 s2 freq +5281 Mar 2 05:01:18 gm3 ts2phc: [976313.596] eth0 master offset -29 s2 freq +5252 Mar 2 05:01:19 gm3 ts2phc: [976314.604] eth0 master offset -26 s2 freq +5246 Mar 2 05:01:20 gm3 ts2phc: [976315.612] eth0 master offset -16 s2 freq +5248 Mar 2 05:01:21 gm3 ts2phc: [976316.620] eth0 master offset -8 s2 freq +5251 Mar 2 05:01:22 gm3 ts2phc: [976317.628] eth0 master offset -3 s2 freq +5254 Mar 2 05:01:23 gm3 ts2phc: [976318.636] eth0 master offset -1 s2 freq +5255