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