freebsd-dev/contrib/ntp/html/driver22.htm
1999-12-09 13:01:21 +00:00

130 lines
4.1 KiB
HTML

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.01 [en] (Win95; I) [Netscape]">
<TITLE>PPS Clock Discipline
</TITLE>
</HEAD>
<BODY>
<H3>
PPS Clock Discipline</H3>
<HR>
<H4>
Synopsis</H4>
Address: 127.127.22.<I>u</I>
<BR>Reference ID: <TT>PPS</TT>
<BR>Driver ID: <TT>PPS</TT>
<BR>Serial Port: <TT>/dev/pps<I>u</I></TT>; 9600 baud, 8-bits, no parity
<BR>Features: <TT>tty_clk</TT>
<H4>
Description</H4>
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.htm">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 <TT>ppsclock</TT> line discipline and works only for the baseboard
serial ports of the Sun SPARCstation running SunOS 4.x. The PPS signal
is connected via the gadget box to the carrier detect (DCD) line of a serial
port. The signal is activated for this port by a <TT>fudge flag3 1</TT>
command following the <TT>server</TT> command in the configuration file.
This causes the <TT>ppsclock</TT> 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 <TT>ioctl()</TT>
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 <TT>tty_clk</TT> line discipline and works for
any architecture supporting a serial port. If after a few seconds this
driver finds no <TT>ppsclock</TT> module configured, it attempts to open
a serial port device <TT>/dev/pps%d</TT>, where <TT>%d</TT> is the unit
number, and assign the <TT>tty_clk</TT> 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 <TT>tty_clk</TT> 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.
<H4>
Fudge Factors</H4>
<DL>
<DT>
<TT>time1 <I>time</I></TT></DT>
<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.</DD>
<DT>
<TT>time2 <I>time</I></TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>stratum <I>number</I></TT></DT>
<DD>
Specifies the driver stratum, in decimal from 0 to 15, with default 0.</DD>
<DT>
<TT>refid <I>string</I></TT></DT>
<DD>
Specifies the driver reference identifier, an ASCII string from one to
four characters, with default <TT>PPS</TT>.</DD>
<DT>
<TT>flag1 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>flag2 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>flag3 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<DT>
<TT>flag4 0 | 1</TT></DT>
<DD>
Not used by this driver.</DD>
<P>Additional Information
<P><A HREF="refclock.htm">Reference Clock Drivers</A></DL>
<HR>
<ADDRESS>
David L. Mills (mills@udel.edu)</ADDRESS>
</BODY>
</HTML>