BPI-R3 ntp drift

Hi,

Do anyone know why this board shows high offset when synchronizing with NTP server? the offset varies from 90 to 500ms.

I tried to feed it a PPS via GPS and that didn’t work.

On the other hand I had other ARM boards which do not show this behavior so I’m thinking it’s something with the board.

root@bpi-r3:~# ntpq -p
     remote                                   refid      st t when poll reach   delay   offset   jitter
=======================================================================================================
*16.14.168.192.wifi                      .PPS.            1 u   54   64    7   2.2706 327.8435  95.4199

Synchronizing ntp through wifi which has more delay as ethernet…can you make tests with wired connection?

You have not left it running long enough. You need to wait until the reach is 377, then it should start to settle. The tools with the ntpd package do not show the unit, so you cannot tell what the numbers mean. Grabbing ntpq from ntpsec and passing the -u switch will give you them.

You also need to give the details from the ntpd server itself and whether it is trully running kernel PPS.

For my system contacting an RPi4 over 802.11ac, I see:

 remote           refid      st t when poll reach   delay   offset   jitter
===============================================================================
*feeder.docile.b .PPS.            1 u    8   32  377  3.424ms -3.613ms  3.300ms
*feeder.docile.b .PPS.            1 u    8   32  377    3.424   -3.613    3.300

Thanks Frank

I have tried over ethernet as well. Also, all other nodes sync with the same RPI getting the time from GPS/PPS and they don’t show this big of a drift.

How long is long enough? It still show reach of 1 and seems like is not even syncing with it anymore. This has been a constant issue with the bpi-r3 for me. I don’t think it’s a matter of not waiting long enough.

root@bpi-r3:~# ntpq -p
     remote                                   refid      st t when poll reach   delay   offset   jitter
=======================================================================================================
 16.14.168.192.wifi                      200.89.75.198    3 u   38   64    1   1.2141  96.3744  58.1250
root@bpi-r3:~# 
root@bpi-r3:~# uptime
 15:05:45 up 18:40,  2 users,  load average: 0.58, 0.28, 0.21

Waited a couple of mins and now reach is 77 and back to synchronizing with it again, or at least trying. It goes back and forth

root@bpi-r3:~# ntpq -p
     remote                                   refid      st t when poll reach   delay   offset   jitter
=======================================================================================================
*16.14.168.192.wifi                      64.176.3.116     3 u   44   64   77   1.2123 166.2919 134.3475

10 minutes later

root@bpi-r3:~# ntpq -p
     remote                                   refid      st t when poll reach   delay   offset   jitter
=======================================================================================================
*16.14.168.192.wifi                      64.176.3.116     3 u    7   64   77   1.2042 419.5158 134.0977

Reach goes through 1, 3, 7, 17, 37, 77, 177, 377 and 377 is the key. Poll is the number of seconds between contact (actually + 2 or 3 more). The reset is because the ntpd on the BPi is not contacting the remote ntp server. I think this is due to a bug in the software. I had this problem back in April, but it seems stable now running 4.2.8p15-4.

You may want to post your ntp.conf file void of any comments or sensitive info.

Here’s my config, I’m using ntpsec.

root@bpi-r3:~# ntpq -V
ntpq ntpsec-1.2.0 2021-06-17T05:15:04Z

root@bpi-r3:~# cat /etc/ntpsec/ntp.conf
driftfile /var/lib/ntpsec/ntp.drift
logfile /var/log/ntp.log
logconfig =all
leapfile /usr/share/zoneinfo/leap-seconds.list
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 192.168.14.16 iburst
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1

An example from two other hosts syncing with the same PPS/GPS synced RPI

root@rak831:~# ntpq -p
     remote                                   refid      st t when poll reach   delay   offset   jitter
=======================================================================================================
*192.168.14.16                           64.176.3.116     3 u  114 1024  377   2.7926   0.1946   0.8813

root@cp-1:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.14.16   64.176.3.116     3 u  430 1024  377    1.661   -0.388   2.727

No improvement after more than 1 day of uptime. As you can see. the drift floats from 90 to 400ms. It seems like an issue with the BPI-R3. I’m not an expert, I’m not sure what controls the clock behavior.

Would anything improve by adding an external RTC? Thanks!

root@bpi-r3:~# ntpq -p
     remote                                   refid      st t when poll reach   delay   offset   jitter
=======================================================================================================
 16.14.168.192.wifi                      200.89.75.198    3 u   23   64    1   1.3164 195.6712   0.0000
root@bpi-r3:~# 
root@bpi-r3:~# uptime
 13:14:43 up 1 day, 16:48,  1 user,  load average: 0.05, 0.15, 0.22

Ignore the drift and anything else with the exception of reach. Until that is stable at 377 then the other numbers are meaningless.

An external RTC would not help.

Try running with debugging on, and run tcpdump against the ntp port.

Thanks, this does look like a bug with ntpsec. I switched to chrony and NTP sync is working fine now.

Appreciate the help

I had the same issue with plain ntpd. I put it down to having the channel analysis window open on the BPi. Which if you think about it, really messes the wi-fi up since it scans the frequency range thus spoiling any current connections.