xref: /freebsd/contrib/ntp/html/drivers/driver20.html (revision 2d4e511ca269f1908d27f4e5779c53475527391d)
19c2daa00SOllivier Robert<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
22b15cb3dSCy Schubert<html><head>
32b15cb3dSCy Schubert    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Generic NMEA GPS Receiver</title>
4*2d4e511cSCy Schubert    <!-- Changed by: Pearly &, 04-Feb-2019 -->
5ea906c41SOllivier Robert    <link href="scripts/style.css" type="text/css" rel="stylesheet">
62b15cb3dSCy Schubert    <style type="text/css">
72b15cb3dSCy Schubert      table.dlstable { font-size:85%; }
82b15cb3dSCy Schubert      td.ttf{ font-family:Courier; font-weight:bold; }
92b15cb3dSCy Schubert    </style></head>
102b15cb3dSCy Schubert
112b15cb3dSCy Schubert
129c2daa00SOllivier Robert
139c2daa00SOllivier Robert  <body>
149c2daa00SOllivier Robert    <h3>Generic NMEA GPS Receiver</h3>
152b15cb3dSCy Schubert<p>Last update:
16*2d4e511cSCy Schubert  <!-- #BeginDate format:En2m -->13-Jan-2020  07:12<!-- #EndDate -->
172b15cb3dSCy Schubert  UTC</p>
189c2daa00SOllivier Robert    <hr>
199c2daa00SOllivier Robert    <h4>Synopsis</h4>
202b15cb3dSCy Schubert
212b15cb3dSCy Schubert    <p>
222b15cb3dSCy Schubert      Address: 127.127.20.<i>u</i><br>
239c2daa00SOllivier Robert      Reference ID: <tt>GPS</tt><br>
249c2daa00SOllivier Robert      Driver ID: <tt>GPS_NMEA</tt><br>
252b15cb3dSCy Schubert      Serial Port: <tt>/dev/gps<i>u</i></tt>; 4800 - 115200 bps, 8-bits, no parity<br>
262b15cb3dSCy Schubert      Serial Port: <tt>/dev/gpspps<i>u</i></tt>; for just the PPS signal (this
272b15cb3dSCy Schubert      is tried first for PPS, before <tt>/dev/gps<i>u</i></tt>)<br>
282b15cb3dSCy Schubert      Serial Port: <tt>/dev/gps<i>u</i></tt>; symlink to server:port (for nmead)<br>
292b15cb3dSCy Schubert      Features: <tt>tty_clk</tt>
302b15cb3dSCy Schubert    </p>
319c2daa00SOllivier Robert
322b15cb3dSCy Schubert    <h4>Description</h4>
332b15cb3dSCy Schubert
342b15cb3dSCy Schubert    <p>
352b15cb3dSCy Schubert      This driver supports GPS receivers with
362b15cb3dSCy Schubert      the <tt>$GPRMC</tt>, <tt>$GPGLL</tt>, <tt>$GPGGA</tt>, <tt>$GPZDA</tt>
372b15cb3dSCy Schubert      and <tt>$GPZDG</tt> NMEA sentences by default.&nbsp; Note that Accord's
382b15cb3dSCy Schubert      custom NMEA sentence <tt>$GPZDG</tt> reports using the GPS timescale,
392b15cb3dSCy Schubert      while the rest of the sentences report UTC.&nbsp; The difference between
402b15cb3dSCy Schubert      the two is a whole number of seconds which increases with each leap
412b15cb3dSCy Schubert      second insertion in UTC.&nbsp; To avoid problems mixing UTC and GPS
422b15cb3dSCy Schubert      timescales, the driver disables processing of UTC sentences
432b15cb3dSCy Schubert      once <tt>$GPZDG</tt> is received.
44*2d4e511cSCy Schubert      <br>
45*2d4e511cSCy Schubert      <strong>Caveat:</strong> Please see <a href="#talkerids">Talker
46*2d4e511cSCy Schubert      IDs</a> when using non-GPS or multi-system receivers.
472b15cb3dSCy Schubert    </p>
482b15cb3dSCy Schubert    <p>
492b15cb3dSCy Schubert      The driver expects the receiver to be set up to transmit at least one
502b15cb3dSCy Schubert      supported sentence every second.
512b15cb3dSCy Schubert    </p>
522b15cb3dSCy Schubert    <p>
532b15cb3dSCy Schubert      The accuracy depends on the receiver used. Inexpensive GPS models are
542b15cb3dSCy Schubert      available with a claimed PPS signal accuracy of
552b15cb3dSCy Schubert      1 &mu;s or better relative to the broadcast
562b15cb3dSCy Schubert      signal. However, in most cases the actual accuracy is limited by the
572b15cb3dSCy Schubert      precision of the timecode and the latencies of the serial interface and
582b15cb3dSCy Schubert      operating system.
592b15cb3dSCy Schubert    </p>
602b15cb3dSCy Schubert    <p>
612b15cb3dSCy Schubert      If the Operating System supports PPSAPI
622b15cb3dSCy Schubert      (<a href="http://www.ietf.org/rfc/rfc2783.txt">RFC 2783</a>), fudge flag1
632b15cb3dSCy Schubert      1 enables its use.
642b15cb3dSCy Schubert    </p>
652b15cb3dSCy Schubert    <p>
662b15cb3dSCy Schubert      The various GPS sentences that this driver recognises look like this:<br>
672b15cb3dSCy Schubert      (others quietly ignored)
682b15cb3dSCy Schubert    </p>
692b15cb3dSCy Schubert
702b15cb3dSCy Schubert    <p><table class="dlstable" border="1">
712b15cb3dSCy Schubert      <caption>Accepted NMEA sentences</caption>
722b15cb3dSCy Schubert      <tbody><tr>
732b15cb3dSCy Schubert	<th>Sentence</th>
742b15cb3dSCy Schubert	<th>Vendor</th>
752b15cb3dSCy Schubert      </tr><tr>
762b15cb3dSCy Schubert	<td class="ttf">$GPRMC,UTC,POS_STAT,LAT,LAT_REF,LON,LON_REF,SPD,HDG,DATE,MAG_VAR,MAG_REF*CS&lt;cr&gt;&lt;lf&gt;</td>
772b15cb3dSCy Schubert      </tr><tr>
782b15cb3dSCy Schubert	<td class="ttf">$GPGLL,LAT,LAT_REF,LON,LON_REF,UTC,POS_STAT*CS&lt;cr&gt;&lt;lf&gt;</td>
792b15cb3dSCy Schubert      </tr><tr>
802b15cb3dSCy Schubert	<td class="ttf">$GPGGA,UTC,LAT,LAT_REF,LON,LON_REF,FIX_MODE,SAT_USED,HDOP,ALT,ALT_UNIT,GEO,G_UNIT,D_AGE,D_REF*CS&lt;cr&gt;&lt;lf&gt;</td>
812b15cb3dSCy Schubert      </tr><tr>
822b15cb3dSCy Schubert	<td class="ttf">$GPZDA,UTC,DD,MM,YYYY,TH,TM,*CS&lt;cr&gt;&lt;lf&gt;</td>
832b15cb3dSCy Schubert      </tr><tr>
842b15cb3dSCy Schubert	<td class="ttf">$GPZDG,GPSTIME,DD,MM,YYYY,AA.BB,V*CS&lt;cr&gt;&lt;lf&gt;</td>
852b15cb3dSCy Schubert	<td>Accord</td>
86*2d4e511cSCy Schubert      </tr><tr>
87*2d4e511cSCy Schubert      </tr><tr>
88*2d4e511cSCy Schubert	<td class="ttf">$PGRMF,gpsWk,gpsTow,DATE,UTC,LEAPS,LAT,LAT_REF,LON,LON_REF,TYPE,MODE,SPD,HDOP,TDOP*CS&lt;cr&gt;&lt;lf&gt;</td>
89*2d4e511cSCy Schubert	<td>Garmin</td>
90*2d4e511cSCy Schubert      </tr><tr>
91*2d4e511cSCy Schubert	  <td class="ttf">$PUBX,04,UTC,DATE,utcTow,utcWk,LEAPS,clkBias,clkDrift,tpGran,*CS&lt;cr&gt;&lt;lf&gt;</td>
92*2d4e511cSCy Schubert	  <td>UBLOX</td>
932b15cb3dSCy Schubert      </tr>
942b15cb3dSCy Schubert    </tbody></table></p>
952b15cb3dSCy Schubert
962b15cb3dSCy Schubert    <p><table class="dlstable" border="1">
972b15cb3dSCy Schubert      <caption>NMEA data items</caption>
982b15cb3dSCy Schubert      <tbody><tr>
992b15cb3dSCy Schubert	<th>Symbol</th>
1002b15cb3dSCy Schubert	<th>Meaning and Format</th>
1012b15cb3dSCy Schubert      </tr>
1022b15cb3dSCy Schubert
1032b15cb3dSCy Schubert      <tr>
1042b15cb3dSCy Schubert	<td class="ttf">ALT</td>
1052b15cb3dSCy Schubert	<td>Antenna Altitude</td>
1062b15cb3dSCy Schubert      </tr><tr>
1072b15cb3dSCy Schubert	<td class="ttf">ALT_UNIT</td>
1082b15cb3dSCy Schubert	<td>Altitude Units (Metres/Feet)</td>
1092b15cb3dSCy Schubert      </tr><tr>
110*2d4e511cSCy Schubert	<td class="ttf">DATE</td>
111*2d4e511cSCy Schubert	<td>Date (ddmmyy)</td>
1122b15cb3dSCy Schubert      </tr><tr>
113*2d4e511cSCy Schubert	<td class="ttf">DD</td>
114*2d4e511cSCy Schubert	<td>Day of the month (1-31)</td>
1152b15cb3dSCy Schubert      </tr><tr>
1162b15cb3dSCy Schubert	<td class="ttf">D_AGE</td>
1172b15cb3dSCy Schubert	<td>Age of last DGPS Fix</td>
1182b15cb3dSCy Schubert      </tr><tr>
1192b15cb3dSCy Schubert	<td class="ttf">D_REF</td>
1202b15cb3dSCy Schubert	<td>Reference ID of DGPS station</td>
1212b15cb3dSCy Schubert      </tr><tr>
122*2d4e511cSCy Schubert	<td class="ttf">FIX_MODE</td>
123*2d4e511cSCy Schubert	<td>Position Fix Mode (0 = Invalid, &gt;0 = Valid)</td>
1242b15cb3dSCy Schubert      </tr><tr>
125*2d4e511cSCy Schubert	<td class="ttf">GEO</td>
126*2d4e511cSCy Schubert	<td>Geoid/Elipsoid separation</td>
127*2d4e511cSCy Schubert      </tr><tr>
128*2d4e511cSCy Schubert	<td class="ttf">GPSTIME</td>
129*2d4e511cSCy Schubert	<td>Time of day on GPS timescale. Hours, minutes and seconds [fraction (opt.)] (hhmmss[.f])</td>
130*2d4e511cSCy Schubert      </tr><tr>
131*2d4e511cSCy Schubert	<td class="ttf">gpsTow</td>
132*2d4e511cSCy Schubert	<td>GPS week time, seconds since start of GPS week (0..604799)</td>
133*2d4e511cSCy Schubert      </tr><tr>
134*2d4e511cSCy Schubert	<td class="ttf">gpsWk</td>
135*2d4e511cSCy Schubert	<td>Week number in the GPS time scale (may exceed 1024)</td>
136*2d4e511cSCy Schubert      </tr><tr>
137*2d4e511cSCy Schubert	<td class="ttf">G_UNIT</td>
138*2d4e511cSCy Schubert	<td>Geoid units (M/F)</td>
139*2d4e511cSCy Schubert      </tr><tr>
140*2d4e511cSCy Schubert	<td class="ttf">HDG</td>
141*2d4e511cSCy Schubert	<td>Heading/track made good (degrees True) (x.x)</td>
142*2d4e511cSCy Schubert      </tr><tr>
143*2d4e511cSCy Schubert	<td class="ttf">HDOP</td>
144*2d4e511cSCy Schubert	<td>Horizontal Dilution of Precision</td>
145*2d4e511cSCy Schubert      </tr><tr>
146*2d4e511cSCy Schubert	<td class="ttf">LAT</td>
147*2d4e511cSCy Schubert	<td>Latitude (llll.ll)</td>
148*2d4e511cSCy Schubert      </tr><tr>
149*2d4e511cSCy Schubert	<td class="ttf">LAT_REF</td>
150*2d4e511cSCy Schubert	<td>Latitude direction (N = North, S = South)</td>
151*2d4e511cSCy Schubert      </tr><tr>
152*2d4e511cSCy Schubert	<td class="ttf">LEAPS</td>
153*2d4e511cSCy Schubert	<td>Leap seconds or difference between GPS time scale and UTC</td>
154*2d4e511cSCy Schubert      </tr><tr>
155*2d4e511cSCy Schubert	<td class="ttf">LON</td>
156*2d4e511cSCy Schubert	<td>Longitude (yyyyy.yy)</td>
157*2d4e511cSCy Schubert      </tr><tr>
158*2d4e511cSCy Schubert	<td class="ttf">LON_REF</td>
159*2d4e511cSCy Schubert	<td>Longitude direction (E = East, W = West)</td>
160*2d4e511cSCy Schubert      </tr><tr>
161*2d4e511cSCy Schubert	<td class="ttf">MAG_REF</td>
162*2d4e511cSCy Schubert	<td>Magnetic variation (E = East, W = West)</td>
163*2d4e511cSCy Schubert      </tr><tr>
164*2d4e511cSCy Schubert	<td class="ttf">MAG_VAR</td>
165*2d4e511cSCy Schubert	<td>Magnetic variation (degrees) (x.x)</td>
1662b15cb3dSCy Schubert      </tr><tr>
1672b15cb3dSCy Schubert	<td class="ttf">MM</td>
1682b15cb3dSCy Schubert	<td>Month of the year (1-12)</td>
1692b15cb3dSCy Schubert      </tr><tr>
170*2d4e511cSCy Schubert	<td class="ttf">POS_STAT</td>
171*2d4e511cSCy Schubert	<td>Position status. (A = Data valid, V = Data invalid)</td>
172*2d4e511cSCy Schubert      </tr><tr>
173*2d4e511cSCy Schubert	<td class="ttf">SAT_USED</td>
174*2d4e511cSCy Schubert	<td>Number of Satellites used in solution</td>
175*2d4e511cSCy Schubert      </tr><tr>
176*2d4e511cSCy Schubert	<td class="ttf">SPD</td>
177*2d4e511cSCy Schubert	<td>Speed over ground. (knots) (x.x)</td>
178*2d4e511cSCy Schubert      </tr><tr>
179*2d4e511cSCy Schubert	<td class="ttf">UTC</td>
180*2d4e511cSCy Schubert	<td>Time of day on UTC timescale. Hours, minutes and seconds [fraction (opt.)] (hhmmss[.fff])</td>
181*2d4e511cSCy Schubert      </tr><tr>
1822b15cb3dSCy Schubert	<td class="ttf">YYYY</td>
1832b15cb3dSCy Schubert	<td>Year</td>
1842b15cb3dSCy Schubert      </tr><tr>
185*2d4e511cSCy Schubert	<td class="ttf">WEEK</td>
186*2d4e511cSCy Schubert	<td>GPS week (0-1023)</td>
187*2d4e511cSCy Schubert      </tr><tr>
188*2d4e511cSCy Schubert	<td class="ttf">WSEC</td>
189*2d4e511cSCy Schubert	<td>Seconds since start of week (0-604799)</td>
190*2d4e511cSCy Schubert      </tr><tr>
191*2d4e511cSCy Schubert	<td class="ttf">LEAP</td>
192*2d4e511cSCy Schubert	<td>GPS leap seconds, that is, seconds ahead of UTC</td>
193*2d4e511cSCy Schubert      </tr><tr>
1942b15cb3dSCy Schubert	<td class="ttf">AA.BB</td>
1952b15cb3dSCy Schubert	<td>Denotes the signal strength (should be &lt; 05.00)</td>
1962b15cb3dSCy Schubert      </tr><tr>
1972b15cb3dSCy Schubert	<td class="ttf">V</td>
1982b15cb3dSCy Schubert	<td>GPS sync status<br>
1992b15cb3dSCy Schubert	  &nbsp;&nbsp;&nbsp;'0' =&gt; INVALID time,<br>
2002b15cb3dSCy Schubert	  &nbsp;&nbsp;&nbsp;'1' =&gt; accuracy of +/- 20ms,<br>
2012b15cb3dSCy Schubert	  &nbsp;&nbsp;&nbsp;'2' =&gt; accuracy of +/- 100ns</td>
2022b15cb3dSCy Schubert      </tr><tr>
2032b15cb3dSCy Schubert	<td class="ttf">CS</td>
2042b15cb3dSCy Schubert	<td> Checksum</td>
2052b15cb3dSCy Schubert      </tr><tr>
2062b15cb3dSCy Schubert	<td class="ttf">&lt;cr&gt;&lt;lf&gt;</td>
2072b15cb3dSCy Schubert	<td>Sentence terminator.</td>
2082b15cb3dSCy Schubert      </tr>
2092b15cb3dSCy Schubert    </tbody></table></p>
2102b15cb3dSCy Schubert
2112b15cb3dSCy Schubert
212*2d4e511cSCy Schubert    <h4><a name="talkerids"/>NMEA Talker IDs</h4>
213*2d4e511cSCy Schubert
214*2d4e511cSCy Schubert    <p>
215*2d4e511cSCy Schubert      GNSS receivers use a distinct talker ID for the GNSS they
216*2d4e511cSCy Schubert      process. Receivers capable of tracking different systems at the same time
217*2d4e511cSCy Schubert      can emit <tt>$GPRMC</tt> (GPS), <tt>$GLRMC</tt> (GLONASS),
218*2d4e511cSCy Schubert      <tt>$GARMC</tt> (Galileo), <tt>$GNRMC</tt> (generic/combined) and others
219*2d4e511cSCy Schubert      all in one data stream.
220*2d4e511cSCy Schubert    </p><p>
221*2d4e511cSCy Schubert      The driver supports this to a certain degree by ignoring the
222*2d4e511cSCy Schubert      talker ID on the standard sentences RMC, GLL, GGA, ZDA and ZDG. (It
223*2d4e511cSCy Schubert      possibly should not do that on the latter, but for now, that's the way
224*2d4e511cSCy Schubert      it is.) So whenever <tt>$GPRMC</tt> is mentioned in this document,
225*2d4e511cSCy Schubert      substitute any possible talker ID your receiver might emit -- it will
226*2d4e511cSCy Schubert      still match.
227*2d4e511cSCy Schubert    </p><p>
228*2d4e511cSCy Schubert      This approach has a drawback. It is easy to use for single-system
229*2d4e511cSCy Schubert      receivers, but it cannot separate the data streams for multi-system
230*2d4e511cSCy Schubert      receiver modules. It is therefore undefined which GNSS actually
231*2d4e511cSCy Schubert      provides the data, and this can lead to strange behavior. This is
232*2d4e511cSCy Schubert      especially true if the different GNSS provide very different signal
233*2d4e511cSCy Schubert      quality to the receiver; the driver is not able to cherry-pick the best
234*2d4e511cSCy Schubert      source and might actually end up in using the worst available.  It is
235*2d4e511cSCy Schubert      therefore recommended to set up such a receiver to either use just a
236*2d4e511cSCy Schubert      single GNSS (which would defeat its purpose) or to emit only the
237*2d4e511cSCy Schubert      combined data, which usually has the <tt>GN</tt> talker ID defined by
238*2d4e511cSCy Schubert      the NMEA standard.
239*2d4e511cSCy Schubert    <p>
240*2d4e511cSCy Schubert
241*2d4e511cSCy Schubert
2422b15cb3dSCy Schubert    <h4>The 'mode' byte</h4>
2432b15cb3dSCy Schubert
2442b15cb3dSCy Schubert    <p>
2452b15cb3dSCy Schubert      Specific GPS sentences and bitrates may be selected by setting bits of
2462b15cb3dSCy Schubert      the 'mode' in the server configuration line:<br> &nbsp;&nbsp;<tt>server
2472b15cb3dSCy Schubert      127.127.20.x mode X</tt>
2482b15cb3dSCy Schubert    </p>
2492b15cb3dSCy Schubert
2502b15cb3dSCy Schubert    <table border="1">
2512b15cb3dSCy Schubert      <caption>mode byte bits and bit groups</caption>
2522b15cb3dSCy Schubert      <tbody><tr>
2532b15cb3dSCy Schubert	<th align="center">Bit</th>
2542b15cb3dSCy Schubert	<th align="center">Decimal</th>
2552b15cb3dSCy Schubert	<th align="center">Hex</th>
2562b15cb3dSCy Schubert	<th align="left">Meaning</th>
2572b15cb3dSCy Schubert      </tr>
2582b15cb3dSCy Schubert
2592b15cb3dSCy Schubert      <tr>
2602b15cb3dSCy Schubert	<td align="center">0</td>
2612b15cb3dSCy Schubert	<td align="center">1</td>
2622b15cb3dSCy Schubert	<td align="center">1</td>
263*2d4e511cSCy Schubert	<td>process <tt>$GPRMC</tt></td>
2642b15cb3dSCy Schubert      </tr><tr>
2652b15cb3dSCy Schubert	<td align="center">1</td>
2662b15cb3dSCy Schubert	<td align="center">2</td>
2672b15cb3dSCy Schubert	<td align="center">2</td>
2682b15cb3dSCy Schubert	<td>process <tt>$GPGGA</tt></td>
2692b15cb3dSCy Schubert      </tr><tr>
2702b15cb3dSCy Schubert	<td align="center">2</td>
2712b15cb3dSCy Schubert	<td align="center">4</td>
2722b15cb3dSCy Schubert	<td align="center">4</td>
2732b15cb3dSCy Schubert	<td>process <tt>$GPGLL</tt></td>
2742b15cb3dSCy Schubert      </tr><tr>
2752b15cb3dSCy Schubert	<td align="center">3</td>
2762b15cb3dSCy Schubert	<td align="center">8</td>
2772b15cb3dSCy Schubert	<td align="center">8</td>
2782b15cb3dSCy Schubert	<td>process <tt>$GPZDA</tt> or <tt>$GPZDG</tt></td>
2792b15cb3dSCy Schubert      </tr><tr>
2802b15cb3dSCy Schubert	<td rowspan="6" align="center">4-6</td>
2812b15cb3dSCy Schubert	<td align="center">0</td>
2822b15cb3dSCy Schubert	<td align="center">0</td>
2832b15cb3dSCy Schubert	<td>linespeed 4800 bps</td>
2842b15cb3dSCy Schubert      </tr><tr>
2852b15cb3dSCy Schubert	<td align="center">16</td>
2862b15cb3dSCy Schubert	<td align="center">0x10</td>
2872b15cb3dSCy Schubert	<td>linespeed 9600 bps</td>
2882b15cb3dSCy Schubert      </tr><tr>
2892b15cb3dSCy Schubert	<td align="center">32</td>
2902b15cb3dSCy Schubert	<td align="center">0x20</td>
2912b15cb3dSCy Schubert	<td>linespeed 19200 bps</td>
2922b15cb3dSCy Schubert      </tr><tr>
2932b15cb3dSCy Schubert	<td align="center">48</td>
2942b15cb3dSCy Schubert	<td align="center">0x30</td>
2952b15cb3dSCy Schubert	<td>linespeed 38400 bps</td>
2962b15cb3dSCy Schubert      </tr><tr>
2972b15cb3dSCy Schubert	<td align="center">64</td>
2982b15cb3dSCy Schubert	<td align="center">0x40</td>
2992b15cb3dSCy Schubert	<td>linespeed 57600 bps</td>
3002b15cb3dSCy Schubert      </tr><tr>
3012b15cb3dSCy Schubert	<td align="center">80</td>
3022b15cb3dSCy Schubert	<td align="center">0x50</td>
3032b15cb3dSCy Schubert	<td>linespeed 115200 bps</td>
3042b15cb3dSCy Schubert      </tr><tr>
3052b15cb3dSCy Schubert	<td align="center">7</td>
3062b15cb3dSCy Schubert	<td align="center">128</td>
3072b15cb3dSCy Schubert	<td align="center">0x80</td>
3082b15cb3dSCy Schubert	<td>Write the sub-second fraction of the receive time stamp to the
3092b15cb3dSCy Schubert	clockstat file for all recognised NMEA sentences. This can be used to
3102b15cb3dSCy Schubert	get a useful value for fudge time2.<br><strong>Caveat:</strong> This
3112b15cb3dSCy Schubert	will fill your clockstat file rather fast. Use it only temporarily to
3122b15cb3dSCy Schubert	get the numbers for the NMEA sentence of your choice.</td>
3132b15cb3dSCy Schubert      </tr>
3142b15cb3dSCy Schubert      </tr><tr>
3152b15cb3dSCy Schubert        <td align="center">8</td>
3162b15cb3dSCy Schubert        <td align="center">256</td>
3172b15cb3dSCy Schubert        <td align="center">0x100</td>
3182b15cb3dSCy Schubert	<td>process <tt>$PGRMF</tt></td>
3192b15cb3dSCy Schubert      </tr><tr>
320*2d4e511cSCy Schubert        <td align="center">9</td>
321*2d4e511cSCy Schubert        <td align="center">512</td>
322*2d4e511cSCy Schubert        <td align="center">0x200</td>
323*2d4e511cSCy Schubert	<td>process <tt>$PUBX,04</tt></td>
324*2d4e511cSCy Schubert      </tr><tr>
325*2d4e511cSCy Schubert        <td align="center">10-15</td>
3262b15cb3dSCy Schubert        <td align="center"></td>
327*2d4e511cSCy Schubert        <td align="center">0xFC00</td>
3282b15cb3dSCy Schubert	<td>reserved - leave 0</td>
3292b15cb3dSCy Schubert      </tr><tr>
3302b15cb3dSCy Schubert        <td align="center">16</td>
3312b15cb3dSCy Schubert        <td align="center">65536</td>
3322b15cb3dSCy Schubert        <td align="center">0x10000</td>
3332b15cb3dSCy Schubert        <td>Append extra statistics to the clockstats line.
3342b15cb3dSCy Schubert        Details below.</td>
335*2d4e511cSCy Schubert       </tr><tr>
336*2d4e511cSCy Schubert        <td align="center">17</td>
337*2d4e511cSCy Schubert        <td align="center">131072</td>
338*2d4e511cSCy Schubert        <td align="center">0x20000</td>
339*2d4e511cSCy Schubert        <td>"Silent PPS" mode. Use the PPS channel (if enabled with
340*2d4e511cSCy Schubert          fudge flag 1) to get precise receive time stamps.
341*2d4e511cSCy Schubert          Do <em>not</em> set the PPS flag in the clock status, so the
342*2d4e511cSCy Schubert          clock is not considered as PPS peer.
343*2d4e511cSCy Schubert	</td>
344*2d4e511cSCy Schubert       </tr><tr>
345*2d4e511cSCy Schubert        <td align="center">18</td>
346*2d4e511cSCy Schubert        <td align="center">262144</td>
347*2d4e511cSCy Schubert        <td align="center">0x40000</td>
348*2d4e511cSCy Schubert        <td>Trust the date delivered via NMEA. Do this only if
349*2d4e511cSCy Schubert          you <em>really</em> trust the receiver!
350*2d4e511cSCy Schubert          See <a href="#datetrust">below</a>. <strong>Caveat:</strong>
351*2d4e511cSCy Schubert          This (hitherto undocumented) bit has moved!
352*2d4e511cSCy Schubert	</td>
3532b15cb3dSCy Schubert      </tr>
3542b15cb3dSCy Schubert    </tbody></table>
3552b15cb3dSCy Schubert
3562b15cb3dSCy Schubert
3572b15cb3dSCy Schubert    <p>
3582b15cb3dSCy Schubert      The default (mode 0) is to process all supported sentences at a linespeed
3592b15cb3dSCy Schubert      of 4800 bps, which results in the first one received and recognised in
3602b15cb3dSCy Schubert      each cycle being used.&nbsp; If only specific sentences should be
3612b15cb3dSCy Schubert      recognised, then the mode byte must be chosen to enable only the selected
3622b15cb3dSCy Schubert      ones.&nbsp; Multiple sentences may be selected by adding their mode bit
3632b15cb3dSCy Schubert      values, but of those enabled still only the first received sentence in a
3642b15cb3dSCy Schubert      cycle will be used.&nbsp; Using more than one sentence per cycle is
3652b15cb3dSCy Schubert      impossible, because
3662b15cb3dSCy Schubert      </p><ul>
3672b15cb3dSCy Schubert	<li>there is only <a href="#fudgetime2">fudge time2</a> available to
3682b15cb3dSCy Schubert	  compensate for transmission delays but every sentence would need a
3692b15cb3dSCy Schubert	  different one and
3702b15cb3dSCy Schubert	</li><li>using more than one sentence per cycle overstuffs the internal data
3712b15cb3dSCy Schubert	  filters.
3722b15cb3dSCy Schubert      </li></ul>
3732b15cb3dSCy Schubert      The driver uses 4800 bits per second by default, but faster bitrates can
3742b15cb3dSCy Schubert      be selected using bits 4 to 6 of the mode field.
375*2d4e511cSCy Schubert    </p>
3762b15cb3dSCy Schubert
3772b15cb3dSCy Schubert    <p>
3782b15cb3dSCy Schubert      <strong>Caveat:</strong> Using higher line speeds does not necessarily
3792b15cb3dSCy Schubert      increase the precision of the timing device.&nbsp; Higher line speeds are
3802b15cb3dSCy Schubert      not necessarily helpful for the NMEA driver, either.&nbsp; They can be
3812b15cb3dSCy Schubert      used to accomodate for an amount of data that does not fit into a
3822b15cb3dSCy Schubert      1-second cycle at 4800 bps, but high-speed high-volume NMEA data is likely
3832b15cb3dSCy Schubert      to cause trouble with the serial line driver since NMEA supports no
3842b15cb3dSCy Schubert      protocol handshake.&nbsp; Any device that is exclusively used for time
3852b15cb3dSCy Schubert      synchronisation purposes should be configured to transmit the relevant
3862b15cb3dSCy Schubert      data only, e.g. one <tt>$GPRMC</tt> or <tt>$GPZDA</tt> per second, at a
3872b15cb3dSCy Schubert      linespeed of 4800 bps or 9600 bps.
3882b15cb3dSCy Schubert    </p>
3892b15cb3dSCy Schubert
390*2d4e511cSCy Schubert    <h4><a name="datetrust"/>About distrusting NMEA date stamps</h4>
391*2d4e511cSCy Schubert    <p>
392*2d4e511cSCy Schubert      Trusting the calendar dates delivered via NMEA is a risky thing, and by
393*2d4e511cSCy Schubert      default these dates are handled with a huge dose of skepticism.  Many
394*2d4e511cSCy Schubert      receivers deliver a correct calendar date for a period of just 1024 weeks,
395*2d4e511cSCy Schubert      with a starting point baked somewhere into their firmware.  Beyond that,
396*2d4e511cSCy Schubert      they warp back to the begin of their era and simply provide wrong date
397*2d4e511cSCy Schubert      information.  To battle this widely observed effect, the date delivered is
398*2d4e511cSCy Schubert      by default reduced to GPS time again and then (re-)mapped according to the
399*2d4e511cSCy Schubert      base date, either the implicit value or the value set via "tos basedate".
400*2d4e511cSCy Schubert      If the receiver can <em>really</em> be trusted to deliver the right date
401*2d4e511cSCy Schubert      (which is not impossible, just more expensive for the manufacturer), then
402*2d4e511cSCy Schubert      mode bit 18 can be used to bypass the era mapping.  Setting this bit is
403*2d4e511cSCy Schubert      not needed under most circumstances, and setting it with an unreliable
404*2d4e511cSCy Schubert      receiver can have severe effects. Handle with care.
405*2d4e511cSCy Schubert    </p><p>
406*2d4e511cSCy Schubert      <strong>Note:</strong> This functionality was available for some time as
407*2d4e511cSCy Schubert      undocumented feature, with a different bit value.  It was moved in the
408*2d4e511cSCy Schubert      process of becoming officially acknowledged to avoid excessive scattering
409*2d4e511cSCy Schubert      of the mode bit mask.
410*2d4e511cSCy Schubert    </p>
411*2d4e511cSCy Schubert
412*2d4e511cSCy Schubert
4139c2daa00SOllivier Robert    <h4>Monitor Data</h4>
4142b15cb3dSCy Schubert
4152b15cb3dSCy Schubert    <p>The last GPS sentence that is accepted or rejected is written to the
4162b15cb3dSCy Schubert    clockstats file and available with <code>ntpq -c clockvar</code>.
4172b15cb3dSCy Schubert    (Logging the rejected sentences lets you see/debug why they were rejected.)
4182b15cb3dSCy Schubert    Filtered sentences are not logged.</p>
4192b15cb3dSCy Schubert
4202b15cb3dSCy Schubert    <p>
4212b15cb3dSCy Schubert      If the 0x10000 mode bit is on and clockstats is enabled, several extra
4222b15cb3dSCy Schubert      counters will be appended to the NMEA sentence that gets logged.
4232b15cb3dSCy Schubert      For example:
4242b15cb3dSCy Schubert<pre>
4252b15cb3dSCy Schubert56299 76876.691 127.127.20.20 $GPGGA,212116.000,3726.0785,N,12212.2605,W,1,05,2.0,17.0,M,-25.7,M,,0000*5C  228 64 0 0 64 0
4262b15cb3dSCy Schubert</pre>
4272b15cb3dSCy Schubert    </p>
4282b15cb3dSCy Schubert
4292b15cb3dSCy Schubert    <table border="1">
4302b15cb3dSCy Schubert      <caption>Clockstats</caption>
4312b15cb3dSCy Schubert      <tbody><tr>
4322b15cb3dSCy Schubert	<th align="center">Column</th>
4332b15cb3dSCy Schubert	<th align="center">Sample</th>
4342b15cb3dSCy Schubert	<th align="left">Meaning</th>
4352b15cb3dSCy Schubert      </tr>
4362b15cb3dSCy Schubert
4372b15cb3dSCy Schubert      <tr>
4382b15cb3dSCy Schubert	<td align="center">1</td>
4392b15cb3dSCy Schubert	<td align="center">56299</td>
4402b15cb3dSCy Schubert	<td>MJD</td>
4412b15cb3dSCy Schubert      </tr><tr>
4422b15cb3dSCy Schubert	<td align="center">2</td>
4432b15cb3dSCy Schubert	<td align="center">76876.691</td>
4442b15cb3dSCy Schubert	<td>Time of day in seconds</td>
4452b15cb3dSCy Schubert      </tr><tr>
4462b15cb3dSCy Schubert	<td align="center">3</td>
4472b15cb3dSCy Schubert	<td align="center">127.127.20.20</td>
4482b15cb3dSCy Schubert	<td>IP Address from server config line</td>
4492b15cb3dSCy Schubert      </tr><tr>
4502b15cb3dSCy Schubert	<td align="center">4</td>
4512b15cb3dSCy Schubert	<td align="center">$GPGGA,...0*5C</td>
4522b15cb3dSCy Schubert	<td>NMEA Sentence</td>
4532b15cb3dSCy Schubert      </tr><tr>
4542b15cb3dSCy Schubert        <td align="center">5</td>
4552b15cb3dSCy Schubert        <td align="center">228</td>
4562b15cb3dSCy Schubert        <td>Number of sentences received</td>
4572b15cb3dSCy Schubert      </tr><tr>
4582b15cb3dSCy Schubert        <td align="center">6</td>
4592b15cb3dSCy Schubert        <td align="center">64</td>
4602b15cb3dSCy Schubert        <td>Number of sentences accepted and used for timekeeping</td>
4612b15cb3dSCy Schubert      </tr><tr>
4622b15cb3dSCy Schubert        <td align="center">7</td>
4632b15cb3dSCy Schubert        <td align="center">0</td>
4642b15cb3dSCy Schubert        <td>Number of sentences rejected because they were marked invalid (poor signal)</td>
4652b15cb3dSCy Schubert      </tr><tr>
4662b15cb3dSCy Schubert        <td align="center">8</td>
4672b15cb3dSCy Schubert        <td align="center">0</td>
4682b15cb3dSCy Schubert        <td>Number of sentences rejected because of bad checksum or invalid date/time</td>
4692b15cb3dSCy Schubert      </tr><tr>
4702b15cb3dSCy Schubert        <td align="center">9</td>
4712b15cb3dSCy Schubert        <td align="center">64</td>
4722b15cb3dSCy Schubert        <td>Number of sentences filtered by mode bits or same second</td>
4732b15cb3dSCy Schubert      </tr><tr>
4742b15cb3dSCy Schubert        <td align="center">10</td>
4752b15cb3dSCy Schubert        <td align="center">0</td>
4762b15cb3dSCy Schubert        <td>Number of PPS pulses used, overrides NMEA sentences</td>
4772b15cb3dSCy Schubert      </tr>
4782b15cb3dSCy Schubert    </tbody></table>
4792b15cb3dSCy Schubert
4802b15cb3dSCy Schubert    Sentences like $GPGSV that don't contain the time will get
4812b15cb3dSCy Schubert    counted in the total but otherwise ignored.
4822b15cb3dSCy Schubert
4832b15cb3dSCy Schubert    <p>
4842b15cb3dSCy Schubert      <a href="https://support.ntp.org/bin/view/Support/ConfiguringNMEARefclocks">Configuring
4852b15cb3dSCy Schubert      NMEA Refclocks</a> might give further useful hints for specific hardware
4862b15cb3dSCy Schubert      devices that exhibit strange or curious behaviour.
4872b15cb3dSCy Schubert    </p>
4882b15cb3dSCy Schubert
4892b15cb3dSCy Schubert    <p>
4902b15cb3dSCy Schubert      To make a specific setting, select the corresponding decimal values from
4912b15cb3dSCy Schubert      the mode byte table, add them all together and enter the resulting
4922b15cb3dSCy Schubert      decimal value into the clock configuration line.
4932b15cb3dSCy Schubert    </p>
4942b15cb3dSCy Schubert
4952b15cb3dSCy Schubert    <h4>Setting up the Garmin GPS-25XL</h4>
4962b15cb3dSCy Schubert
4972b15cb3dSCy Schubert    Switch off all output with by sending it the following string.
4982b15cb3dSCy Schubert    <pre>"$PGRMO,,2&lt;cr&gt;&lt;lf&gt;"</pre>
4992b15cb3dSCy Schubert    <p>Now switch only $GPRMC on by sending it the following string.</p>
5002b15cb3dSCy Schubert    <pre>"$PGRMO,GPRMC,1&lt;cr&gt;&lt;lf&gt;"</pre>
5012b15cb3dSCy Schubert
5022b15cb3dSCy Schubert    <p>On some systems the PPS signal isn't switched on by default. It can be
5032b15cb3dSCy Schubert    switched on by sending the following string.</p>
5042b15cb3dSCy Schubert    <pre>"$PGRMC,,,,,,,,,,,,2&lt;cr&gt;&lt;lf&gt;"</pre>
5052b15cb3dSCy Schubert
5069c2daa00SOllivier Robert    <h4>Fudge Factors</h4>
5072b15cb3dSCy Schubert
5089c2daa00SOllivier Robert    <dl>
5092b15cb3dSCy Schubert      <dt><tt>time1 <i>time</i></tt></dt>
5102b15cb3dSCy Schubert      <dd>Specifies the PPS time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
5112b15cb3dSCy Schubert      <dt><a name="fudgetime2"><tt>time2 <i>time</i></tt></a></dt>
5122b15cb3dSCy Schubert      <dd>Specifies the serial end of line time offset calibration factor, in seconds and fraction, with default
5132b15cb3dSCy Schubert	0.0.</dd>
5142b15cb3dSCy Schubert      <dt><tt>stratum <i>number</i></tt></dt>
5152b15cb3dSCy Schubert      <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
5162b15cb3dSCy Schubert      <dt><tt>refid <i>string</i></tt></dt>
5172b15cb3dSCy Schubert      <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with
5182b15cb3dSCy Schubert	default <tt>GPS</tt>.</dd>
5192b15cb3dSCy Schubert      <dt><tt>flag1 0 | 1</tt></dt>
5202b15cb3dSCy Schubert      <dd>Disable PPS signal processing if 0 (default); enable PPS signal processing if 1.</dd>
5212b15cb3dSCy Schubert      <dt><tt>flag2 0 | 1</tt></dt>
5222b15cb3dSCy Schubert      <dd>If PPS signal processing is enabled, capture the pulse on the rising edge if 0 (default); capture on the
5232b15cb3dSCy Schubert	falling edge if 1.</dd>
5242b15cb3dSCy Schubert      <dt><tt>flag3 0 | 1</tt></dt>
5252b15cb3dSCy Schubert      <dd>If PPS signal processing is enabled, use the <tt>ntpd</tt> clock discipline if 0 (default); use the kernel
5262b15cb3dSCy Schubert	discipline if 1.</dd>
5272b15cb3dSCy Schubert      <dt><tt>flag4 0 | 1</tt></dt>
5282b15cb3dSCy Schubert      <dd>Obscures location in timecode: 0 for disable (default), 1 for enable.</dd>
5299c2daa00SOllivier Robert    </dl>
5302b15cb3dSCy Schubert
5319c2daa00SOllivier Robert    <p>Additional Information</p>
5322b15cb3dSCy Schubert    <p><tt>flag1</tt>, <tt>flag2</tt>, and <tt>flag3</tt> are ignored under Windows.</p>
5339c2daa00SOllivier Robert    <p><a href="../refclock.html">Reference Clock Drivers</a></p>
5349c2daa00SOllivier Robert    <hr>
535ea906c41SOllivier Robert    <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
5362b15cb3dSCy Schubert  </body></html>
537