xref: /freebsd/contrib/ntp/html/drivers/driver8.html (revision 5f4c09dd85bff675e0ca63c55ea3c517e0fddfcc)
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<html>
4
5  <head>
6    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
7    <title>Generic Reference Driver</title>
8    <link href="scripts/style.css" type="text/css" rel="stylesheet">
9  </head>
10
11  <body>
12    <h3>Generic Reference Driver</h3>
13<p>Last update:
14  <!-- #BeginDate format:En2m -->27-Jan-2014  05:31<!-- #EndDate -->
15  UTC</p>
16    <hr>
17    <h4>Synopsis</h4>
18    Address: 127.127.8.<em>u</em><br>
19    Reference ID: PARSE<br>
20    Driver ID: GENERIC<br>
21    Serial Port: /dev/refclock-<em>u</em>; TTY mode according to clock type<br>
22    PPS device: /dev/refclockpps-<em>u</em>; alternate PPS device (if not available via the serial port)
23    <h4>Description</h4>
24    The PARSE driver supports 20 different clock types/configurations. PARSE is actually a multi-clock driver.<br>
25    <br>
26    <p>The  actual receiver status is mapped into various synchronization states  generally used by receivers. The driver is configured to interpret the  time codes of Meinberg DCF77 AM receivers, DCF77 FM receivers, Meinberg  GPS16x/17x receivers, Trimble SV6 GPS, ELV DCF7000, Schmid, Wharton  400A and low cost receivers (see <a href="imap://mills@mail.eecis.udel.edu:993/fetch%3EUID%3E.INBOX%3E67132?part=1.3&type=text/html&filename=driver8.html#clocklist">list below</a>).</p>
27    <p>The  reference clock support in NTP contains the necessary configuration  tables for those receivers. In addition to supporting several different  clock types and up to 4 devices, the processing of a PPS signal is also  provided as a configuration option. The PPS configuration option uses  the receiver-generated time stamps for feeding the PPS loopfilter  control for much finer clock synchronization.</p>
28    <p>CAUTION: The  PPS configuration option is different from the hardware PPS signal,  which is also supported (see below), as it controls the way ntpd is  synchronized to the reference clock, while the hardware PPS signal  controls the way time offsets are determined.</p>
29    <p>The use of the PPS option requires receivers with an accuracy of better than 1ms.</p>
30    <h4>Timecode variables listed by ntpq (8)</h4>
31    <p>The ntpq program can read and display several clock variables. These hold the following information:</p>
32    <dl>
33      <dt>refclock_format</dt>
34      <dd>A qualification of the decoded time code format.</dd>
35      <dt>refclock_states</dt>
36      <dd>The overall running time and the accumulated times for the clock event states.</dd>
37      <dt>refclock_status</dt>
38      <dd>Lists the currently active receiver flags. Additional feature flags for the receiver are optionally listed in parentheses.</dd>
39      <dt>refclock_time</dt>
40      <dd>The local time with the offset to UTC (format HHMM).</dd>
41      <dt>timecode</dt>
42      <dd>The actual time code.</dd>
43    </dl>
44    <p>If PPS information is present, additional variables are available:</p>
45    <dl>
46      <dt>refclock_ppsskew</dt>
47      <dd>The difference between the RS-232-derived timestamp and the PPS timestamp.</dd>
48      <dt>refclock_ppstime</dt>
49      <dd>The PPS timestamp.</dd>
50    </dl>
51    <h4>Supported Devices</h4>
52    <p>Currently, twenty-four clock types are supported by the PARSE driver and up to four (devices /dev/refclock-0 - /dev/refclock-3) of these clocks may be operational at any one time.<br>
53      A note on the implementations:</p>
54    <ul>
55      <li>These  implementations were mainly done without actual access to the hardware,  thus not all implementations provide full support. The development was  done with the help of many kind souls who had the hardware and kindly  lent me their time and patience during the development and debugging  cycle. Thus for continued support and quality, direct access to the  receivers is a big help. Nevertheless I am not prepared to buy these  reference clocks - donations to (<a href="mailto:kardel%20%3CAT%3E%20ntp.org">kardel &lt;AT&gt; ntp.org</a>) are welcome as long as they work within Europe 8-).
56	<p>Verified implementations are:</p>
57	<ul>
58	  <li>RAWDCF variants
59	    <p>These variants have been tested for correct decoding with my own homegrown  receivers. Interfacing with specific commercial products may involve  some fiddling with cables. In particular, commercial RAWDCF receivers  have a seemingly unlimited number of ways to draw power from the RS-232  port and to encode the DCF77 datastream. You are mainly on your own  here unless I have a sample of the receiver.</p>
60	  </li>
61	  <li><a href="http://www.meinberg.de">Meinberg clocks</a>
62            <p>These implementations have been verified by the Meinberg people themselves and I have access to one of these clocks.</p>
63	  </li>
64	  <li><a href="http://www.selinc.com">Schweitzer Engineering
65	      Laboratories SEL-240x clocks</a>
66            <p>This implementation was provided and verified by SEL and <a
67		href="http://networktimefoundation.org">Network Time Foundation</a>
68	      has an SEL-2407 in one of its development labs.</p>
69	  </li>
70	</ul>
71      </li>
72    </ul>
73    <p>The pictures below have been taken from and are linked to the vendors' web pages.</p>
74    <a name="clocklist"></a>
75    <ul>
76      <li><strong>server 127.127.8.0-3 mode 0</strong>
77	<p><strong><a href="http://www.meinberg.de">Meinberg</a> <a href="http://www.meinberg.de/english/products/timesource.htm#dcf---freq_sync">PZF5xx receiver family</a> (FM demodulation/TCXO / 50&mu;s)</strong><br>
78          <br>
79	</p>
80      </li>
81      <li><strong>server 127.127.8.0-3 mode 1</strong>
82	<p><strong><a href="http://www.meinberg.de">Meinberg</a> <a href="http://www.meinberg.de/english/products/timesource.htm#dcf---freq_sync">PZF5xx receiver family</a> (FM demodulation/OCXO / 50&mu;s)</strong><br>
83          <a href="http://www.meinberg.de/english/products/pzf-eurocard.htm"><img src="../pic/pzf511.jpg" alt="Image PZF511" align="top" border="0" height="300" width="260"></a><br>
84          <br>
85	</p>
86      </li>
87      <li><a name="mode2"></a><strong>server 127.127.8.0-3 mode 2</strong>
88	<p><strong><a href="http://www.meinberg.de">Meinberg</a> <a href="http://www.meinberg.de/english/products/c51.htm">DCF C51 receiver and similar</a> (AM demodulation / 4ms)</strong><br>
89          <a href="http://www.meinberg.de/english/products/c51.htm"><img src="../pic/c51.jpg" alt="Image C51" align="top" border="0" height="239" width="330"></a><br>
90	</p>
91	<p>This mode expects the Meinberg standard time string format with 9600/7E2.</p>
92	<p><strong>Note:</strong> mode 2 must also be used for <a href="http://www.meinberg.de/english/products/formfactor.htm#slot_card">Meinberg PCI cards</a> under Linux, e.g. <a href="http://www.meinberg.de/english/products/gps-pcicard.htm">the GPS PCI card</a> or <a href="http://www.meinberg.de/english/products/dcf-pcicard.htm">the DCF77 PCI card</a>. Please note the <a href="http://www.meinberg.de/english/sw/#linux">Meinberg Linux driver</a> must be installed. That driver emulates a refclock device in order to  allow ntpd to access those cards. For details, please refer to the  README file that comes with the Meinberg driver package.<br>
93          <br>
94	</p>
95      </li>
96      <li><strong>server 127.127.8.0-3 mode 3</strong>
97	<p><strong><a href="http://www.elv.de">ELV</a> DCF7000 (sloppy AM demodulation / 50ms)</strong><br>
98          <br>
99	</p>
100      </li>
101      <li><strong>server 127.127.8.0-3 mode 4</strong>
102	<p><strong>Walter Schmid DCF receiver Kit (AM demodulation / 1ms)</strong><br>
103          <br>
104	</p>
105      </li>
106      <li><strong>server 127.127.8.0-3 mode 5</strong>
107	<p><strong>RAW DCF77 100/200ms pulses (Conrad DCF77 receiver module / 5ms)</strong><br>
108          <br>
109	</p>
110      </li>
111      <li><strong>server 127.127.8.0-3 mode 6</strong>
112	<p><strong>RAW DCF77 100/200ms pulses (TimeBrick DCF77 receiver module / 5ms)</strong><br>
113          <br>
114	</p>
115      </li>
116      <li><strong>server 127.127.8.0-3 mode 7</strong>
117	<p><strong><a href="http://www.meinberg.de">Meinberg</a> <a href="http://www.meinberg.de/english/products/timesource.htm#gps---freq_sync">GPS16x/GPS17x receivers</a> (GPS / &lt;&lt;1&mu;s)</strong><br>
118          <a href="http://www.meinberg.de/english/products/gps-eurocard.htm"><img src="../pic/gps167.jpg" alt="Image GPS167" align="top" border="0" height="300" width="280"></a><br>
119	</p>
120	<p>This mode expects either the University of Erlangen time string format or the Meinberg standard time string format at 19200/8N1.</p>
121	<p>The  University of Erlangen format is preferred. Newer Meinberg GPS  receivers can be configured to transmit that format; for older devices,  a special firmware version may be available.</p>
122	<p>In this mode some additional GPS receiver status information is also read. However, this requires a point-to-point connection. <a href="imap://mills@mail.eecis.udel.edu:993/fetch%3EUID%3E.INBOX%3E67132?part=1.3&type=text/html&filename=driver8.html#mode18">Mode 18</a> should be used if the device is accessed by a multidrop connection.</p>
123	<p><strong>Note:</strong> mode 7 must not be used with Meinberg PCI cards; use <a href="imap://mills@mail.eecis.udel.edu:993/fetch%3EUID%3E.INBOX%3E67132?part=1.3&type=text/html&filename=driver8.html#mode2">mode 2</a> instead.<br>
124          <br>
125	</p>
126      </li>
127      <li><strong>server 127.127.8.0-3 mode 8</strong>
128	<p><strong><a href="http://www.igel.de">IGEL</a> <a href="http://www.igel.de/eigelmn.html">clock</a></strong><br>
129          <a href="http://www.igel.de/eigelmn.html"><img src="../pic/igclock.gif" alt="Image IGEL clock" border="0" height="174" width="200"></a><br>
130          <br>
131	</p>
132      </li>
133      <li><strong>server 127.127.8.0-3 mode 9</strong>
134	<p><strong><a href="http://www.trimble.com">Trimble</a> <a href="http://www.trimble.com/cgi/omprod.cgi/pd_om011.html">SVeeSix GPS receiver</a> TAIP protocol (GPS / &lt;&lt;1&mu;s)</strong><br>
135          <br>
136	</p>
137      </li>
138      <li><strong>server 127.127.8.0-3 mode 10</strong>
139	<p><strong><a href="http://www.trimble.com">Trimble</a> <a href="http://www.trimble.com/cgi/omprod.cgi/pd_om011.html">SVeeSix GPS receiver</a> TSIP protocol (GPS / &lt;&lt;1&mu;s) (no kernel support yet)</strong><br>
140          <a href="http://www.trimble.com/cgi/omprod.cgi/pd_om011.html"><img src="../pic/pd_om011.gif" alt="Image SVeeSix-CM3" align="top" border="0" height="100" width="420"></a><br>
141          <a href="http://www.trimble.com/cgi/omprod.cgi/pd_om006.html"><img src="../pic/pd_om006.gif" alt="Image Lassen-SK8" border="0" height="100" width="420"></a><br>
142          <br>
143	</p>
144      </li>
145      <li><strong>server 127.127.8.0-3 mode 11</strong>
146	<p><strong>Radiocode Clocks Ltd RCC 8000 Intelligent Off-Air Master Clock support </strong><br>
147          <br>
148	</p>
149      </li>
150      <li><strong>server 127.127.8.0-3 mode 12</strong>
151	<p><strong><a href="http://www.hopf-time.com">HOPF</a> <a href="http://www.hopf-time.com/kart6021.html">Funkuhr 6021</a></strong><br>
152          <a href="http://www.hopf-time.com/engl/kart6021.html"><img src="../pic/fg6021.gif" alt="Image DCF77 Interface Board" align="top" border="0" height="207" width="238"></a><br>
153          <br>
154	</p>
155      </li>
156      <li><strong>server 127.127.8.0-3 mode 13</strong>
157	<p><strong>Diem's Computime Radio Clock</strong><br>
158          <br>
159	</p>
160      </li>
161      <li><strong>server 127.127.8.0-3 mode 14</strong>
162	<p><strong>RAWDCF receiver (DTR=high/RTS=low)</strong><br>
163          <br>
164	</p>
165      </li>
166      <li><strong>server 127.127.8.0-3 mode 15</strong>
167	<p><strong>WHARTON 400A Series Clocks with a 404.2 Serial Interface</strong><br>
168          <br>
169	</p>
170      </li>
171      <li><strong>server 127.127.8.0-3 mode 16</strong>
172	<p><strong>RAWDCF receiver (DTR=low/RTS=high) </strong><br>
173          <br>
174	</p>
175      </li>
176      <li><strong>server 127.127.8.0-3 mode 17</strong>
177	<p><strong>VARITEXT Receiver (MSF) </strong><br>
178          <br>
179	</p>
180      </li>
181      <li><a name="mode18"></a><strong>server 127.127.8.0-3 mode 18</strong>
182	<p><strong><a href="http://www.meinberg.de">Meinberg </a><a href="http://www.meinberg.de/english/products/timesource.htm#gps---freq_sync">GPS16x/GPS17x receivers</a> (GPS / &lt;&lt;1&mu;s)</strong><br>
183	</p>
184	<p>This  mode works without additional data communication (version, GPS status  etc.) and thus should be used with multidrop, heterogeneous multiclient  operation.</p>
185	<p><strong>Note:</strong> mode 18 must not be used with Meinberg PCI cards, use mode 2 instead.<br>
186          <br>
187	</p>
188      </li>
189      <li><strong>server 127.127.8.0-3 mode 19</strong>
190	<p><strong>Gude Analog- und Digitalsystem GmbH 'Expert mouseCLOCK USB v2.0'</strong><br>
191          <br>
192	</p>
193      </li>
194      <li><strong>server 127.127.8.0-3 mode 20</strong>
195	<p><strong>RAWDCF receiver similar to mode 14, but operating @ 75 baud (DTR=high/RTS=low)</strong><br>
196	</p>
197	<p>Driving  the DCF clocks at 75 baud may help to get them to work with a bunch of  common USB serial converters, that do 75 but cannot do 50 baud at all,  e.g. those based on Prolific PL2303. <br>
198	</p>
199      </li>
200      <li><strong>server 127.127.8.0-3 mode 21</strong>
201	<p><strong>RAWDCF receiver similar to mode 16, but operating @ 75 baud (DTR=low/RTS=high) </strong><br>
202	</p>
203	<p>See comment from mode 20 clock. <br>
204	</p>
205      </li>
206      <li><strong>server 127.127.8.0-3 mode 22</strong>
207	<p><strong>MEINBERG, mode 2 but with POWERUP trust </strong><br>
208	</p>
209      </li>
210      <li><strong>server 127.127.8.0-3 mode 23</strong>
211	<p><strong>MEINBERG, mode 7 but with POWERUP trust </strong><br>
212	</p>
213      </li>
214      <li><strong>server 127.127.8.0-3 mode 24</strong>
215	<p><strong><a href="http://www.selinc.com/">Schweitzer Engineering Laboratories</a></strong><br>
216	</p>
217      </li>
218    </ul>
219    <p>Actual data formats and setup requirements of the various clocks can be found in <a href="../parsedata.html">NTP PARSE clock data formats</a>.</p>
220    <h4>Operation</h4>
221    <p>The  reference clock support software carefully monitors the state  transitions of the receiver. All state changes and exceptional events  (such as loss of time code transmission) are logged via the syslog  facility. Every hour a summary of the accumulated times for the clock  states is listed via syslog.</p>
222    <p>PPS support is only available  when the receiver is completely synchronized. The receiver is believed  to deliver correct time for an additional period of time after losing  synchronization, unless a disruption in time code transmission is  detected (possible power loss). The trust period is dependent on the  receiver oscillator and thus is a function of clock type.</p>
223    <p>Raw  DCF77 pulses can be fed via a level converter to the RXD pin of an  RS-232 serial port (pin 3 of a 25-pin connector or pin 2 of a 9-pin  connector). The telegrams are decoded and used for synchronization.  DCF77 AM receivers can be bought for as little as $25. The accuracy is  dependent on the receiver and is somewhere between 2ms (expensive) and  10ms (cheap). Synchronization ceases when reception of the DCF77 signal  deteriorates, since no backup oscillator is available as usually found  in other reference clock receivers. So it is important to have a good  place for the DCF77 antenna. During transmitter shutdowns you are out  of luck unless you have other NTP servers with alternate time sources  available.</p>
224    <p>In addition to the PPS loopfilter control, a true  PPS hardware signal can be utilized via the PPSAPI interface. PPS  pulses are usually fed via a level converter to the DCD pin of an  RS-232 serial port (pin 8 of a 25-pin connector or pin 1 of a 9-pin  connector). To select PPS support, the mode parameter is the mode value  as above plus 128. If 128 is not added to the mode value, PPS will be  detected to be available but will not be used. </p>
225    <h4>Hardware PPS support<br>
226    </h4>
227    <p>For PPS to be used, add 128 to the mode parameter.</p>
228    <p>If  the PPS signal is fed in from a device different from the device  providing the serial communication (/dev/refclock-{0..3}), this device  is configured as /dev/refclockpps-{0..3}. This allows the PPS  information to be fed in e.g. via the parallel port (if supported by  the underlying operation system) and the date/time telegrams to be  handled via the serial port.</p>
229    <h4>Monitor Data</h4>
230    <p>Clock  state statistics are written hourly to the syslog service. Online  information can be found by examining the clock variables via the ntpq cv command.<br>
231      Some devices have quite extensive additional information  (GPS16x/GPS17x, Trimble). The driver reads out much of the internal GPS  data and makes it accessible via clock variables. To find out about  additional variable names, query for the clock_var_list variable on a  specific clock association as shown below. </p>
232    <p>First let ntpq display the table of associations:</p>
233    <pre>  ntpq&gt; as    ind assID status  conf reach auth condition  last_event cnt    ===========================================================      1 19556  9154   yes   yes  none falsetick   reachable  5      2 19557  9435   yes   yes  none  candidat  clock expt  3      3 19558  9714   yes   yes  none  pps.peer   reachable  1  		</pre>
234    <p>Then  switch to raw output. This may be required because of display  limitations in ntpq/ntpd - so large lists need to be retrieved in  several queries.</p>
235    <pre>  ntpq&gt; raw    Output set to raw  		</pre>
236    <p>Use the cv command to read the list of clock variables of a selected association:</p>
237    <pre>  ntpq&gt; cv 19557 clock_var_list  		</pre>
238    <p>The long output of the command above looks similar to:</p>
239    <pre>  assID=19557 status=0x0000,    clock_var_list="type,timecode,poll,noreply,badformat,baddata,fudgetime1,    fudgetime2,stratum,refid,flags,device,clock_var_list,refclock_time,refclock_status,    refclock_format,refclock_states,refclock_id,refclock_iomode,refclock_driver_version,    meinberg_gps_status,gps_utc_correction,gps_message,meinberg_antenna_status,gps_tot_51,    gps_tot_63,gps_t0a,gps_cfg[1],gps_health[1],gps_cfg[2],gps_health[2],gps_cfg[3],    gps_health[3],gps_cfg[4],gps_health[4],gps_cfg[5]"  		</pre>
240    <p>Then use the cv command again to list selected clock variables. The following command must be entered as a single line:</p>
241    <pre>  ntpq&gt; cv 19557 refclock_status,refclock_format,refclock_states,refclock_id,    refclock_iomode,refclock_driver_version,meinberg_gps_status,gps_utc_correction,    gps_message,meinberg_antenna_status,gps_tot_51,gps_tot_63,gps_t0a,gps_cfg[1],    gps_health[1],gps_cfg[2],gps_health[2],gps_cfg[3],gps_health[3],gps_cfg[4],    gps_health[4],gps_cfg[5]  		</pre>
242    <p>The output of the command above is wrapped around depending on the screen width and looks similar to:</p>
243    <pre>  status=0x0003,    refclock_status="UTC DISPLAY; TIME CODE; PPS; POSITION; (LEAP INDICATION;    PPS SIGNAL; POSITION)",    refclock_format="Meinberg GPS Extended",    refclock_states="*NOMINAL: 21:21:36 (99.99%); FAULT: 00:00:03 (0.00%);    running time: 21:21:39",    refclock_id="GPS", refclock_iomode="normal",    refclock_driver_version="refclock_parse.c,v 4.77 2006/08/05 07:44:49    kardel RELEASE_20060805_A",    meinberg_gps_status="[0x0000] &lt;OK&gt;",    gps_utc_correction="current correction 14 sec, last correction    on c7619a00.00000000  Sun, Jan  1 2006  0:00:00.000",    gps_message="/PFU3SOP-4WG14EPU0V1KA",    meinberg_antenna_status="RECONNECTED on 2006-07-18 08:13:20.0000000 (+0000)    UTC CORR, LOCAL TIME, reconnect clockoffset +0.0000000 s,    disconnect time 0000-00-00 00:00:00.0000000 (+0000) ",    gps_tot_51="week 1400 + 3 days + 42300.0000000 sec",    gps_tot_63="week 1400 + 3 days + 42294.0000000 sec",    gps_t0a="week 1400 + 5 days + 71808.0000000 sec",    gps_cfg[1]="[0x9] BLOCK II", gps_health[1]="[0x0] OK;SIGNAL OK",    gps_cfg[2]="[0x0] BLOCK I", gps_health[2]="[0x3f] PARITY;MULTIPLE ERRS",    gps_cfg[3]="[0x9] BLOCK II", gps_health[3]="[0x0] OK;SIGNAL OK",    gps_cfg[4]="[0x9] BLOCK II", gps_health[6]="[0x0] OK;SIGNAL OK",    gps_cfg[5]="[0x9] BLOCK II"  		</pre>
244    <h4>Fudge Factors</h4>
245    <dl>
246      <dt>time1 <em>time</em> </dt>
247      <dd>Specifies the time offset calibration factor, in seconds and fraction. The default value depends on the clock type. </dd>
248      <dt>time2 <em>time</em> </dt>
249      <dd> If flag1 is 0, time2 specifies the offset of the PPS signal from the actual time (PPS fine tuning). </dd>
250      <dd> If flag1 is 1, time2 specifies the number of seconds a receiver with a  premium local oscillator can be trusted after losing synchronisation. </dd>
251      <dt>stratum <em>stratum</em> </dt>
252      <dd>The stratum for this reference clock. </dd>
253      <dt>refid <em>refid</em> </dt>
254      <dd>The refid for this reference clock. </dd>
255    </dl>
256    <dl>
257      <dt>flag1 { 0 | 1 } </dt>
258      <dd>If 0, the fudge factor time2 refers to the PPS offset. </dd>
259      <dd>If 1, time2 refers to the TRUST TIME. </dd>
260      <dt>flag2 { 0 | 1 } </dt>
261      <dd>If flag2 is 1, sample PPS on CLEAR instead of on ASSERT. </dd>
262      <dt>flag3 { 0 | 1 } </dt>
263      <dd>If flag3 is 1, link kernel PPS tracking to this refclock instance. </dd>
264      <dt>flag4 { 0 | 1 } </dt>
265      <dd>Delete next leap second instead of adding it. (You'll need to wait a bit for that to happen 8-) </dd>
266    </dl>
267    Note about auxiliary Sun STREAMS modules (SunOS and Solaris):<br>
268    <dl>
269      <dt>The  timecode of these receivers can be sampled via a STREAMS module in the  kernel. (The STREAMS module has been designed for use with Sun systems  under SunOS 4.1.x or Solaris 2.3 - 2.8. It can be linked directly into  the kernel or loaded via the loadable driver mechanism.) This STREAMS  module can be adapted to convert different time code formats. Nowadays  the PPSAPI mechanism is usually used. </dt>
270    </dl>
271    <h4>Making your own PARSE clocks</h4>
272    <p>The parse  clock mechanism deviates from the way other NTP reference clocks work.  For a short description of how to build parse reference clocks, see <a href="../parsenew.html">making PARSE clocks</a>.</p>
273    <p>Additional Information</p>
274    <p><a href="../refclock.html">Reference Clock Drivers</a></p>
275    <hr>
276    <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
277  </body>
278</html>
279