1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Generic NMEA GPS Receiver</title>
4 <!-- Changed by: Harlan &, 31-Mar-2014 -->
5 <link href="scripts/style.css" type="text/css" rel="stylesheet">
6 <style type="text/css">
7 table.dlstable { font-size:85%; }
8 td.ttf{ font-family:Courier; font-weight:bold; }
14 <h3>Generic NMEA GPS Receiver</h3>
16 <!-- #BeginDate format:En2m -->31-Mar-2014 03:55<!-- #EndDate -->
22 Address: 127.127.20.<i>u</i><br>
23 Reference ID: <tt>GPS</tt><br>
24 Driver ID: <tt>GPS_NMEA</tt><br>
25 Serial Port: <tt>/dev/gps<i>u</i></tt>; 4800 - 115200 bps, 8-bits, no parity<br>
26 Serial Port: <tt>/dev/gpspps<i>u</i></tt>; for just the PPS signal (this
27 is tried first for PPS, before <tt>/dev/gps<i>u</i></tt>)<br>
28 Serial Port: <tt>/dev/gps<i>u</i></tt>; symlink to server:port (for nmead)<br>
29 Features: <tt>tty_clk</tt>
35 This driver supports GPS receivers with
36 the <tt>$GPRMC</tt>, <tt>$GPGLL</tt>, <tt>$GPGGA</tt>, <tt>$GPZDA</tt>
37 and <tt>$GPZDG</tt> NMEA sentences by default. Note that Accord's
38 custom NMEA sentence <tt>$GPZDG</tt> reports using the GPS timescale,
39 while the rest of the sentences report UTC. The difference between
40 the two is a whole number of seconds which increases with each leap
41 second insertion in UTC. To avoid problems mixing UTC and GPS
42 timescales, the driver disables processing of UTC sentences
43 once <tt>$GPZDG</tt> is received.
46 The driver expects the receiver to be set up to transmit at least one
47 supported sentence every second.
50 The accuracy depends on the receiver used. Inexpensive GPS models are
51 available with a claimed PPS signal accuracy of
52 1 μs or better relative to the broadcast
53 signal. However, in most cases the actual accuracy is limited by the
54 precision of the timecode and the latencies of the serial interface and
58 If the Operating System supports PPSAPI
59 (<a href="http://www.ietf.org/rfc/rfc2783.txt">RFC 2783</a>), fudge flag1
63 The various GPS sentences that this driver recognises look like this:<br>
64 (others quietly ignored)
67 <p><table class="dlstable" border="1">
68 <caption>Accepted NMEA sentences</caption>
73 <td class="ttf">$GPRMC,UTC,POS_STAT,LAT,LAT_REF,LON,LON_REF,SPD,HDG,DATE,MAG_VAR,MAG_REF*CS<cr><lf></td>
75 <td class="ttf">$GPGLL,LAT,LAT_REF,LON,LON_REF,UTC,POS_STAT*CS<cr><lf></td>
77 <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<cr><lf></td>
79 <td class="ttf">$GPZDA,UTC,DD,MM,YYYY,TH,TM,*CS<cr><lf></td>
81 <td class="ttf">$GPZDG,GPSTIME,DD,MM,YYYY,AA.BB,V*CS<cr><lf></td>
86 <p><table class="dlstable" border="1">
87 <caption>NMEA data items</caption>
90 <th>Meaning and Format</th>
94 <td class="ttf">UTC</td>
95 <td>Time of day on UTC timescale. Hours, minutes and seconds [fraction (opt.)]. (hhmmss[.fff])</td>
97 <td class="ttf">POS_STAT</td>
98 <td>Position status. (A = Data valid, V = Data invalid)</td>
100 <td class="ttf">LAT</td>
101 <td>Latitude (llll.ll)</td>
103 <td class="ttf">LAT_REF</td>
104 <td>Latitude direction. (N = North, S = South)</td>
106 <td class="ttf">LON</td>
107 <td>Longitude (yyyyy.yy)</td>
109 <td class="ttf">LON_REF</td>
110 <td>Longitude direction (E = East, W = West)</td>
112 <td class="ttf">SPD</td>
113 <td>Speed over ground. (knots) (x.x)</td>
115 <td class="ttf">HDG</td>
116 <td>Heading/track made good (degrees True) (x.x)</td>
118 <td class="ttf">DATE</td>
119 <td>Date (ddmmyy)</td>
121 <td class="ttf">MAG_VAR</td>
122 <td>Magnetic variation (degrees) (x.x)</td>
124 <td class="ttf">MAG_REF</td>
125 <td>Magnetic variation (E = East, W = West)</td>
127 <td class="ttf">FIX_MODE</td>
128 <td>Position Fix Mode (0 = Invalid, >0 = Valid)</td>
130 <td class="ttf">SAT_USED</td>
131 <td>Number of Satellites used in solution</td>
133 <td class="ttf">HDOP</td>
134 <td>Horizontal Dilution of Precision</td>
136 <td class="ttf">ALT</td>
137 <td>Antenna Altitude</td>
139 <td class="ttf">ALT_UNIT</td>
140 <td>Altitude Units (Metres/Feet)</td>
142 <td class="ttf">GEO</td>
143 <td>Geoid/Elipsoid separation</td>
145 <td class="ttf">G_UNIT</td>
146 <td>Geoid units (M/F)</td>
148 <td class="ttf">D_AGE</td>
149 <td>Age of last DGPS Fix</td>
151 <td class="ttf">D_REF</td>
152 <td>Reference ID of DGPS station</td>
154 <td class="ttf">GPSTIME</td>
155 <td>Time of day on GPS timescale. Hours, minutes and seconds [fraction (opt.)]. (hhmmss[.f])</td>
157 <td class="ttf">DD</td>
158 <td>Day of the month (1-31)</td>
160 <td class="ttf">MM</td>
161 <td>Month of the year (1-12)</td>
163 <td class="ttf">YYYY</td>
166 <td class="ttf">AA.BB</td>
167 <td>Denotes the signal strength (should be < 05.00)</td>
169 <td class="ttf">V</td>
170 <td>GPS sync status<br>
171 '0' => INVALID time,<br>
172 '1' => accuracy of +/- 20ms,<br>
173 '2' => accuracy of +/- 100ns</td>
175 <td class="ttf">CS</td>
178 <td class="ttf"><cr><lf></td>
179 <td>Sentence terminator.</td>
184 <h4>The 'mode' byte</h4>
187 Specific GPS sentences and bitrates may be selected by setting bits of
188 the 'mode' in the server configuration line:<br> <tt>server
189 127.127.20.x mode X</tt>
193 <caption>mode byte bits and bit groups</caption>
195 <th align="center">Bit</th>
196 <th align="center">Decimal</th>
197 <th align="center">Hex</th>
198 <th align="left">Meaning</th>
202 <td align="center">0</td>
203 <td align="center">1</td>
204 <td align="center">1</td>
205 <td>process <tt>$GPMRC</tt></td>
207 <td align="center">1</td>
208 <td align="center">2</td>
209 <td align="center">2</td>
210 <td>process <tt>$GPGGA</tt></td>
212 <td align="center">2</td>
213 <td align="center">4</td>
214 <td align="center">4</td>
215 <td>process <tt>$GPGLL</tt></td>
217 <td align="center">3</td>
218 <td align="center">8</td>
219 <td align="center">8</td>
220 <td>process <tt>$GPZDA</tt> or <tt>$GPZDG</tt></td>
222 <td rowspan="6" align="center">4-6</td>
223 <td align="center">0</td>
224 <td align="center">0</td>
225 <td>linespeed 4800 bps</td>
227 <td align="center">16</td>
228 <td align="center">0x10</td>
229 <td>linespeed 9600 bps</td>
231 <td align="center">32</td>
232 <td align="center">0x20</td>
233 <td>linespeed 19200 bps</td>
235 <td align="center">48</td>
236 <td align="center">0x30</td>
237 <td>linespeed 38400 bps</td>
239 <td align="center">64</td>
240 <td align="center">0x40</td>
241 <td>linespeed 57600 bps</td>
243 <td align="center">80</td>
244 <td align="center">0x50</td>
245 <td>linespeed 115200 bps</td>
247 <td align="center">7</td>
248 <td align="center">128</td>
249 <td align="center">0x80</td>
250 <td>Write the sub-second fraction of the receive time stamp to the
251 clockstat file for all recognised NMEA sentences. This can be used to
252 get a useful value for fudge time2.<br><strong>Caveat:</strong> This
253 will fill your clockstat file rather fast. Use it only temporarily to
254 get the numbers for the NMEA sentence of your choice.</td>
257 <td align="center">8</td>
258 <td align="center">256</td>
259 <td align="center">0x100</td>
260 <td>process <tt>$PGRMF</tt></td>
262 <td align="center">9-15</td>
263 <td align="center"></td>
264 <td align="center">0xFE00</td>
265 <td>reserved - leave 0</td>
267 <td align="center">16</td>
268 <td align="center">65536</td>
269 <td align="center">0x10000</td>
270 <td>Append extra statistics to the clockstats line.
277 The default (mode 0) is to process all supported sentences at a linespeed
278 of 4800 bps, which results in the first one received and recognised in
279 each cycle being used. If only specific sentences should be
280 recognised, then the mode byte must be chosen to enable only the selected
281 ones. Multiple sentences may be selected by adding their mode bit
282 values, but of those enabled still only the first received sentence in a
283 cycle will be used. Using more than one sentence per cycle is
286 <li>there is only <a href="#fudgetime2">fudge time2</a> available to
287 compensate for transmission delays but every sentence would need a
289 </li><li>using more than one sentence per cycle overstuffs the internal data
292 The driver uses 4800 bits per second by default, but faster bitrates can
293 be selected using bits 4 to 6 of the mode field.
297 <strong>Caveat:</strong> Using higher line speeds does not necessarily
298 increase the precision of the timing device. Higher line speeds are
299 not necessarily helpful for the NMEA driver, either. They can be
300 used to accomodate for an amount of data that does not fit into a
301 1-second cycle at 4800 bps, but high-speed high-volume NMEA data is likely
302 to cause trouble with the serial line driver since NMEA supports no
303 protocol handshake. Any device that is exclusively used for time
304 synchronisation purposes should be configured to transmit the relevant
305 data only, e.g. one <tt>$GPRMC</tt> or <tt>$GPZDA</tt> per second, at a
306 linespeed of 4800 bps or 9600 bps.
309 <h4>Monitor Data</h4>
311 <p>The last GPS sentence that is accepted or rejected is written to the
312 clockstats file and available with <code>ntpq -c clockvar</code>.
313 (Logging the rejected sentences lets you see/debug why they were rejected.)
314 Filtered sentences are not logged.</p>
317 If the 0x10000 mode bit is on and clockstats is enabled, several extra
318 counters will be appended to the NMEA sentence that gets logged.
321 56299 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
326 <caption>Clockstats</caption>
328 <th align="center">Column</th>
329 <th align="center">Sample</th>
330 <th align="left">Meaning</th>
334 <td align="center">1</td>
335 <td align="center">56299</td>
338 <td align="center">2</td>
339 <td align="center">76876.691</td>
340 <td>Time of day in seconds</td>
342 <td align="center">3</td>
343 <td align="center">127.127.20.20</td>
344 <td>IP Address from server config line</td>
346 <td align="center">4</td>
347 <td align="center">$GPGGA,...0*5C</td>
348 <td>NMEA Sentence</td>
350 <td align="center">5</td>
351 <td align="center">228</td>
352 <td>Number of sentences received</td>
354 <td align="center">6</td>
355 <td align="center">64</td>
356 <td>Number of sentences accepted and used for timekeeping</td>
358 <td align="center">7</td>
359 <td align="center">0</td>
360 <td>Number of sentences rejected because they were marked invalid (poor signal)</td>
362 <td align="center">8</td>
363 <td align="center">0</td>
364 <td>Number of sentences rejected because of bad checksum or invalid date/time</td>
366 <td align="center">9</td>
367 <td align="center">64</td>
368 <td>Number of sentences filtered by mode bits or same second</td>
370 <td align="center">10</td>
371 <td align="center">0</td>
372 <td>Number of PPS pulses used, overrides NMEA sentences</td>
376 Sentences like $GPGSV that don't contain the time will get
377 counted in the total but otherwise ignored.
380 <a href="https://support.ntp.org/bin/view/Support/ConfiguringNMEARefclocks">Configuring
381 NMEA Refclocks</a> might give further useful hints for specific hardware
382 devices that exhibit strange or curious behaviour.
386 To make a specific setting, select the corresponding decimal values from
387 the mode byte table, add them all together and enter the resulting
388 decimal value into the clock configuration line.
391 <h4>Setting up the Garmin GPS-25XL</h4>
393 Switch off all output with by sending it the following string.
394 <pre>"$PGRMO,,2<cr><lf>"</pre>
395 <p>Now switch only $GPRMC on by sending it the following string.</p>
396 <pre>"$PGRMO,GPRMC,1<cr><lf>"</pre>
398 <p>On some systems the PPS signal isn't switched on by default. It can be
399 switched on by sending the following string.</p>
400 <pre>"$PGRMC,,,,,,,,,,,,2<cr><lf>"</pre>
402 <h4>Fudge Factors</h4>
405 <dt><tt>time1 <i>time</i></tt></dt>
406 <dd>Specifies the PPS time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
407 <dt><a name="fudgetime2"><tt>time2 <i>time</i></tt></a></dt>
408 <dd>Specifies the serial end of line time offset calibration factor, in seconds and fraction, with default
410 <dt><tt>stratum <i>number</i></tt></dt>
411 <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
412 <dt><tt>refid <i>string</i></tt></dt>
413 <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with
414 default <tt>GPS</tt>.</dd>
415 <dt><tt>flag1 0 | 1</tt></dt>
416 <dd>Disable PPS signal processing if 0 (default); enable PPS signal processing if 1.</dd>
417 <dt><tt>flag2 0 | 1</tt></dt>
418 <dd>If PPS signal processing is enabled, capture the pulse on the rising edge if 0 (default); capture on the
419 falling edge if 1.</dd>
420 <dt><tt>flag3 0 | 1</tt></dt>
421 <dd>If PPS signal processing is enabled, use the <tt>ntpd</tt> clock discipline if 0 (default); use the kernel
422 discipline if 1.</dd>
423 <dt><tt>flag4 0 | 1</tt></dt>
424 <dd>Obscures location in timecode: 0 for disable (default), 1 for enable.</dd>
427 <p>Additional Information</p>
428 <p><tt>flag1</tt>, <tt>flag2</tt>, and <tt>flag3</tt> are ignored under Windows.</p>
429 <p><a href="../refclock.html">Reference Clock Drivers</a></p>
431 <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>