xref: /freebsd/contrib/ntp/html/drivers/driver22.html (revision b5ff185e19f6013ca565b2a15bc2d6abce933f46)
19c2daa00SOllivier Robert<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
29c2daa00SOllivier Robert<html>
39c2daa00SOllivier Robert<head>
4ea906c41SOllivier Robert<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
59c2daa00SOllivier Robert<meta name="generator" content="HTML Tidy, see www.w3.org">
69c2daa00SOllivier Robert<title>PPS Clock Discipline</title>
72b15cb3dSCy Schubert<!-- Changed by: Harlan &, 31-Mar-2014 -->
8ea906c41SOllivier Robert<link href="scripts/style.css" type="text/css" rel="stylesheet">
99c2daa00SOllivier Robert</head>
109c2daa00SOllivier Robert<body>
119c2daa00SOllivier Robert<h3>PPS Clock Discipline</h3>
122b15cb3dSCy Schubert<p>Author: David L. Mills (mills@udel.edu)<br>
132b15cb3dSCy Schubert  Last change:
142b15cb3dSCy Schubert  <!-- #BeginDate format:En2m -->31-Mar-2014  07:46<!-- #EndDate -->
152b15cb3dSCy Schubert  UTC</p>
169c2daa00SOllivier Robert  <hr>
179c2daa00SOllivier Robert<h4>Synopsis</h4>
189c2daa00SOllivier Robert<p>Address: 127.127.22.<i>u</i><br>
199c2daa00SOllivier Robert  Reference ID: <tt>PPS</tt><br>
209c2daa00SOllivier Robert  Driver ID: <tt>PPS</tt><br>
219c2daa00SOllivier Robert  Serial or Parallel Port: <tt>/dev/pps<i>u</i></tt><br>
222b15cb3dSCy Schubert  Requires: PPSAPI signal interface for PPS signal processing.</p>
232b15cb3dSCy Schubert<p>Note: This driver supersedes an older one of the same name. The older driver operated with several somewhat archaic signal interface devices, required intricate configuration and was poorly documented. This driver requires the Pulse per Second API (PPSAPI)<sup>1</sup>.	Note also that the <tt>pps</tt> configuration command has been obsoleted by this driver.</p>
249c2daa00SOllivier Robert<h4>Description</h4>
25ea906c41SOllivier Robert<p>This driver furnishes an interface for the pulse-per-second (PPS) signal produced by a cesium clock, radio clock or related devices. It can be used to augment the serial timecode generated by a GPS receiver, for example. It can be used to remove accumulated jitter and re-time a secondary server when synchronized to a primary server over a congested, wide-area network and before redistributing the time to local clients. The driver includes extensive signal sanity checks and grooming algorithms. A range gate and frequency discriminator reject noise and signals with incorrect frequency. A multiple-stage median filter rejects jitter due to hardware interrupt and operating system latencies. A trimmed-mean algorithm determines the best time samples. With typical workstations and processing loads, the incidental jitter can be reduced to a few microseconds.</p>
26ea906c41SOllivier Robert<p>While this driver can discipline the time and frequency relative to the PPS source, it cannot number the seconds. For this purpose an auxiliary source is required, ordinarily a radio clock operated as a primary reference (stratum 1) source; however, another NTP time server can be used as well. For this purpose, the auxiliary source should be specified as the prefer peer, as described in the <a href="../prefer.html">Mitigation Rules and the <tt>prefer</tt> Keyword</a> page.</p>
279c2daa00SOllivier Robert<p>The driver requires the PPSAPI interface<sup>1</sup>, which is a proposed IETF standard. The interface consists of the <tt>timepps.h</tt> header file and associated kernel support. Support for this interface is included in current versions of Solaris, FreeBSD and Linux and proprietary versions of Tru64 (Alpha) and SunOS. See the <a href="../pps.html">Pulse-per-second (PPS) Signal Interfacing</a> page for further information.</p>
28ea906c41SOllivier Robert<p>The PPS source can be connected via a serial or parallel port, depending on the hardware and operating system. A serial port can be dedicated to the PPS source or shared with another device; however, if dedicated the data leads should not be connected, as noise or unexpected signals can cause <tt>ntpd</tt> to exit.</p>
292b15cb3dSCy Schubert<p>A radio clock is usually connected via a serial port and the PPS source
302b15cb3dSCy Schubert  connected via a level converter to the data carrier detect (DCD)
312b15cb3dSCy Schubert  pin (DB-9 pin 1, DB-25 pin 8) of the same connector. In some systems
322b15cb3dSCy Schubert  where a parallel port and driver are available, the PPS signal can
332b15cb3dSCy Schubert  be connected directly to the ACK pin (DB25 pin 10) of the connector.
342b15cb3dSCy Schubert  Whether the PPS signal is connected via a dedicated port or shared with another
352b15cb3dSCy Schubert  device, the driver opens the device <tt>/dev/pps%d</tt>,
362b15cb3dSCy Schubert  where <tt>%d</tt> is the unit number. As with other drivers, links can be
372b15cb3dSCy Schubert  used to redirect the logical name to the actual physical device.</p>
382b15cb3dSCy Schubert<p>The driver normally operates like any other driver and uses the same mitigation
392b15cb3dSCy Schubert  algorithms and PLL/FLL clock discipline incorporated in the daemon.
402b15cb3dSCy Schubert  If kernel PLL/FLL support is available, the kernel PLL/FLL clock
412b15cb3dSCy Schubert  discipline can be used instead. The default behavior is not to use
422b15cb3dSCy Schubert  the kernel PPS clock discipline, even if present. This driver incorporates
432b15cb3dSCy Schubert  a good deal of signal processing to reduce jitter using the median
442b15cb3dSCy Schubert  filter algorithm in the driver. As the result, performance
452b15cb3dSCy Schubert  with <tt>minpoll</tt> configured at  4 (16s) is generally
462b15cb3dSCy Schubert  better than the kernel PPS discipline. However, fudge flag 3 can
472b15cb3dSCy Schubert  be used to enable the kernel PPS discipline if necessary.</p>
482b15cb3dSCy Schubert<p>This driver
492b15cb3dSCy Schubert  is enabled only under one of two conditions (a) a prefer peer other than
502b15cb3dSCy Schubert  this  driver is among the survivors of the mitigation algorithms or (b)
512b15cb3dSCy Schubert  there are no survivors and the <tt>minsane</tt> option
522b15cb3dSCy Schubert  of the <tt>tos</tt> command is 0. The prefer peer designates another source
532b15cb3dSCy Schubert  that can reliably number the seconds when available . However, if no
542b15cb3dSCy Schubert  sources are available, the system clock continues to be disciplined by
552b15cb3dSCy Schubert  the PPS driver on an indefinite basis.</p>
562b15cb3dSCy Schubert<p>A scenario where the latter behavior can be most useful is a planetary orbiter
572b15cb3dSCy Schubert  fleet, for instance in the vicinity of Mars, where contact between orbiters
582b15cb3dSCy Schubert  and Earth only one or two times per Sol (Mars day). These orbiters have a
592b15cb3dSCy Schubert  precise timing reference based on an Ultra Stable Oscillator (USO) with accuracy
602b15cb3dSCy Schubert  in the order of a Cesium oscillator. A PPS signal is derived from the USO
612b15cb3dSCy Schubert  and can be disciplined from Earth on rare occasion or from another orbiter
622b15cb3dSCy Schubert  via NTP. In the above scenario the PPS signal disciplines the spacecraft clock
632b15cb3dSCy Schubert  between NTP updates.</p>
642b15cb3dSCy Schubert<p>In a similar scenario a PPS signal can be used to discipline the clock between
652b15cb3dSCy Schubert  updates produced by the modem driver. This would provide precise synchronization
662b15cb3dSCy Schubert  without needing the Internet at all.</p>
679c2daa00SOllivier Robert<h4>Fudge Factors</h4>
689c2daa00SOllivier Robert<dl>
692b15cb3dSCy Schubert  <dt><tt>time1 <i>time</i></tt></dt>
702b15cb3dSCy Schubert  <dd>Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
712b15cb3dSCy Schubert  <dt><tt>time2 <i>time</i></tt></dt>
722b15cb3dSCy Schubert  <dd>Not used by this driver.</dd>
732b15cb3dSCy Schubert  <dt><tt>stratum <i>number</i></tt></dt>
742b15cb3dSCy Schubert  <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
752b15cb3dSCy Schubert  <dt><tt>refid <i>string</i></tt></dt>
762b15cb3dSCy Schubert  <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with default <tt>PPS</tt>.</dd>
772b15cb3dSCy Schubert  <dt><tt>flag1 0 | 1</tt></dt>
782b15cb3dSCy Schubert  <dd>Not used by this driver.</dd>
792b15cb3dSCy Schubert  <dt><tt>flag2 0 | 1</tt></dt>
802b15cb3dSCy Schubert  <dd>Specifies PPS  capture on the rising (assert) pulse edge if 0 (default) or falling
812b15cb3dSCy Schubert    (clear) pulse edge if 1.  Not used under Windows - if the special <tt>serialpps.sys</tt> serial port driver is installed then the leading edge will <i>always</i> be used.</dd>
822b15cb3dSCy Schubert  <dt><tt>flag3 0 | 1</tt></dt>
83*276da39aSCy Schubert  <dd>Controls the kernel PPS discipline: 0 for disable (default), 1 for enable.  Not used under Windows - if the special <tt>serialpps.sys</tt> serial port driver is used then kernel PPS will be available and used.</dd>
842b15cb3dSCy Schubert  <dt><tt>flag4 0 | 1</tt></dt>
852b15cb3dSCy Schubert  <dd>Record a timestamp once for each second if 1. Useful for constructing
862b15cb3dSCy Schubert    Allan deviation plots.</dd>
872b15cb3dSCy Schubert  .
889c2daa00SOllivier Robert</dl>
899c2daa00SOllivier Robert<h4>Additional Information</h4>
909c2daa00SOllivier Robert<p><a href="../refclock.html">Reference Clock Drivers</a></p>
919c2daa00SOllivier Robert<p>Reference</p>
929c2daa00SOllivier Robert<ol>
932b15cb3dSCy Schubert  <li>Mogul, J., D. Mills, J. Brittenson, J. Stone and U. Windl. Pulse-per-second API for Unix-like operating systems, version 1. Request for Comments RFC-2783, Internet Engineering Task Force, March 2000, 31 pp.</li>
949c2daa00SOllivier Robert</ol>
959c2daa00SOllivier Robert<hr>
96ea906c41SOllivier Robert<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
979c2daa00SOllivier Robert</body>
989c2daa00SOllivier Robert</html>
99