NTP Server using Raspberry Pi and VP Oncore GPS Module – Part 4

Devices and Device Links

As we shall see later the Reference Clock driver in NTP needs to see the Oncore Serial I/O and Oncore PPS signals on specific device names and these are not yet configured by the kernel we downloaded.  In particular the device /dev/ttyAMA0 is currently bound to the UART and the /dev/pps0 device is bound to a rising edge on GPIO Pin 18. (And the Rasberry console I/O has been inhibited so the UART is free for our exclusive use).

Creating symbolic links in /dev will work but they do not survive a reboot so the best approach is to create a udev rule file as follows…

root@ntpi:/# cat /etc/udev/rules.d/50-oncore.rules

And then restart the Raspberry PI with a reboot command. (Resist the temptation to cycle the power on the PI as this often ends in SD card corruption; use reboot and shutdown -h now where appropriate to avoid disaster).

Finally we should have…

root@ntpi:/# ls -1 /dev | grep oncore

Configure NTPd

The NTPd supplied with the kernel we downloaded from openchaos.org has been built including the Oncore reference clock so configuration is pretty easy now.

Configure the server in /etc/ntpd.conf to include the reference clock driver. (Note that the 127.127.x.y addresses are magic numbers to tell NTPd to use a reference clock… see the NTP documentation for details)

# VP Oncore
server prefer

server ntp1.ptb.de prefer  # another stable preferred peer

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst

Create a ONCORE specific configuration file /etc/ntp.oncore

root@ntpi:/# cat /etc/ntp.oncore

LAT 51.0
LONG -0.3
HTGPS 10.0 M

SHMEM /var/adm/ntpstats/ONCORE

(Create the directory /var/adm/ntpstats and make it world writable by ntp if using SHMEM status)

Get NTP running again by /etc/init.d/ntp restart

Wait for everything to settle (may take hours if the receiver has no Almanac), ensure good visibility for the GPS antenna to get a good timing solution and then check that all is working…

root@ntpi:/# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
 GPS_ONCORE(0)   .GPS.            0 l    -   16    0    0.000    0.000   0.000
 ptbtime1.ptb.de .PTB.            1 u   30   64    3   36.530   -0.707   0.691
+stratum2-3.NTP.    2 u   25   64    3   35.616   -0.969   4.477
+stratum2-3.NTP.    2 u   26   64    3   34.654   -1.434   2.231
*clock2.infonet. .PPS.            1 u   23   64    3   58.767   -4.061   4.464
-ntp.univ-angers   2 u   26   64    3   46.173   -3.868   3.988

… you can track progress by watching /var/log/daemon.log (which is where the NTP log info ends up) and after a while….

pi@ntpi ~ $ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
*GPS_ONCORE(0)   .GPS.            0 l    1   16  377    0.000   -0.001   0.003
+ptbtime1.ptb.de .PTB.            1 u   34   64  377   36.019   -1.340   6.205
+stratum2-3.NTP.    2 u   12   64  377   34.453   -1.166   1.222
+stratum2-3.NTP.    2 u   62   64  377   34.526   -1.193   0.178
-clock2.infonet. .PPS.            1 u   54   64  377   59.021   -4.390   2.726
-ntp.univ-angers   2 u   48   64  377   44.575   -7.638   0.406
pi@ntpi ~ $

We have a GPS Accurate NTP Server!

Part 5


About nivagswerdna

Professional Geek
This entry was posted in Uncategorized. Bookmark the permalink.

1 Response to NTP Server using Raspberry Pi and VP Oncore GPS Module – Part 4

  1. Pingback: NTP Server using Raspberry Pi and VP Oncore GPS Module – Part 3 | aardvarklabs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s