parsedata.html revision 303975
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 3<html> 4 5 <head> 6 <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> 7 <meta name="generator" content="HTML Tidy, see www.w3.org"> 8 <title>NTP PARSE clock data formats</title> 9 <link href="scripts/style.css" type="text/css" rel="stylesheet"> 10 </head> 11 12 <body> 13 <h3>NTP PARSE clock data formats</h3> 14 <p>The parse driver currently supports several clocks with different query mechanisms. In order for you to find a sample that might be similar to a clock you might want to integrate into parse I'll sum up the major features of the clocks (this information is distributed in the parse/clk_*.c and ntpd/refclock_parse.c files).</p> 15<p>Last update: 16 <!-- #BeginDate format:En2m -->21-Oct-2010 23:44<!-- #EndDate --> 17 UTC</p> 18 <hr> 19 <h4>Meinberg clocks</h4> 20 <pre> 21Meinberg: start=<STX>, end=<ETX>, sync on start 22 pattern="\2D: . . ;T: ;U: . . ; \3" 23 pattern="\2 . . ; ; : : ; \3" 24 pattern="\2 . . ; ; : : ; : ; ; . . " 25</pre> 26 <p>Meinberg is a German manufacturer of time code receivers. Those clocks have a pretty common output format in the stock version. In order to support NTP Meinberg was so kind to produce some special versions of the firmware for the use with NTP. So, if you are going to use a Meinberg clock please ask whether there is a special Uni Erlangen version. You can reach <a href="http://www.meinberg.de/">Meinberg</a> via the Web. Information can also be ordered via eMail from <a href="mailto:%20info@meinberg.de">info@meinberg.de</a></p> 27 <p>General characteristics:<br> 28 Meinberg clocks primarily output pulse per second and a describing ASCII string. This string can be produced in two modes: either upon the reception of a question mark or every second. NTP uses the latter mechanism. DCF77 AM clocks have a limited accuracy of a few milliseconds. The DCF77 PZF5xx variants provide higher accuracy and have a pretty good relationship between RS232 time code and the PPS signal. Except for early versions of the old GPS166 receiver type, Meinberg GPS receivers have a very good timing relationship between the datagram and the pulse. The beginning of the start bit of the first character has basically the same accuracy as the PPS signal, plus a jitter of up to 1 bit time depending on the selected baud rate, i.e. 52 μs @ 19200. PPS support should always be used, if possible, in order to yield the highest possible accuracy.</p> 29 <p>The preferred tty setting for Meinberg DCF77 receivers is 9600/7E2:</p> 30 <pre> 31 CFLAG (B9600|CS7|PARENB|CREAD|HUPCL) 32 IFLAG (IGNBRK|IGNPAR|ISTRIP) 33 OFLAG 0 34 LFLAG 0 35 </pre> 36 <p>The tty setting for Meinberg GPS16x/17x receivers is 19200/8N1:</p> 37 <pre> 38 CFLAG (B19200|CS8|PARENB|CREAD|HUPCL) 39 IFLAG (IGNBRK|IGNPAR|ISTRIP) 40 OFLAG 0 41 LFLAG 0 42 </pre> 43 <p>All clocks should be run at datagram once per second.<br><br></p> 44 <p>Format of the Meinberg standard time string:</p> 45<pre> 46 <b><i><STX></i>D:<i>dd.mm.yy</i>;T:<i>w</i>;U:<i>hh.mm.ss</i>;<i>uvxy</i><i><ETX></i></b> 47 pos: 0 000000001111111111222222222233 3 48 1 234567890123456789012345678901 2 49 50 <i><STX></i> = start-of-text, ASCII code 0x02 51 <i>dd.mm.yy</i> = day of month, month, year of the century, separated by dots 52 <i>w</i> = day of week (1..7, Monday = 1) 53 <i>hh:mm:ss</i> = hour, minute, second, separated by dots 54 <i>u</i> = '#' for GPS receivers: time is <b>not</b> synchronized 55 '#' for older PZF5xx receivers: no correlation, not synchronized 56 '#' for other devices: never sync'ed since powerup 57 ' ' if nothing of the above applies 58 <i>v</i> = '*' for GPS receivers: position has <b>not</b> been verified 59 '*' for other devices: freewheeling based on internal quartz 60 ' ' if nothing of the above applies 61 <i>x</i> = 'U' if UTC time is transmitted 62 'S' if daylight saving time is active 63 ' ' if nothing of the above applies 64 <i>y</i> = '!' during the hour preceding start or end of daylight saving time 65 'A' during the hour preceding a leap second 66 ' ' if nothing of the above applies 67 <i><ETX></i> = end-of-text, ASCII code 0x03 68</pre> 69 <p>Format of the Uni Erlangen time string for PZF5xx receivers:</p> 70<pre> 71 <b><i><STX></i><i>dd.mm.yy</i>; <i>w</i>; <i>hh:mm:ss</i>; <i>tuvxyza</i><i><ETX></i></b> 72 pos: 0 000000001111111111222222222233 3 73 1 234567890123456789012345678901 2 74 75 <i><STX></i> = start-of-text, ASCII code 0x02 76 <i>dd.mm.yy</i> = day of month, month, year of the century, separated by dots 77 <i>w</i> = day of week (1..7, Monday = 1) 78 <i>hh:mm:ss</i> = hour, minute, second, separated by colons 79 80 <i>t</i> = 'U' if UTC time is transmitted, else ' ' 81 <i>u</i> = '#' for older PZF5xx receivers: no correlation, not synchronized 82 '#' for PZF511 and newer: never sync'ed since powerup 83 ' ' if nothing of the above applies 84 <i>v</i> = '*' if freewheeling based on internal quartz, else ' ' 85 <i>x</i> = 'S' if daylight saving time is active, else ' ' 86 <i>y</i> = '!' during the hour preceding start or end of daylight saving time, else ' ' 87 <i>z</i> = 'A' during the hour preceding a leap second, else ' ' 88 <i>a</i> = 'R' alternate antenna (reminiscent of PZF5xx), usually ' ' for GPS receivers 89 <i><ETX></i> = end-of-text, ASCII code 0x03 90</pre> 91 <p>Format of the Uni Erlangen time string for GPS16x/GPS17x receivers:</p> 92<pre> 93 <b><i><STX></i><i>dd.mm.yy</i>; <i>w</i>; <i>hh:mm:ss</i>; <i>+uu:uu</i>; <i>uvxyzab</i>; <i>ll.lllln</i> <i>lll.lllle</i> <i>hhhh</i>m<i><ETX></i></b> 94 pos: 0 0000000011111111112222222222333333333344444444445555555555666666 6 95 1 2345678901234567890123456789012345678901234567890123456789012345 6 96 97 <i><STX></i> = start-of-text, ASCII code 0x02 98 <i>dd.mm.yy</i> = day of month, month, year of the century, separated by dots 99 <i>w</i> = day of week (1..7, Monday = 1) 100 <i>hh:mm:ss</i> = hour, minute, second, separated by colons 101 <i>+uu:uu</i> = offset to UTC in hours and minutes, preceded by + or - 102 <i>u</i> = '#' if time is <b>not</b> synchronized, else ' ' 103 <i>v</i> = '*' if position has <b>not</b> been verified, else ' ' 104 <i>x</i> = 'S' if daylight saving time is active, else ' ' 105 <i>y</i> = '!' during the hour preceding start or end of daylight saving time, else ' ' 106 <i>z</i> = 'A' during the hour preceding a leap second, else ' ' 107 <i>a</i> = 'R' alternate antenna (reminiscent of PZF5xx), usually ' ' for GPS receivers 108 <i>b</i> = 'L' during a leap second, i.e. if the seconds field is 60, else ' ' 109 <i>ll.lllln</i> = position latitude in degrees, 'n' can actually be 'N' or 'S', i.e. North or South 110 <i>lll.lllle</i> = position longitude in degrees, 'e' can actually be 'E' or 'W', i.e. East or West 111 <i>hhhh</i> = position altitude in meters, always followed by 'm' 112 <i><ETX></i> = end-of-text, ASCII code 0x03 113</pre> 114 <p>Examples for Uni Erlangen strings from GPS receivers:</p> 115<pre> 116 \x02 09.07.93; 5; 08:48:26; +00:00; ; 49.5736N 11.0280E 373m \x03 117 \x02 08.11.06; 3; 14:39:39; +00:00; ; 51.9828N 9.2258E 176m \x03 118</pre> 119 <p>The Uni Erlangen formats should be used preferably. Newer Meinberg GPS receivers can be configured to transmit that format, for older devices there may be a special firmware version available.</p> 120 <p>For the Meinberg parse look into clk_meinberg.c<br><br></p> 121 <hr> 122 <h4>Raw DCF77 Data via serial line</h4> 123 <p>RAWDCF: end=TIMEOUT>1.5s, sync each char (any char),generate psuedo time codes, fixed format</p> 124 <p>direct DCF77 code input</p> 125 <p>In Europe it is relatively easy/cheap the receive the german time code transmitter DCF77. The simplest version to process its signal is to feed the 100/200ms pulse of the demodulated AM signal via a level converter to an RS232 port at 50Baud. parse/clk_rawdcf.c holds all necessary decoding logic for the time code which is transmitted each minute for one minute. A bit of the time code is sent once a second.</p> 126 <pre> 127 The preferred tty setting is: 128 CFLAG (B50|CS8|CREAD|CLOCAL) 129 IFLAG 0 130 OFLAG 0 131 LFLAG 0 132</pre> 133 <h4>DCF77 raw time code</h4> 134 <p>From "Zur Zeit", Physikalisch-Technische Bundesanstalt (PTB), Braunschweig und Berlin, März 1989<br> 135 </p> 136 <p>Timecode transmission:</p> 137 <pre> 138 AM: 139 140 time marks are send every second except for the second before the 141 next minute mark 142 time marks consist of a reduction of transmitter power to 25% 143 of the nominal level 144 the falling edge is the time indication (on time) 145 time marks of a 100ms duration constitute a logical 0 146 time marks of a 200ms duration constitute a logical 1 147</pre> 148 <p>see the spec. (basically a (non-)inverted psuedo random phase shift) encoding:</p> 149 <pre> 150 FM: 151 152 Second Contents 153 0 - 10 AM: free, FM: 0 154 11 - 14 free 155 15 R - alternate antenna 156 16 A1 - expect zone change (1 hour before) 157 17 - 18 Z1,Z2 - time zone 158 0 0 illegal 159 0 1 MEZ (MET) 160 1 0 MESZ (MED, MET DST) 161 1 1 illegal 162 19 A2 - expect leap insertion/deletion (1 hour before) 163 20 S - start of time code (1) 164 21 - 24 M1 - BCD (lsb first) Minutes 165 25 - 27 M10 - BCD (lsb first) 10 Minutes 166 28 P1 - Minute Parity (even) 167 29 - 32 H1 - BCD (lsb first) Hours 168 33 - 34 H10 - BCD (lsb first) 10 Hours 169 35 P2 - Hour Parity (even) 170 36 - 39 D1 - BCD (lsb first) Days 171 40 - 41 D10 - BCD (lsb first) 10 Days 172 42 - 44 DW - BCD (lsb first) day of week (1: Monday -> 7: Sunday) 173 45 - 49 MO1 - BCD (lsb first) Month 174 50 MO10 - 10 Months 175 51 - 53 Y1 - BCD (lsb first) Years 176 54 - 57 Y10 - BCD (lsb first) 10 Years 177 58 P3 - Date Parity (even) 178 59 - usually missing (minute indication), except for leap insertion 179</pre> 180 <hr> 181 <h4>Schmid clock</h4> 182 <p>Schmid clock: needs poll, binary input, end='\xFC', sync start</p> 183 <p>The Schmid clock is a DCF77 receiver that sends a binary time code at the reception of a flag byte. The contents if the flag byte determined the time code format. The binary time code is delimited by the byte 0xFC.</p> 184 <pre> 185 TTY setup is: 186 CFLAG (B1200|CS8|CREAD|CLOCAL) 187 IFLAG 0 188 OFLAG 0 189 LFLAG 0 190 191</pre> 192 <p>The command to Schmid's DCF77 clock is a single byte; each bit allows the user to select some part of the time string, as follows (the output for the lsb is sent first).</p> 193 <pre> 194 Bit 0: time in MEZ, 4 bytes *binary, not BCD*; hh.mm.ss.tenths 195 Bit 1: date 3 bytes *binary, not BCD: dd.mm.yy 196 Bit 2: week day, 1 byte (unused here) 197 Bit 3: time zone, 1 byte, 0=MET, 1=MEST. (unused here) 198 Bit 4: clock status, 1 byte, 0=time invalid, 199 1=time from crystal backup, 200 3=time from DCF77 201 Bit 5: transmitter status, 1 byte, 202 bit 0: backup antenna 203 bit 1: time zone change within 1h 204 bit 3,2: TZ 01=MEST, 10=MET 205 bit 4: leap second will be 206 added within one hour 207 bits 5-7: Zero 208 Bit 6: time in backup mode, units of 5 minutes (unused here) 209</pre> 210 <hr> 211 <h4>Trimble SV6 ASCII time code (TAIP)</h4> 212 <p>Trimble SV6: needs poll, ascii timecode, start='>', end='<', query='>QTM<', eol='<'</p> 213 <p>Trimble SV6 is a GPS receiver with PPS output. It needs to be polled. It also need a special tty mode setup (EOL='<').</p> 214 <pre> 215 TTY setup is: 216 CFLAG (B4800|CS8|CREAD) 217 IFLAG (BRKINT|IGNPAR|ISTRIP|ICRNL|IXON) 218 OFLAG (OPOST|ONLCR) 219 LFLAG (ICANON|ECHOK) 220</pre> 221 <p>Special flags are:</p> 222 <pre> PARSE_F_PPSPPS - use CIOGETEV for PPS time stamping 223 PARSE_F_PPSONSECOND - the time code is not related to 224 the PPS pulse (so use the time code 225 only for the second epoch) 226 227 Timecode 228 0000000000111111111122222222223333333 / char 229 0123456789012345678901234567890123456 \ posn 230 >RTMhhmmssdddDDMMYYYYoodnnvrrrrr;*xx< Actual 231 ----33445566600112222BB7__-_____--99- Parse 232 >RTM 1 ;* < Check 233</pre> 234 <hr> 235 <h4>ELV DCF7000</h4> 236 <p>ELV DCF7000: end='\r', pattern=" - - - - - - - \r"</p> 237 <p>The ELV DCF7000 is a cheap DCF77 receiver sending each second a time code (though not very precise!) delimited by '`r'</p> 238 <pre> 239 Timecode 240 YY-MM-DD-HH-MM-SS-FF\r 241 242 FF&0x1 - DST 243 FF&0x2 - DST switch warning 244 FF&0x4 - unsynchronised 245</pre> 246 <hr> 247 <h4>HOPF 6021 und Kompatible</h4> 248 <p>HOPF Funkuhr 6021 mit serieller Schnittstelle Created by F.Schnekenbuehl <frank@comsys.dofn.de> from clk_rcc8000.c Nortel DASA Network Systems GmbH, Department: ND250 A Joint venture of Daimler-Benz Aerospace and Nortel.</p> 249 <pre> 250 hopf Funkuhr 6021 251 used with 9600,8N1, 252 UTC via serial line 253 "Sekundenvorlauf" ON 254 ETX zum Sekundenvorlauf ON 255 dataformat 6021 256 output time and date 257 transmit with control characters 258 transmit evry second 259 </pre> 260 <p>Type 6021 Serial Output format</p> 261 <pre> 262 000000000011111111 / char 263 012345678901234567 \ position 264 sABHHMMSSDDMMYYnre Actual 265 C4110046231195 Parse 266 s enr Check 267 268 s = STX (0x02), e = ETX (0x03) 269 n = NL (0x0A), r = CR (0x0D) 270 271 A B - Status and weekday 272 273 A - Status 274 275 8 4 2 1 276 x x x 0 - no announcement 277 x x x 1 - Summertime - wintertime - summertime announcement 278 x x 0 x - Wintertime 279 x x 1 x - Summertime 280 0 0 x x - Time/Date invalid 281 0 1 x x - Internal clock used 282 1 0 x x - Radio clock 283 1 1 x x - Radio clock highprecision 284 285 B - 8 4 2 1 286 0 x x x - MESZ/MEZ 287 1 x x x - UTC 288 x 0 0 1 - Monday 289 x 0 1 0 - Tuesday 290 x 0 1 1 - Wednesday 291 x 1 0 0 - Thursday 292 x 1 0 1 - Friday 293 x 1 1 0 - Saturday 294 x 1 1 1 - Sunday 295</pre> 296 <hr> 297 <h4>Diem Computime Clock</h4> 298 <p>The Computime receiver sends a datagram in the following format every minute</p> 299 <pre> 300 Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLF 301 Pos 0123456789012345678901 2 3 302 0000000000111111111122 2 2 303 Parse T: : : : : : : \r\n 304 305 T Startcharacter "T" specifies start of the timestamp 306 YY Year MM Month 1-12 307 MD Day of the month 308 WD Day of week 309 HH Hour 310 MM Minute 311 SS Second 312 CR Carriage return 313 LF Linefeed 314</pre> 315 <hr> 316 <h4>WHARTON 400A Series Clock with a 404.2 Serial interface</h4> 317 <p>The WHARTON 400A Series clock is able to send date/time serial messages in 7 output formats. We use format 1 here because it is the shortest. We set up the clock to send a datagram every second. For use with this driver, the WHARTON 400A Series clock must be set-up as follows :</p> 318 <pre> 319 Programmable Selected 320 Option No Option 321 BST or CET display 3 9 or 11 322 No external controller 7 0 323 Serial Output Format 1 9 1 324 Baud rate 9600 bps 10 96 325 Bit length 8 bits 11 8 326 Parity even 12 E 327</pre> 328 <p>WHARTON 400A Series output format 1 is as follows :</p> 329 <pre> 330 Timestamp STXssmmhhDDMMYYSETX 331 Pos 0 12345678901234 332 0 00000000011111 333 334 STX start transmission (ASCII 0x02) 335 ETX end transmission (ASCII 0x03) 336 ss Second expressed in reversed decimal (units then tens) 337 mm Minute expressed in reversed decimal 338 hh Hour expressed in reversed decimal 339 DD Day of month expressed in reversed decimal 340 MM Month expressed in reversed decimal (January is 1) 341 YY Year (without century) expressed in reversed decimal 342 S Status byte : 0x30 + 343 bit 0 0 = MSF source 1 = DCF source 344 bit 1 0 = Winter time 1 = Summer time 345 bit 2 0 = not synchronised 1 = synchronised 346 bit 3 0 = no early warning 1 = early warning 347</pre> 348 <hr> 349 <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script> 350 </body> 351 352</html> 353