driver20.html revision 1.1.1.2 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head>
3 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Generic NMEA GPS Receiver</title>
4
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; }
9 </style></head>
10
11
12
13 <body>
14 <h3>Generic NMEA GPS Receiver</h3>
15 <hr>
16 <h4>Synopsis</h4>
17
18 <p>
19 Address: 127.127.20.<i>u</i><br>
20 Reference ID: <tt>GPS</tt><br>
21 Driver ID: <tt>GPS_NMEA</tt><br>
22 Serial Port: <tt>/dev/gps<i>u</i></tt>; 4800 - 115200 bps, 8-bits, no parity<br>
23 Serial Port: <tt>/dev/gpspps<i>u</i></tt>; for just the PPS signal (this
24 is tried first for PPS, before <tt>/dev/gps<i>u</i></tt>)<br>
25 Serial Port: <tt>/dev/gps<i>u</i></tt>; symlink to server:port (for nmead)<br>
26 Features: <tt>tty_clk</tt>
27 </p>
28
29 <h4>Description</h4>
30
31 <p>
32 This driver supports GPS receivers with
33 the <tt>$GPRMC</tt>, <tt>$GPGLL</tt>, <tt>$GPGGA</tt>, <tt>$GPZDA</tt>
34 and <tt>$GPZDG</tt> NMEA sentences by default. Note that Accord's
35 custom NMEA sentence <tt>$GPZDG</tt> reports using the GPS timescale,
36 while the rest of the sentences report UTC. The difference between
37 the two is a whole number of seconds which increases with each leap
38 second insertion in UTC. To avoid problems mixing UTC and GPS
39 timescales, the driver disables processing of UTC sentences
40 once <tt>$GPZDG</tt> is received.
41 </p>
42 <p>
43 The driver expects the receiver to be set up to transmit at least one
44 supported sentence every second.
45 </p>
46 <p>
47 The accuracy depends on the receiver used. Inexpensive GPS models are
48 available with a claimed PPS signal accuracy of
49 1 μs or better relative to the broadcast
50 signal. However, in most cases the actual accuracy is limited by the
51 precision of the timecode and the latencies of the serial interface and
52 operating system.
53 </p>
54 <p>
55 If the Operating System supports PPSAPI
56 (<a href="http://www.ietf.org/rfc/rfc2783.txt">RFC 2783</a>), fudge flag1
57 1 enables its use.
58 </p>
59 <p>
60 The various GPS sentences that this driver recognises look like this:<br>
61 (others quietly ignored)
62 </p>
63
64 <p><table class="dlstable" border="1">
65 <caption>Accepted NMEA sentences</caption>
66 <tbody><tr>
67 <th>Sentence</th>
68 <th>Vendor</th>
69 </tr><tr>
70 <td class="ttf">$GPRMC,UTC,POS_STAT,LAT,LAT_REF,LON,LON_REF,SPD,HDG,DATE,MAG_VAR,MAG_REF*CS<cr><lf></td>
71 </tr><tr>
72 <td class="ttf">$GPGLL,LAT,LAT_REF,LON,LON_REF,UTC,POS_STAT*CS<cr><lf></td>
73 </tr><tr>
74 <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>
75 </tr><tr>
76 <td class="ttf">$GPZDA,UTC,DD,MM,YYYY,TH,TM,*CS<cr><lf></td>
77 </tr><tr>
78 <td class="ttf">$GPZDG,GPSTIME,DD,MM,YYYY,AA.BB,V*CS<cr><lf></td>
79 <td>Accord</td>
80 </tr>
81 </tbody></table></p>
82
83 <p><table class="dlstable" border="1">
84 <caption>NMEA data items</caption>
85 <tbody><tr>
86 <th>Symbol</th>
87 <th>Meaning and Format</th>
88 </tr>
89
90 <tr>
91 <td class="ttf">UTC</td>
92 <td>Time of day on UTC timescale. Hours, minutes and seconds [fraction (opt.)]. (hhmmss[.fff])</td>
93 </tr><tr>
94 <td class="ttf">POS_STAT</td>
95 <td>Position status. (A = Data valid, V = Data invalid)</td>
96 </tr><tr>
97 <td class="ttf">LAT</td>
98 <td>Latitude (llll.ll)</td>
99 </tr><tr>
100 <td class="ttf">LAT_REF</td>
101 <td>Latitude direction. (N = North, S = South)</td>
102 </tr><tr>
103 <td class="ttf">LON</td>
104 <td>Longitude (yyyyy.yy)</td>
105 </tr><tr>
106 <td class="ttf">LON_REF</td>
107 <td>Longitude direction (E = East, W = West)</td>
108 </tr><tr>
109 <td class="ttf">SPD</td>
110 <td>Speed over ground. (knots) (x.x)</td>
111 </tr><tr>
112 <td class="ttf">HDG</td>
113 <td>Heading/track made good (degrees True) (x.x)</td>
114 </tr><tr>
115 <td class="ttf">DATE</td>
116 <td>Date (ddmmyy)</td>
117 </tr><tr>
118 <td class="ttf">MAG_VAR</td>
119 <td>Magnetic variation (degrees) (x.x)</td>
120 </tr><tr>
121 <td class="ttf">MAG_REF</td>
122 <td>Magnetic variation (E = East, W = West)</td>
123 </tr><tr>
124 <td class="ttf">FIX_MODE</td>
125 <td>Position Fix Mode (0 = Invalid, >0 = Valid)</td>
126 </tr><tr>
127 <td class="ttf">SAT_USED</td>
128 <td>Number of Satellites used in solution</td>
129 </tr><tr>
130 <td class="ttf">HDOP</td>
131 <td>Horizontal Dilution of Precision</td>
132 </tr><tr>
133 <td class="ttf">ALT</td>
134 <td>Antenna Altitude</td>
135 </tr><tr>
136 <td class="ttf">ALT_UNIT</td>
137 <td>Altitude Units (Metres/Feet)</td>
138 </tr><tr>
139 <td class="ttf">GEO</td>
140 <td>Geoid/Elipsoid separation</td>
141 </tr><tr>
142 <td class="ttf">G_UNIT</td>
143 <td>Geoid units (M/F)</td>
144 </tr><tr>
145 <td class="ttf">D_AGE</td>
146 <td>Age of last DGPS Fix</td>
147 </tr><tr>
148 <td class="ttf">D_REF</td>
149 <td>Reference ID of DGPS station</td>
150 </tr><tr>
151 <td class="ttf">GPSTIME</td>
152 <td>Time of day on GPS timescale. Hours, minutes and seconds [fraction (opt.)]. (hhmmss[.f])</td>
153 </tr><tr>
154 <td class="ttf">DD</td>
155 <td>Day of the month (1-31)</td>
156 </tr><tr>
157 <td class="ttf">MM</td>
158 <td>Month of the year (1-12)</td>
159 </tr><tr>
160 <td class="ttf">YYYY</td>
161 <td>Year</td>
162 </tr><tr>
163 <td class="ttf">AA.BB</td>
164 <td>Denotes the signal strength (should be < 05.00)</td>
165 </tr><tr>
166 <td class="ttf">V</td>
167 <td>GPS sync status<br>
168 '0' => INVALID time,<br>
169 '1' => accuracy of +/- 20ms,<br>
170 '2' => accuracy of +/- 100ns</td>
171 </tr><tr>
172 <td class="ttf">CS</td>
173 <td> Checksum</td>
174 </tr><tr>
175 <td class="ttf"><cr><lf></td>
176 <td>Sentence terminator.</td>
177 </tr>
178 </tbody></table></p>
179
180
181 <h4>The 'mode' byte</h4>
182
183 <p>
184 Specific GPS sentences and bitrates may be selected by setting bits of
185 the 'mode' in the server configuration line:<br> <tt>server
186 127.127.20.x mode X</tt>
187 </p>
188
189 <table border="1">
190 <caption>mode byte bits and bit groups</caption>
191 <tbody><tr>
192 <th align="center">Bit</th>
193 <th align="center">Dec.</th>
194 <th align="left">Meaning</th>
195 </tr>
196
197 <tr>
198 <td align="center">0</td>
199 <td align="center">1</td>
200 <td>process <tt>$GPMRC</tt></td>
201 </tr><tr>
202 <td align="center">1</td>
203 <td align="center">2</td>
204 <td>process <tt>$GPGGA</tt></td>
205 </tr><tr>
206 <td align="center">2</td>
207 <td align="center">4</td>
208 <td>process <tt>$GPGLL</tt></td>
209 </tr><tr>
210 <td align="center">3</td>
211 <td align="center">8</td>
212 <td>process <tt>$GPZDA</tt> or <tt>$GPZDG</tt></td>
213 </tr><tr>
214 <td rowspan="6" align="center">4-6</td>
215 <td align="center">0</td>
216 <td>linespeed 4800 bps</td>
217 </tr><tr>
218 <td align="center">16</td>
219 <td>linespeed 9600 bps</td>
220 </tr><tr>
221 <td align="center">32</td>
222 <td>linespeed 19200 bps</td>
223 </tr><tr>
224 <td align="center">48</td>
225 <td>linespeed 38400 bps</td>
226 </tr><tr>
227 <td align="center">64</td>
228 <td>linespeed 57600 bps</td>
229 </tr><tr>
230 <td align="center">80</td>
231 <td>linespeed 115200 bps</td>
232 </tr><tr>
233 <td align="center">7</td>
234 <td align="center">128</td>
235 <td>Write the sub-second fraction of the receive time stamp to the
236 clockstat file for all recognised NMEA sentences. This can be used to
237 get a useful value for fudge time2.<br><strong>Caveat:</strong> This
238 will fill your clockstat file rather fast. Use it only temporarily to
239 get the numbers for the NMEA sentence of your choice.</td>
240 </tr>
241 </tbody></table>
242
243
244 <p>
245 The default (mode 0) is to process all supported sentences at a linespeed
246 of 4800 bps, which results in the first one received and recognised in
247 each cycle being used. If only specific sentences should be
248 recognised, then the mode byte must be chosen to enable only the selected
249 ones. Multiple sentences may be selected by adding their mode bit
250 values, but of those enabled still only the first received sentence in a
251 cycle will be used. Using more than one sentence per cycle is
252 impossible, because
253 </p><ul>
254 <li>there is only <a href="#fudgetime2">fudge time2</a> available to
255 compensate for transmission delays but every sentence would need a
256 different one and
257 </li><li>using more than one sentence per cycle overstuffs the internal data
258 filters.
259 </li></ul>
260 The driver uses 4800 bits per second by default, but faster bitrates can
261 be selected using bits 4 to 6 of the mode field.
262 <p></p>
263
264 <p>
265 <strong>Caveat:</strong> Using higher line speeds does not necessarily
266 increase the precision of the timing device. Higher line speeds are
267 not necessarily helpful for the NMEA driver, either. They can be
268 used to accomodate for an amount of data that does not fit into a
269 1-second cycle at 4800 bps, but high-speed high-volume NMEA data is likely
270 to cause trouble with the serial line driver since NMEA supports no
271 protocol handshake. Any device that is exclusively used for time
272 synchronisation purposes should be configured to transmit the relevant
273 data only, e.g. one <tt>$GPRMC</tt> or <tt>$GPZDA</tt> per second, at a
274 linespeed of 4800 bps or 9600 bps.
275 </p>
276
277 <p>
278 <a href="https://support.ntp.org/bin/view/Support/ConfiguringNMEARefclocks">Configuring
279 NMEA Refclocks</a> might give further useful hints for specific hardware
280 devices that exhibit strange or curious behaviour.
281 </p>
282
283 <p>
284 To make a specific setting, select the corresponding decimal values from
285 the mode byte table, add them all together and enter the resulting
286 decimal value into the clock configuration line.
287 </p>
288
289 <h4>Setting up the Garmin GPS-25XL</h4>
290
291 Switch off all output with by sending it the following string.
292 <pre>"$PGRMO,,2<cr><lf>"</pre>
293 <p>Now switch only $GPRMC on by sending it the following string.</p>
294 <pre>"$PGRMO,GPRMC,1<cr><lf>"</pre>
295
296 <p>On some systems the PPS signal isn't switched on by default. It can be
297 switched on by sending the following string.</p>
298 <pre>"$PGRMC,,,,,,,,,,,,2<cr><lf>"</pre>
299
300 <h4>Monitor Data</h4>
301
302 <p>The GPS sentence that is used is written to the clockstats file and
303 available with ntpq -c clockvar.</p>
304
305 <h4>Fudge Factors</h4>
306
307 <dl>
308 <dt><tt>time1 <i>time</i></tt></dt>
309 <dd>Specifies the PPS time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
310 <dt><a name="fudgetime2"><tt>time2 <i>time</i></tt></a></dt>
311 <dd>Specifies the serial end of line time offset calibration factor, in seconds and fraction, with default
312 0.0.</dd>
313 <dt><tt>stratum <i>number</i></tt></dt>
314 <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
315 <dt><tt>refid <i>string</i></tt></dt>
316 <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with
317 default <tt>GPS</tt>.</dd>
318 <dt><tt>flag1 0 | 1</tt></dt>
319 <dd>Disable PPS signal processing if 0 (default); enable PPS signal processing if 1.</dd>
320 <dt><tt>flag2 0 | 1</tt></dt>
321 <dd>If PPS signal processing is enabled, capture the pulse on the rising edge if 0 (default); capture on the
322 falling edge if 1.</dd>
323 <dt><tt>flag3 0 | 1</tt></dt>
324 <dd>If PPS signal processing is enabled, use the <tt>ntpd</tt> clock discipline if 0 (default); use the kernel
325 discipline if 1.</dd>
326 <dt><tt>flag4 0 | 1</tt></dt>
327 <dd>Obscures location in timecode: 0 for disable (default), 1 for enable.</dd>
328 </dl>
329
330 <p>Additional Information</p>
331 <p><a href="../refclock.html">Reference Clock Drivers</a></p>
332 <hr>
333 <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
334 </body></html>
335