LinuxPPS NTPD support
From EnneEnneWiki
Contents |
| If you like LinuxPPS make a donation with PayPal - it's fast, free and secure! |
NTPD support
Currently you will need to patch NTPD in order for LinuxPPS to work. We are working on getting these patches merged into the upstream NTPD source.
The following are the reference clocks that are known to be working with LinuxPPS.
Generic NMEA GPS Receiver (refclock_nmea - driver 20)
This driver implements reference clock support for NTPD package that can read time data from a Generic NMEA GPS receiver and optionally its PPS signal.
General Information
- Generic NMEA GPS Receiver (
nmea) - NTPD Driver Number: 20
- Documentation: NTPD Driver 20 Documentation
- Contact: Udo van den Heuvel
- Patch: LinuxPPS NMEA Patch
Installation
You will need to patch the refclock_nmea.c with the supplied patch file, and then configure and compile ntpd. You can follow the instructions below, which will disable reference clocks which are known to be buggy when used with LinuxPPS. Please refer to the NTPD documentation for any other compilation options you may need.
$ cd my-ntpd-source
$ patch -p1 < nmea.patch
$ ./configure --disable-all-clocks --disable-parse-clocks \
--enable-NMEA --enable-LOCAL-CLOCK
$ make
When this completes, you will have an NTP daemon which works with LinuxPPS. You can install it if you would like, using make install.
Udo van den Heuvel's ntp.conf is shown below.
server 127.127.20.0 prefer minpoll 4 fudge 127.127.20.0 flag3 1 flag2 0 time1 0.0
Notes
For further information on this reference clock, please view the NTPD documentation. See above for a link.
The Generic NMEA GPS Receiver code was successfully tested with a Garmin GPS 18 LVC and NTP ntp-4.2.4p2.
You can find a very useful email with instructions on using NTPD with the NMEA patch in our mailing list archives.
Atom PPS Clock Discipline (refclock_atom - driver 22)
This driver implements reference clock support for NTPD package that can read time data from a Atom PPS Clock Discipline.
General Information
- Atom PPS Clock Discipline (
atom) - NTPD Driver Number: 22
- Documentation: NTPD Driver 22 Documentation
- Contact: None
- Patch: None needed!
Installation
As mentioned in the NTPD documentation, this is a secondary PPS input driver that can be used with any other time source, either a local reference clock or a network peer.
Because a PPS signal does not give a complete time, it must be attached to another time source which can disambiguate the seconds. If that time source is valid and within ±0.4 seconds of the PPS edge, the PPS clock will "take over" and provide the time measurements that NTPD uses.
Note that it is entirely normal for the PPS time source to use the same serial port as a serial time code. For serial ports, the PPS time source uses the edges of the DCD input signal.
The disambiguating time source is marked with the keyword prefer on its server or peer line. The PPS clock will not begin sampling until this clock is detected, so do not worry about not seeing events detected immediately.
An example ntp.conf using the PPS clock configuration follows. The prefix 127.127.22 specifies the ATOM driver (driver 22). The last number, 1 in this case, specifies PPS source number 1. This means /dev/pps1.
The flag2 1 specifies that the clear transition of the PPS signal is to be used. This means that /sys/class/pps/pps1/clear will be used as the time source. The default, when flag2 is not specified, is to use the assert signal.
# PPS source /dev/pps1 using the clear edge server 127.127.22.1 minpoll 4 maxpoll 4 fudge 127.127.22.1 flag2 1 # Network clock for disambiguation server my.network.clock prefer
PPS pulses are usually short, and the leading edge is the on-time mark, so by looking at the time of two adjacent edges with cat /sys/class/pps/pps1/{assert,clear}, you can see which one leads the other.
Notes
If you do not have a local reference clock, one possible rude hack is to mark the PPS source as prefer as well as the network clock. This will make the network clock required for NTPD to start. However, once NTPD has started, it can keep time by itself as long as it does not lose the PPS signal.
WARNING: this can result in the NTP server claiming to have good time when it is off by several seconds. It is NOT RECOMMENDED!
Motorola Oncore GPS receiver (refclock_oncore - driver 30)
This driver implements reference clock support for NTPD package that reads time data and PPS signals from a Motorola Oncore GPS receiver.
General Information
- Motorola Oncore GPS receiver (
oncore) - NTPD Driver Number: 30
- Documentation: NTPD Driver 30 Documentation
- Contact: None
- Patch: None needed!
Rockwell Jupiter GPS receiver (refclock_jupiter - driver 31)
This driver implements reference clock support for NTPD package that can read time data and PPS signal from a Rockwell Jupiter GPS receiver.
General Information
- Rockwell Jupiter GPS receiver (
jupiter) - NTPD Driver Number: 31
- Documentation: NTPD Driver 31 Documentation
- Contact: Peter Szegedi, Lichtenberger János
- Patch: LinuxPPS Jupiter patch
Installation
You will need to patch the refclock_jupiter.c with the supplied patch file, and then configure and compile ntpd. You can follow the instructions below, which will disable reference clocks which are known to be buggy when used with LinuxPPS. Please refer to the NTPD documentation for any other compilation options you may need.
$ cd my-ntpd-source
$ patch -p1 < jupiter.patch
$ ./configure --disable-all-clocks --disable-parse-clocks --enable-JUPITER \
--enable-LOCAL-CLOCK --enable-HAVE_PPSAPI --enable-HAVE_TIMEPPS_H
$ make
When this completes, you will have an NTP daemon which works with LinuxPPS. You can install it if you would like, using make install.
You will need to create a /dev/gps0 file, which should be a symlink to /dev/ttySX.
An example ntp.conf follows:
server 127.127.31.0
Notes
The Rockwell Jupiter receiver was tested with a Jupiter12 and ntp-4.2.4p4.
| If you like LinuxPPS make a donation with PayPal - it's fast, free and secure! |
