nxp-archive / openil_linuxptp

PTP IEEE 1588 stack for Linux
GNU General Public License v2.0
136 stars 60 forks source link

Getting big offsets with phc2sys #20

Open JosephMatan83 opened 3 years ago

JosephMatan83 commented 3 years ago

I’m having some issues when running the phc2sys service:

  1. Getting too big offsets (above 1000 ns, something even above 10000 ns).
  2. Frequency doesn’t offset not stable (goes backward and forward between -1000 to +15000).
  3. Delay seems too high (around 85000 ns) and also not stable.

My board is running as a PTP slave (running ptp4l), so I thought that maybe due to the PTP operations on the PHC, the PHC jumps too frequently (-/+500 ns), and that’s may cause the PHC offset (from the SYSTEM clock) to jumps even more frequently.

So I tried to disable the PTP on the slave side, so now I’m only trying to synchronize the SYSTEM clock to the PHC, but the PTP isn’t running - so the ptp4l isn’t touching the PHC (maybe some other app is touching it?), but I still getting huge numbers when running: phc2sys -s eth0 -c CLOCK_REALTIME -O 0 -m

phc2sys[100724.479]: phc offset      9710 s2 freq  +16651 delay  87084
phc2sys[100725.480]: phc offset     -6374 s2 freq   +3494 delay  98123
phc2sys[100726.480]: phc offset      7295 s2 freq  +15238 delay  85917
phc2sys[100727.481]: phc offset       504 s2 freq  +10641 delay  85791
phc2sys[100728.482]: phc offset     -5856 s2 freq   +4438 delay  87999
phc2sys[100729.483]: phc offset      -797 s2 freq   +7737 delay  87708
phc2sys[100730.484]: phc offset      2084 s2 freq  +10376 delay  78833
phc2sys[100731.485]: phc offset      4011 s2 freq  +12926 delay  87999
phc2sys[100732.486]: phc offset        38 s2 freq  +10158 delay  86291
phc2sys[100733.487]: phc offset     -1026 s2 freq   +9107 delay  91958
phc2sys[100734.488]: phc offset     -6140 s2 freq   +3690 delay  85832
phc2sys[100735.489]: phc offset      4207 s2 freq  +12186 delay  88041
phc2sys[100736.490]: phc offset     -3554 s2 freq   +5695 delay  85623
phc2sys[100737.491]: phc offset      3789 s2 freq  +11965 delay 101083
phc2sys[100738.492]: phc offset       297 s2 freq   +9611 delay  85582
phc2sys[100739.493]: phc offset      1379 s2 freq  +10781 delay  87875
phc2sys[100740.494]: phc offset     -6069 s2 freq   +3752 delay  86332
phc2sys[100741.495]: phc offset     -1331 s2 freq   +6669 delay  87958
phc2sys[100742.496]: phc offset      6917 s2 freq  +14508 delay  88499
phc2sys[100743.497]: phc offset     -2184 s2 freq   +7491 delay  81374
phc2sys[100744.498]: phc offset      2693 s2 freq  +11707 delay  87583
phc2sys[100745.499]: phc offset     -4275 s2 freq   +5553 delay  85624
phc2sys[100746.500]: phc offset      -229 s2 freq   +8315 delay  85541
phc2sys[100747.501]: phc offset      2908 s2 freq  +11380 delay  73500
phc2sys[100748.502]: phc offset      2244 s2 freq  +11588 delay  87665
phc2sys[100749.503]: phc offset    -10089 s2 freq     -54 delay 109915
phc2sys[100750.504]: phc offset      4548 s2 freq  +11540 delay  81959
phc2sys[100751.505]: phc offset      5286 s2 freq  +13641 delay  89249
phc2sys[100752.506]: phc offset     -1932 s2 freq   +8015 delay  80082
phc2sys[100753.507]: phc offset      3044 s2 freq  +12406 delay  88624
phc2sys[100754.508]: phc offset     -1080 s2 freq   +9200 delay  87499
phc2sys[100755.509]: phc offset     -7518 s2 freq   +2441 delay  93249
phc2sys[100756.510]: phc offset       804 s2 freq   +8503 delay  87000
phc2sys[100757.511]: phc offset      -149 s2 freq   +7793 delay  88999
phc2sys[100758.512]: phc offset      6757 s2 freq  +14645 delay  85875
phc2sys[100759.513]: phc offset      4473 s2 freq  +14389 delay  95998
phc2sys[100760.514]: phc offset     -1140 s2 freq  +10123 delay 101207
phc2sys[100761.515]: phc offset     -6670 s2 freq   +4257 delay  95457
phc2sys[100762.517]: phc offset     -9577 s2 freq    -638 delay 109792
phc2sys[100763.517]: phc offset      3410 s2 freq   +9460 delay  87125
phc2sys[100764.518]: phc offset      8896 s2 freq  +15961 delay  87332
phc2sys[100765.519]: phc offset     -2190 s2 freq   +7554 delay  84499
phc2sys[100766.520]: phc offset     -3047 s2 freq   +6041 delay  91291
phc2sys[100767.521]: phc offset      1301 s2 freq   +9471 delay  85791
phc2sys[100768.522]: phc offset      5314 s2 freq  +13869 delay  86416

Question:

The first thing I’m concerned about is that the calculated delay is too high. It doesn’t make any sense (to me…). The second thing I’m concerned about is that maybe some other program is playing with the PHC - but how can I trace after such operations on the PHC ? Any idea what could it be ? Maybe some guidelines on what should I check and how ?

Platform:

My board is running with KSZ9477 switch (with HW timestamping support) on linux 4.19.