NetBSD/usr.sbin/xntp/html/driver22.html

108 lines
4.4 KiB
HTML

<!-- $NetBSD: driver22.html,v 1.1 1998/12/30 20:20:34 mcr Exp $ -->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Strict//EN">
<html><head><title>
PPS Clock Discipline
</title></head><body><h3>
PPS Clock Discipline
</h3><hr>
<p><h4>Synopsis</h4>
<p>Address: 127.127.22.<var>u</var>
<br>Reference ID: ATOM
<br>Driver ID: ATOM-PPS
<br>Serial Port: <code>/dev/pps<var>u</var></code>; 9600 baud, 8-bits,
no parity
<br>Features: <code>tty_clk</code>, <code>ppsclock</code>
<p><h4>Description</h4>
<p>This driver furnishes an interface for pulse-per-second (PPS) signals
produced by a cesium clock, radio clock or related equipment. It can be
used to remove accumulated jitter and retime a secondary server when
synchronized to a primary server over a congested, wide-area network and
before redistributing the time to local clients.
<p>In order for this driver to work, the local clock must be set to
within +-500 ms by another means, such as a radio clock or NTP itself.
The PPS signal is connected via a serial port and <a
href="gadget.html">gadget box</a> consisting of a one-shot and RS232
level converter. When operated at 38.4 kbps with a SPARCstation IPC,
this arrangement has a worst-case jitter less than 26 us.
<p>There are three ways in which this driver can be used. The first way
uses the <code>LDISC_CLKPPS</code> line discipline and works only for
the baseboard serial ports of the Sun SPARCstation running SunOS 4.x. In
order to use this option, the -DPPS flag must be included in the
<code>DEFS_LOCAL</code> line of the distribution configuration file
<code>./Config.local</code>. The PPS signal is connected via the gadget
box to the carrier detect (DCD) line of a serial port. The signal is
activated by a <code>fudge flag3 1</code> command following the
<code>server</code> command in the configuration file. This causes the
<code>ppsclock</code> streams module to be configured for that port and
to capture a timestamp at the on-time transition of the PPS signal. This
driver then reads the timestamp directly by a designated
<code>ioctl()</code> system call. This provides the most accurate time
and least jitter of any other scheme. There is no need to configure a
dedicated device for this purpose, which ordinarily is the device used
for the associated radio clock.
<p>The second way uses the <code>LDISC_CLKPPS</code> line discipline and
works for any architecture supporting a serial port. In order to use
this option, the -DCLK flag must be included in the
<code>DEFS_LOCAL</code> line of the distribution configuration file
<code>./Config.local</code>. If after a few seconds this driver finds no
<code>ppsclock</code> module configured, it attempts to open a serial
port device <code>/dev/pps%d</code>, where <code>%d</code> is the unit
number, and assign the LDISC_CLKPPS line discipline to it. If the line
discipline fails, no harm is done except the accuracy is reduced
somewhat. The pulse generator in the gadget box must be adjusted to
produce a start bit of length 26 usec at 38400 bps. Used with the
<code>LDISC_CLKPPS</code> line discipline, this produces an ASCII DEL
character ('\377') followed by a timestamp at the on-time transition of
the PPS signal.
<p>The third way involves an auxiliary radio clock driver which calls
the PPS driver with a timestamp captured by that driver. This use is
documented in the source code for the driver(s) involved.
<p><h4>Fudge Factors</h4>
<dl>
<dt><code>time1 <i>time</i></code>
<dd>Specifies the time offset calibration factor, in seconds and
fraction, with default 0.0. This parameter can be used to compensate for
the UART and OS delays. Allow about 247 us for UART delays at 38400 bps
and about 1 ms for SunOS streams nonsense.
<p><dt><code>time2 <i>time</i></code>
<dd>Not used by this driver.
<p><dt><code>stratum <i>number</i></code>
<dd>Specifies the driver stratum, in decimal from 0 to 15, with default
0.
<p><dt><code>refid <i>string</i></code>
<dd>Specifies the driver reference identifier, an ASCII string from one
to four characters, with default <code>ATOM</code>.
<p><dt><code>flag1 0 | 1</code>
<dd>Not used by this driver.
<p><dt><code>flag2 0 | 1</code>
<dd>Not used by this driver.
<p><dt><code>flag3 0 | 1</code>
<dd>Enable <code>ppsclock</code> line discipline/streams module if set.
<p><dt><code>flag4 0 | 1</code>
<dd>Not used by this driver.
<p>Additional Information
<p><a href="refclock.html"> Reference Clock Drivers</a>
</dl>
<hr><address>David L. Mills (mills@udel.edu)</address></body></html>