xref: /freebsd/contrib/ntp/html/drivers/driver20.html (revision a466cc55373fc3cf86837f09da729535b57e69a1)
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>
42d4e511cSCy 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*a466cc55SCy Schubert  <!-- #BeginDate format:En2m -->17-Oct-2020  16:00<!-- #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.
442d4e511cSCy Schubert      <br>
452d4e511cSCy Schubert      <strong>Caveat:</strong> Please see <a href="#talkerids">Talker
462d4e511cSCy 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>
862d4e511cSCy Schubert      </tr><tr>
872d4e511cSCy Schubert      </tr><tr>
882d4e511cSCy 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>
892d4e511cSCy Schubert	<td>Garmin</td>
902d4e511cSCy Schubert      </tr><tr>
912d4e511cSCy Schubert	  <td class="ttf">$PUBX,04,UTC,DATE,utcTow,utcWk,LEAPS,clkBias,clkDrift,tpGran,*CS&lt;cr&gt;&lt;lf&gt;</td>
922d4e511cSCy 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>
1102d4e511cSCy Schubert	<td class="ttf">DATE</td>
1112d4e511cSCy Schubert	<td>Date (ddmmyy)</td>
1122b15cb3dSCy Schubert      </tr><tr>
1132d4e511cSCy Schubert	<td class="ttf">DD</td>
1142d4e511cSCy 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>
1222d4e511cSCy Schubert	<td class="ttf">FIX_MODE</td>
1232d4e511cSCy Schubert	<td>Position Fix Mode (0 = Invalid, &gt;0 = Valid)</td>
1242b15cb3dSCy Schubert      </tr><tr>
1252d4e511cSCy Schubert	<td class="ttf">GEO</td>
1262d4e511cSCy Schubert	<td>Geoid/Elipsoid separation</td>
1272d4e511cSCy Schubert      </tr><tr>
1282d4e511cSCy Schubert	<td class="ttf">GPSTIME</td>
1292d4e511cSCy Schubert	<td>Time of day on GPS timescale. Hours, minutes and seconds [fraction (opt.)] (hhmmss[.f])</td>
1302d4e511cSCy Schubert      </tr><tr>
1312d4e511cSCy Schubert	<td class="ttf">gpsTow</td>
1322d4e511cSCy Schubert	<td>GPS week time, seconds since start of GPS week (0..604799)</td>
1332d4e511cSCy Schubert      </tr><tr>
1342d4e511cSCy Schubert	<td class="ttf">gpsWk</td>
1352d4e511cSCy Schubert	<td>Week number in the GPS time scale (may exceed 1024)</td>
1362d4e511cSCy Schubert      </tr><tr>
1372d4e511cSCy Schubert	<td class="ttf">G_UNIT</td>
1382d4e511cSCy Schubert	<td>Geoid units (M/F)</td>
1392d4e511cSCy Schubert      </tr><tr>
1402d4e511cSCy Schubert	<td class="ttf">HDG</td>
1412d4e511cSCy Schubert	<td>Heading/track made good (degrees True) (x.x)</td>
1422d4e511cSCy Schubert      </tr><tr>
1432d4e511cSCy Schubert	<td class="ttf">HDOP</td>
1442d4e511cSCy Schubert	<td>Horizontal Dilution of Precision</td>
1452d4e511cSCy Schubert      </tr><tr>
1462d4e511cSCy Schubert	<td class="ttf">LAT</td>
1472d4e511cSCy Schubert	<td>Latitude (llll.ll)</td>
1482d4e511cSCy Schubert      </tr><tr>
1492d4e511cSCy Schubert	<td class="ttf">LAT_REF</td>
1502d4e511cSCy Schubert	<td>Latitude direction (N = North, S = South)</td>
1512d4e511cSCy Schubert      </tr><tr>
1522d4e511cSCy Schubert	<td class="ttf">LEAPS</td>
1532d4e511cSCy Schubert	<td>Leap seconds or difference between GPS time scale and UTC</td>
1542d4e511cSCy Schubert      </tr><tr>
1552d4e511cSCy Schubert	<td class="ttf">LON</td>
1562d4e511cSCy Schubert	<td>Longitude (yyyyy.yy)</td>
1572d4e511cSCy Schubert      </tr><tr>
1582d4e511cSCy Schubert	<td class="ttf">LON_REF</td>
1592d4e511cSCy Schubert	<td>Longitude direction (E = East, W = West)</td>
1602d4e511cSCy Schubert      </tr><tr>
1612d4e511cSCy Schubert	<td class="ttf">MAG_REF</td>
1622d4e511cSCy Schubert	<td>Magnetic variation (E = East, W = West)</td>
1632d4e511cSCy Schubert      </tr><tr>
1642d4e511cSCy Schubert	<td class="ttf">MAG_VAR</td>
1652d4e511cSCy 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>
1702d4e511cSCy Schubert	<td class="ttf">POS_STAT</td>
1712d4e511cSCy Schubert	<td>Position status. (A = Data valid, V = Data invalid)</td>
1722d4e511cSCy Schubert      </tr><tr>
1732d4e511cSCy Schubert	<td class="ttf">SAT_USED</td>
1742d4e511cSCy Schubert	<td>Number of Satellites used in solution</td>
1752d4e511cSCy Schubert      </tr><tr>
1762d4e511cSCy Schubert	<td class="ttf">SPD</td>
1772d4e511cSCy Schubert	<td>Speed over ground. (knots) (x.x)</td>
1782d4e511cSCy Schubert      </tr><tr>
1792d4e511cSCy Schubert	<td class="ttf">UTC</td>
1802d4e511cSCy Schubert	<td>Time of day on UTC timescale. Hours, minutes and seconds [fraction (opt.)] (hhmmss[.fff])</td>
1812d4e511cSCy Schubert      </tr><tr>
1822b15cb3dSCy Schubert	<td class="ttf">YYYY</td>
1832b15cb3dSCy Schubert	<td>Year</td>
1842b15cb3dSCy Schubert      </tr><tr>
1852d4e511cSCy Schubert	<td class="ttf">WEEK</td>
1862d4e511cSCy Schubert	<td>GPS week (0-1023)</td>
1872d4e511cSCy Schubert      </tr><tr>
1882d4e511cSCy Schubert	<td class="ttf">WSEC</td>
1892d4e511cSCy Schubert	<td>Seconds since start of week (0-604799)</td>
1902d4e511cSCy Schubert      </tr><tr>
1912d4e511cSCy Schubert	<td class="ttf">LEAP</td>
1922d4e511cSCy Schubert	<td>GPS leap seconds, that is, seconds ahead of UTC</td>
1932d4e511cSCy 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
2122d4e511cSCy Schubert    <h4><a name="talkerids"/>NMEA Talker IDs</h4>
2132d4e511cSCy Schubert
2142d4e511cSCy Schubert    <p>
2152d4e511cSCy Schubert      GNSS receivers use a distinct talker ID for the GNSS they
2162d4e511cSCy Schubert      process. Receivers capable of tracking different systems at the same time
2172d4e511cSCy Schubert      can emit <tt>$GPRMC</tt> (GPS), <tt>$GLRMC</tt> (GLONASS),
2182d4e511cSCy Schubert      <tt>$GARMC</tt> (Galileo), <tt>$GNRMC</tt> (generic/combined) and others
2192d4e511cSCy Schubert      all in one data stream.
2202d4e511cSCy Schubert    </p><p>
2212d4e511cSCy Schubert      The driver supports this to a certain degree by ignoring the
2222d4e511cSCy Schubert      talker ID on the standard sentences RMC, GLL, GGA, ZDA and ZDG. (It
2232d4e511cSCy Schubert      possibly should not do that on the latter, but for now, that's the way
2242d4e511cSCy Schubert      it is.) So whenever <tt>$GPRMC</tt> is mentioned in this document,
2252d4e511cSCy Schubert      substitute any possible talker ID your receiver might emit -- it will
2262d4e511cSCy Schubert      still match.
2272d4e511cSCy Schubert    </p><p>
2282d4e511cSCy Schubert      This approach has a drawback. It is easy to use for single-system
2292d4e511cSCy Schubert      receivers, but it cannot separate the data streams for multi-system
2302d4e511cSCy Schubert      receiver modules. It is therefore undefined which GNSS actually
2312d4e511cSCy Schubert      provides the data, and this can lead to strange behavior. This is
2322d4e511cSCy Schubert      especially true if the different GNSS provide very different signal
2332d4e511cSCy Schubert      quality to the receiver; the driver is not able to cherry-pick the best
2342d4e511cSCy Schubert      source and might actually end up in using the worst available.  It is
2352d4e511cSCy Schubert      therefore recommended to set up such a receiver to either use just a
2362d4e511cSCy Schubert      single GNSS (which would defeat its purpose) or to emit only the
2372d4e511cSCy Schubert      combined data, which usually has the <tt>GN</tt> talker ID defined by
2382d4e511cSCy Schubert      the NMEA standard.
2392d4e511cSCy Schubert    <p>
2402d4e511cSCy Schubert
2412d4e511cSCy 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>
2632d4e511cSCy 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>
3202d4e511cSCy Schubert        <td align="center">9</td>
3212d4e511cSCy Schubert        <td align="center">512</td>
3222d4e511cSCy Schubert        <td align="center">0x200</td>
3232d4e511cSCy Schubert	<td>process <tt>$PUBX,04</tt></td>
3242d4e511cSCy Schubert      </tr><tr>
3252d4e511cSCy Schubert        <td align="center">10-15</td>
3262b15cb3dSCy Schubert        <td align="center"></td>
3272d4e511cSCy 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>
3352d4e511cSCy Schubert       </tr><tr>
3362d4e511cSCy Schubert        <td align="center">17</td>
3372d4e511cSCy Schubert        <td align="center">131072</td>
3382d4e511cSCy Schubert        <td align="center">0x20000</td>
3392d4e511cSCy Schubert        <td>"Silent PPS" mode. Use the PPS channel (if enabled with
3402d4e511cSCy Schubert          fudge flag 1) to get precise receive time stamps.
3412d4e511cSCy Schubert          Do <em>not</em> set the PPS flag in the clock status, so the
3422d4e511cSCy Schubert          clock is not considered as PPS peer.
3432d4e511cSCy Schubert	</td>
3442d4e511cSCy Schubert       </tr><tr>
3452d4e511cSCy Schubert        <td align="center">18</td>
3462d4e511cSCy Schubert        <td align="center">262144</td>
3472d4e511cSCy Schubert        <td align="center">0x40000</td>
3482d4e511cSCy Schubert        <td>Trust the date delivered via NMEA. Do this only if
3492d4e511cSCy Schubert          you <em>really</em> trust the receiver!
3502d4e511cSCy Schubert          See <a href="#datetrust">below</a>. <strong>Caveat:</strong>
3512d4e511cSCy Schubert          This (hitherto undocumented) bit has moved!
3522d4e511cSCy Schubert	</td>
353*a466cc55SCy Schubert       </tr><tr>
354*a466cc55SCy Schubert        <td align="center">19</td>
355*a466cc55SCy Schubert        <td align="center">524288</td>
356*a466cc55SCy Schubert        <td align="center">0x80000</td>
357*a466cc55SCy Schubert        <td>Ignore receiver status, assume time is always good as long
358*a466cc55SCy Schubert	  as it is present at all.  A possible option for receivers
359*a466cc55SCy Schubert	  with a good hold-over characteristic, but most likely
360*a466cc55SCy Schubert	  harmful in general. Use at own risk.
361*a466cc55SCy Schubert	</td>
3622b15cb3dSCy Schubert      </tr>
3632b15cb3dSCy Schubert    </tbody></table>
3642b15cb3dSCy Schubert
3652b15cb3dSCy Schubert
3662b15cb3dSCy Schubert    <p>
3672b15cb3dSCy Schubert      The default (mode 0) is to process all supported sentences at a linespeed
3682b15cb3dSCy Schubert      of 4800 bps, which results in the first one received and recognised in
3692b15cb3dSCy Schubert      each cycle being used.&nbsp; If only specific sentences should be
3702b15cb3dSCy Schubert      recognised, then the mode byte must be chosen to enable only the selected
3712b15cb3dSCy Schubert      ones.&nbsp; Multiple sentences may be selected by adding their mode bit
3722b15cb3dSCy Schubert      values, but of those enabled still only the first received sentence in a
3732b15cb3dSCy Schubert      cycle will be used.&nbsp; Using more than one sentence per cycle is
3742b15cb3dSCy Schubert      impossible, because
3752b15cb3dSCy Schubert      </p><ul>
3762b15cb3dSCy Schubert	<li>there is only <a href="#fudgetime2">fudge time2</a> available to
3772b15cb3dSCy Schubert	  compensate for transmission delays but every sentence would need a
3782b15cb3dSCy Schubert	  different one and
3792b15cb3dSCy Schubert	</li><li>using more than one sentence per cycle overstuffs the internal data
3802b15cb3dSCy Schubert	  filters.
3812b15cb3dSCy Schubert      </li></ul>
3822b15cb3dSCy Schubert      The driver uses 4800 bits per second by default, but faster bitrates can
3832b15cb3dSCy Schubert      be selected using bits 4 to 6 of the mode field.
3842d4e511cSCy Schubert    </p>
3852b15cb3dSCy Schubert
3862b15cb3dSCy Schubert    <p>
3872b15cb3dSCy Schubert      <strong>Caveat:</strong> Using higher line speeds does not necessarily
3882b15cb3dSCy Schubert      increase the precision of the timing device.&nbsp; Higher line speeds are
3892b15cb3dSCy Schubert      not necessarily helpful for the NMEA driver, either.&nbsp; They can be
3902b15cb3dSCy Schubert      used to accomodate for an amount of data that does not fit into a
3912b15cb3dSCy Schubert      1-second cycle at 4800 bps, but high-speed high-volume NMEA data is likely
3922b15cb3dSCy Schubert      to cause trouble with the serial line driver since NMEA supports no
3932b15cb3dSCy Schubert      protocol handshake.&nbsp; Any device that is exclusively used for time
3942b15cb3dSCy Schubert      synchronisation purposes should be configured to transmit the relevant
3952b15cb3dSCy Schubert      data only, e.g. one <tt>$GPRMC</tt> or <tt>$GPZDA</tt> per second, at a
3962b15cb3dSCy Schubert      linespeed of 4800 bps or 9600 bps.
3972b15cb3dSCy Schubert    </p>
3982b15cb3dSCy Schubert
3992d4e511cSCy Schubert    <h4><a name="datetrust"/>About distrusting NMEA date stamps</h4>
4002d4e511cSCy Schubert    <p>
4012d4e511cSCy Schubert      Trusting the calendar dates delivered via NMEA is a risky thing, and by
4022d4e511cSCy Schubert      default these dates are handled with a huge dose of skepticism.  Many
4032d4e511cSCy Schubert      receivers deliver a correct calendar date for a period of just 1024 weeks,
4042d4e511cSCy Schubert      with a starting point baked somewhere into their firmware.  Beyond that,
4052d4e511cSCy Schubert      they warp back to the begin of their era and simply provide wrong date
4062d4e511cSCy Schubert      information.  To battle this widely observed effect, the date delivered is
4072d4e511cSCy Schubert      by default reduced to GPS time again and then (re-)mapped according to the
4082d4e511cSCy Schubert      base date, either the implicit value or the value set via "tos basedate".
4092d4e511cSCy Schubert      If the receiver can <em>really</em> be trusted to deliver the right date
4102d4e511cSCy Schubert      (which is not impossible, just more expensive for the manufacturer), then
4112d4e511cSCy Schubert      mode bit 18 can be used to bypass the era mapping.  Setting this bit is
4122d4e511cSCy Schubert      not needed under most circumstances, and setting it with an unreliable
4132d4e511cSCy Schubert      receiver can have severe effects. Handle with care.
4142d4e511cSCy Schubert    </p><p>
4152d4e511cSCy Schubert      <strong>Note:</strong> This functionality was available for some time as
4162d4e511cSCy Schubert      undocumented feature, with a different bit value.  It was moved in the
4172d4e511cSCy Schubert      process of becoming officially acknowledged to avoid excessive scattering
4182d4e511cSCy Schubert      of the mode bit mask.
4192d4e511cSCy Schubert    </p>
4202d4e511cSCy Schubert
4212d4e511cSCy Schubert
4229c2daa00SOllivier Robert    <h4>Monitor Data</h4>
4232b15cb3dSCy Schubert
4242b15cb3dSCy Schubert    <p>The last GPS sentence that is accepted or rejected is written to the
4252b15cb3dSCy Schubert    clockstats file and available with <code>ntpq -c clockvar</code>.
4262b15cb3dSCy Schubert    (Logging the rejected sentences lets you see/debug why they were rejected.)
4272b15cb3dSCy Schubert    Filtered sentences are not logged.</p>
4282b15cb3dSCy Schubert
4292b15cb3dSCy Schubert    <p>
4302b15cb3dSCy Schubert      If the 0x10000 mode bit is on and clockstats is enabled, several extra
4312b15cb3dSCy Schubert      counters will be appended to the NMEA sentence that gets logged.
4322b15cb3dSCy Schubert      For example:
4332b15cb3dSCy Schubert<pre>
4342b15cb3dSCy 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
4352b15cb3dSCy Schubert</pre>
4362b15cb3dSCy Schubert    </p>
4372b15cb3dSCy Schubert
4382b15cb3dSCy Schubert    <table border="1">
4392b15cb3dSCy Schubert      <caption>Clockstats</caption>
4402b15cb3dSCy Schubert      <tbody><tr>
4412b15cb3dSCy Schubert	<th align="center">Column</th>
4422b15cb3dSCy Schubert	<th align="center">Sample</th>
4432b15cb3dSCy Schubert	<th align="left">Meaning</th>
4442b15cb3dSCy Schubert      </tr>
4452b15cb3dSCy Schubert
4462b15cb3dSCy Schubert      <tr>
4472b15cb3dSCy Schubert	<td align="center">1</td>
4482b15cb3dSCy Schubert	<td align="center">56299</td>
4492b15cb3dSCy Schubert	<td>MJD</td>
4502b15cb3dSCy Schubert      </tr><tr>
4512b15cb3dSCy Schubert	<td align="center">2</td>
4522b15cb3dSCy Schubert	<td align="center">76876.691</td>
4532b15cb3dSCy Schubert	<td>Time of day in seconds</td>
4542b15cb3dSCy Schubert      </tr><tr>
4552b15cb3dSCy Schubert	<td align="center">3</td>
4562b15cb3dSCy Schubert	<td align="center">127.127.20.20</td>
4572b15cb3dSCy Schubert	<td>IP Address from server config line</td>
4582b15cb3dSCy Schubert      </tr><tr>
4592b15cb3dSCy Schubert	<td align="center">4</td>
4602b15cb3dSCy Schubert	<td align="center">$GPGGA,...0*5C</td>
4612b15cb3dSCy Schubert	<td>NMEA Sentence</td>
4622b15cb3dSCy Schubert      </tr><tr>
4632b15cb3dSCy Schubert        <td align="center">5</td>
4642b15cb3dSCy Schubert        <td align="center">228</td>
4652b15cb3dSCy Schubert        <td>Number of sentences received</td>
4662b15cb3dSCy Schubert      </tr><tr>
4672b15cb3dSCy Schubert        <td align="center">6</td>
4682b15cb3dSCy Schubert        <td align="center">64</td>
4692b15cb3dSCy Schubert        <td>Number of sentences accepted and used for timekeeping</td>
4702b15cb3dSCy Schubert      </tr><tr>
4712b15cb3dSCy Schubert        <td align="center">7</td>
4722b15cb3dSCy Schubert        <td align="center">0</td>
4732b15cb3dSCy Schubert        <td>Number of sentences rejected because they were marked invalid (poor signal)</td>
4742b15cb3dSCy Schubert      </tr><tr>
4752b15cb3dSCy Schubert        <td align="center">8</td>
4762b15cb3dSCy Schubert        <td align="center">0</td>
4772b15cb3dSCy Schubert        <td>Number of sentences rejected because of bad checksum or invalid date/time</td>
4782b15cb3dSCy Schubert      </tr><tr>
4792b15cb3dSCy Schubert        <td align="center">9</td>
4802b15cb3dSCy Schubert        <td align="center">64</td>
4812b15cb3dSCy Schubert        <td>Number of sentences filtered by mode bits or same second</td>
4822b15cb3dSCy Schubert      </tr><tr>
4832b15cb3dSCy Schubert        <td align="center">10</td>
4842b15cb3dSCy Schubert        <td align="center">0</td>
4852b15cb3dSCy Schubert        <td>Number of PPS pulses used, overrides NMEA sentences</td>
4862b15cb3dSCy Schubert      </tr>
4872b15cb3dSCy Schubert    </tbody></table>
4882b15cb3dSCy Schubert
4892b15cb3dSCy Schubert    Sentences like $GPGSV that don't contain the time will get
4902b15cb3dSCy Schubert    counted in the total but otherwise ignored.
4912b15cb3dSCy Schubert
4922b15cb3dSCy Schubert    <p>
4932b15cb3dSCy Schubert      <a href="https://support.ntp.org/bin/view/Support/ConfiguringNMEARefclocks">Configuring
4942b15cb3dSCy Schubert      NMEA Refclocks</a> might give further useful hints for specific hardware
4952b15cb3dSCy Schubert      devices that exhibit strange or curious behaviour.
4962b15cb3dSCy Schubert    </p>
4972b15cb3dSCy Schubert
4982b15cb3dSCy Schubert    <p>
4992b15cb3dSCy Schubert      To make a specific setting, select the corresponding decimal values from
5002b15cb3dSCy Schubert      the mode byte table, add them all together and enter the resulting
5012b15cb3dSCy Schubert      decimal value into the clock configuration line.
5022b15cb3dSCy Schubert    </p>
5032b15cb3dSCy Schubert
5042b15cb3dSCy Schubert    <h4>Setting up the Garmin GPS-25XL</h4>
5052b15cb3dSCy Schubert
5062b15cb3dSCy Schubert    Switch off all output with by sending it the following string.
5072b15cb3dSCy Schubert    <pre>"$PGRMO,,2&lt;cr&gt;&lt;lf&gt;"</pre>
5082b15cb3dSCy Schubert    <p>Now switch only $GPRMC on by sending it the following string.</p>
5092b15cb3dSCy Schubert    <pre>"$PGRMO,GPRMC,1&lt;cr&gt;&lt;lf&gt;"</pre>
5102b15cb3dSCy Schubert
5112b15cb3dSCy Schubert    <p>On some systems the PPS signal isn't switched on by default. It can be
5122b15cb3dSCy Schubert    switched on by sending the following string.</p>
5132b15cb3dSCy Schubert    <pre>"$PGRMC,,,,,,,,,,,,2&lt;cr&gt;&lt;lf&gt;"</pre>
5142b15cb3dSCy Schubert
5159c2daa00SOllivier Robert    <h4>Fudge Factors</h4>
5162b15cb3dSCy Schubert
5179c2daa00SOllivier Robert    <dl>
5182b15cb3dSCy Schubert      <dt><tt>time1 <i>time</i></tt></dt>
5192b15cb3dSCy Schubert      <dd>Specifies the PPS time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
5202b15cb3dSCy Schubert      <dt><a name="fudgetime2"><tt>time2 <i>time</i></tt></a></dt>
5212b15cb3dSCy Schubert      <dd>Specifies the serial end of line time offset calibration factor, in seconds and fraction, with default
5222b15cb3dSCy Schubert	0.0.</dd>
5232b15cb3dSCy Schubert      <dt><tt>stratum <i>number</i></tt></dt>
5242b15cb3dSCy Schubert      <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
5252b15cb3dSCy Schubert      <dt><tt>refid <i>string</i></tt></dt>
5262b15cb3dSCy Schubert      <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with
5272b15cb3dSCy Schubert	default <tt>GPS</tt>.</dd>
5282b15cb3dSCy Schubert      <dt><tt>flag1 0 | 1</tt></dt>
5292b15cb3dSCy Schubert      <dd>Disable PPS signal processing if 0 (default); enable PPS signal processing if 1.</dd>
5302b15cb3dSCy Schubert      <dt><tt>flag2 0 | 1</tt></dt>
5312b15cb3dSCy Schubert      <dd>If PPS signal processing is enabled, capture the pulse on the rising edge if 0 (default); capture on the
5322b15cb3dSCy Schubert	falling edge if 1.</dd>
5332b15cb3dSCy Schubert      <dt><tt>flag3 0 | 1</tt></dt>
5342b15cb3dSCy Schubert      <dd>If PPS signal processing is enabled, use the <tt>ntpd</tt> clock discipline if 0 (default); use the kernel
5352b15cb3dSCy Schubert	discipline if 1.</dd>
5362b15cb3dSCy Schubert      <dt><tt>flag4 0 | 1</tt></dt>
5372b15cb3dSCy Schubert      <dd>Obscures location in timecode: 0 for disable (default), 1 for enable.</dd>
5389c2daa00SOllivier Robert    </dl>
5392b15cb3dSCy Schubert
5409c2daa00SOllivier Robert    <p>Additional Information</p>
5412b15cb3dSCy Schubert    <p><tt>flag1</tt>, <tt>flag2</tt>, and <tt>flag3</tt> are ignored under Windows.</p>
5429c2daa00SOllivier Robert    <p><a href="../refclock.html">Reference Clock Drivers</a></p>
5439c2daa00SOllivier Robert    <hr>
544ea906c41SOllivier Robert    <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
5452b15cb3dSCy Schubert  </body></html>
546