1132451Sroberto<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2132451Sroberto 3132451Sroberto<html> 4132451Sroberto 5182007Sroberto <head> 6182007Sroberto <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> 7182007Sroberto <meta name="generator" content="HTML Tidy, see www.w3.org"> 8182007Sroberto <title>NTP PARSE clock data formats</title> 9182007Sroberto <link href="scripts/style.css" type="text/css" rel="stylesheet"> 10182007Sroberto </head> 11132451Sroberto 12182007Sroberto <body> 13182007Sroberto <h3>NTP PARSE clock data formats</h3> 14182007Sroberto <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> 15182007Sroberto <hr> 16182007Sroberto <h4>Meinberg clocks</h4> 17182007Sroberto <pre> 18132451SrobertoMeinberg: start=<STX>, end=<ETX>, sync on start 19132451Sroberto pattern="\2D: . . ;T: ;U: . . ; \3" 20132451Sroberto pattern="\2 . . ; ; : : ; \3" 21132451Sroberto pattern="\2 . . ; ; : : ; : ; ; . . " 22132451Sroberto</pre> 23182007Sroberto <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> 24182007Sroberto <p>General characteristics:<br> 25182007Sroberto 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> 26182007Sroberto <p>The preferred tty setting for Meinberg DCF77 receivers is 9600/7E2:</p> 27182007Sroberto <pre> 28132451Sroberto CFLAG (B9600|CS7|PARENB|CREAD|HUPCL) 29132451Sroberto IFLAG (IGNBRK|IGNPAR|ISTRIP) 30132451Sroberto OFLAG 0 31132451Sroberto LFLAG 0 32132451Sroberto </pre> 33182007Sroberto <p>The tty setting for Meinberg GPS16x/17x receivers is 19200/8N1:</p> 34182007Sroberto <pre> 35132451Sroberto CFLAG (B19200|CS8|PARENB|CREAD|HUPCL) 36132451Sroberto IFLAG (IGNBRK|IGNPAR|ISTRIP) 37132451Sroberto OFLAG 0 38132451Sroberto LFLAG 0 39132451Sroberto </pre> 40182007Sroberto <p>All clocks should be run at datagram once per second.<br><br></p> 41182007Sroberto <p>Format of the Meinberg standard time string:</p> 42182007Sroberto<pre> 43182007Sroberto <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> 44182007Sroberto pos: 0 000000001111111111222222222233 3 45182007Sroberto 1 234567890123456789012345678901 2 46132451Sroberto 47182007Sroberto <i><STX></i> = start-of-text, ASCII code 0x02 48182007Sroberto <i>dd.mm.yy</i> = day of month, month, year of the century, separated by dots 49182007Sroberto <i>w</i> = day of week (1..7, Monday = 1) 50182007Sroberto <i>hh:mm:ss</i> = hour, minute, second, separated by dots 51182007Sroberto <i>u</i> = '#' for GPS receivers: time is <b>not</b> synchronized 52182007Sroberto '#' for older PZF5xx receivers: no correlation, not synchronized 53182007Sroberto '#' for other devices: never sync'ed since powerup 54182007Sroberto ' ' if nothing of the above applies 55182007Sroberto <i>v</i> = '*' for GPS receivers: position has <b>not</b> been verified 56182007Sroberto '*' for other devices: freewheeling based on internal quartz 57182007Sroberto ' ' if nothing of the above applies 58182007Sroberto <i>x</i> = 'U' if UTC time is transmitted 59182007Sroberto 'S' if daylight saving time is active 60182007Sroberto ' ' if nothing of the above applies 61182007Sroberto <i>y</i> = '!' during the hour preceding start or end of daylight saving time 62182007Sroberto 'A' during the hour preceding a leap second 63182007Sroberto ' ' if nothing of the above applies 64182007Sroberto <i><ETX></i> = end-of-text, ASCII code 0x03 65132451Sroberto</pre> 66182007Sroberto <p>Format of the Uni Erlangen time string for PZF5xx receivers:</p> 67182007Sroberto<pre> 68182007Sroberto <b><i><STX></i><i>dd.mm.yy</i>; <i>w</i>; <i>hh:mm:ss</i>; <i>tuvxyza</i><i><ETX></i></b> 69182007Sroberto pos: 0 000000001111111111222222222233 3 70182007Sroberto 1 234567890123456789012345678901 2 71182007Sroberto 72182007Sroberto <i><STX></i> = start-of-text, ASCII code 0x02 73182007Sroberto <i>dd.mm.yy</i> = day of month, month, year of the century, separated by dots 74182007Sroberto <i>w</i> = day of week (1..7, Monday = 1) 75182007Sroberto <i>hh:mm:ss</i> = hour, minute, second, separated by colons 76182007Sroberto 77182007Sroberto <i>t</i> = 'U' if UTC time is transmitted, else ' ' 78182007Sroberto <i>u</i> = '#' for older PZF5xx receivers: no correlation, not synchronized 79182007Sroberto '#' for PZF511 and newer: never sync'ed since powerup 80182007Sroberto ' ' if nothing of the above applies 81182007Sroberto <i>v</i> = '*' if freewheeling based on internal quartz, else ' ' 82182007Sroberto <i>x</i> = 'S' if daylight saving time is active, else ' ' 83182007Sroberto <i>y</i> = '!' during the hour preceding start or end of daylight saving time, else ' ' 84182007Sroberto <i>z</i> = 'A' during the hour preceding a leap second, else ' ' 85182007Sroberto <i>a</i> = 'R' alternate antenna (reminiscent of PZF5xx), usually ' ' for GPS receivers 86182007Sroberto <i><ETX></i> = end-of-text, ASCII code 0x03 87132451Sroberto</pre> 88182007Sroberto <p>Format of the Uni Erlangen time string for GPS16x/GPS17x receivers:</p> 89182007Sroberto<pre> 90182007Sroberto <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> 91182007Sroberto pos: 0 0000000011111111112222222222333333333344444444445555555555666666 6 92182007Sroberto 1 2345678901234567890123456789012345678901234567890123456789012345 6 93182007Sroberto 94182007Sroberto <i><STX></i> = start-of-text, ASCII code 0x02 95182007Sroberto <i>dd.mm.yy</i> = day of month, month, year of the century, separated by dots 96182007Sroberto <i>w</i> = day of week (1..7, Monday = 1) 97182007Sroberto <i>hh:mm:ss</i> = hour, minute, second, separated by colons 98182007Sroberto <i>+uu:uu</i> = offset to UTC in hours and minutes, preceded by + or - 99182007Sroberto <i>u</i> = '#' if time is <b>not</b> synchronized, else ' ' 100182007Sroberto <i>v</i> = '*' if position has <b>not</b> been verified, else ' ' 101182007Sroberto <i>x</i> = 'S' if daylight saving time is active, else ' ' 102182007Sroberto <i>y</i> = '!' during the hour preceding start or end of daylight saving time, else ' ' 103182007Sroberto <i>z</i> = 'A' during the hour preceding a leap second, else ' ' 104182007Sroberto <i>a</i> = 'R' alternate antenna (reminiscent of PZF5xx), usually ' ' for GPS receivers 105182007Sroberto <i>b</i> = 'L' during a leap second, i.e. if the seconds field is 60, else ' ' 106182007Sroberto <i>ll.lllln</i> = position latitude in degrees, 'n' can actually be 'N' or 'S', i.e. North or South 107182007Sroberto <i>lll.lllle</i> = position longitude in degrees, 'e' can actually be 'E' or 'W', i.e. East or West 108182007Sroberto <i>hhhh</i> = position altitude in meters, always followed by 'm' 109182007Sroberto <i><ETX></i> = end-of-text, ASCII code 0x03 110132451Sroberto</pre> 111182007Sroberto <p>Examples for Uni Erlangen strings from GPS receivers:</p> 112182007Sroberto<pre> 113182007Sroberto \x02 09.07.93; 5; 08:48:26; +00:00; ; 49.5736N 11.0280E 373m \x03 114182007Sroberto \x02 08.11.06; 3; 14:39:39; +00:00; ; 51.9828N 9.2258E 176m \x03 115182007Sroberto</pre> 116182007Sroberto <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> 117182007Sroberto <p>For the Meinberg parse look into clk_meinberg.c<br><br></p> 118182007Sroberto <hr> 119182007Sroberto <h4>Raw DCF77 Data via serial line</h4> 120182007Sroberto <p>RAWDCF: end=TIMEOUT>1.5s, sync each char (any char),generate psuedo time codes, fixed format</p> 121182007Sroberto <p>direct DCF77 code input</p> 122182007Sroberto <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> 123182007Sroberto <pre> 124132451Sroberto The preferred tty setting is: 125132451Sroberto CFLAG (B50|CS8|CREAD|CLOCAL) 126132451Sroberto IFLAG 0 127132451Sroberto OFLAG 0 128132451Sroberto LFLAG 0 129132451Sroberto</pre> 130182007Sroberto <h4>DCF77 raw time code</h4> 131182007Sroberto <p>From "Zur Zeit", Physikalisch-Technische Bundesanstalt (PTB), Braunschweig und Berlin, März 1989<br> 132182007Sroberto </p> 133182007Sroberto <p>Timecode transmission:</p> 134182007Sroberto <pre> 135132451Sroberto AM: 136132451Sroberto 137132451Sroberto time marks are send every second except for the second before the 138132451Sroberto next minute mark 139132451Sroberto time marks consist of a reduction of transmitter power to 25% 140132451Sroberto of the nominal level 141132451Sroberto the falling edge is the time indication (on time) 142132451Sroberto time marks of a 100ms duration constitute a logical 0 143132451Sroberto time marks of a 200ms duration constitute a logical 1 144132451Sroberto</pre> 145182007Sroberto <p>see the spec. (basically a (non-)inverted psuedo random phase shift) encoding:</p> 146182007Sroberto <pre> 147132451Sroberto FM: 148132451Sroberto 149132451Sroberto Second Contents 150132451Sroberto 0 - 10 AM: free, FM: 0 151132451Sroberto 11 - 14 free 152132451Sroberto 15 R - alternate antenna 153132451Sroberto 16 A1 - expect zone change (1 hour before) 154132451Sroberto 17 - 18 Z1,Z2 - time zone 155132451Sroberto 0 0 illegal 156132451Sroberto 0 1 MEZ (MET) 157132451Sroberto 1 0 MESZ (MED, MET DST) 158132451Sroberto 1 1 illegal 159182007Sroberto 19 A2 - expect leap insertion/deletion (1 hour before) 160182007Sroberto 20 S - start of time code (1) 161132451Sroberto 21 - 24 M1 - BCD (lsb first) Minutes 162132451Sroberto 25 - 27 M10 - BCD (lsb first) 10 Minutes 163182007Sroberto 28 P1 - Minute Parity (even) 164132451Sroberto 29 - 32 H1 - BCD (lsb first) Hours 165182007Sroberto 33 - 34 H10 - BCD (lsb first) 10 Hours 166182007Sroberto 35 P2 - Hour Parity (even) 167132451Sroberto 36 - 39 D1 - BCD (lsb first) Days 168132451Sroberto 40 - 41 D10 - BCD (lsb first) 10 Days 169132451Sroberto 42 - 44 DW - BCD (lsb first) day of week (1: Monday -> 7: Sunday) 170182007Sroberto 45 - 49 MO1 - BCD (lsb first) Month 171182007Sroberto 50 MO10 - 10 Months 172132451Sroberto 51 - 53 Y1 - BCD (lsb first) Years 173132451Sroberto 54 - 57 Y10 - BCD (lsb first) 10 Years 174182007Sroberto 58 P3 - Date Parity (even) 175182007Sroberto 59 - usually missing (minute indication), except for leap insertion 176132451Sroberto</pre> 177182007Sroberto <hr> 178182007Sroberto <h4>Schmid clock</h4> 179182007Sroberto <p>Schmid clock: needs poll, binary input, end='\xFC', sync start</p> 180182007Sroberto <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> 181182007Sroberto <pre> 182132451Sroberto TTY setup is: 183132451Sroberto CFLAG (B1200|CS8|CREAD|CLOCAL) 184132451Sroberto IFLAG 0 185132451Sroberto OFLAG 0 186132451Sroberto LFLAG 0 187132451Sroberto 188132451Sroberto</pre> 189182007Sroberto <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> 190182007Sroberto <pre> 191132451Sroberto Bit 0: time in MEZ, 4 bytes *binary, not BCD*; hh.mm.ss.tenths 192132451Sroberto Bit 1: date 3 bytes *binary, not BCD: dd.mm.yy 193132451Sroberto Bit 2: week day, 1 byte (unused here) 194132451Sroberto Bit 3: time zone, 1 byte, 0=MET, 1=MEST. (unused here) 195132451Sroberto Bit 4: clock status, 1 byte, 0=time invalid, 196132451Sroberto 1=time from crystal backup, 197132451Sroberto 3=time from DCF77 198132451Sroberto Bit 5: transmitter status, 1 byte, 199132451Sroberto bit 0: backup antenna 200132451Sroberto bit 1: time zone change within 1h 201132451Sroberto bit 3,2: TZ 01=MEST, 10=MET 202132451Sroberto bit 4: leap second will be 203132451Sroberto added within one hour 204132451Sroberto bits 5-7: Zero 205132451Sroberto Bit 6: time in backup mode, units of 5 minutes (unused here) 206132451Sroberto</pre> 207182007Sroberto <hr> 208182007Sroberto <h4>Trimble SV6 ASCII time code (TAIP)</h4> 209182007Sroberto <p>Trimble SV6: needs poll, ascii timecode, start='>', end='<', query='>QTM<', eol='<'</p> 210182007Sroberto <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> 211182007Sroberto <pre> 212132451Sroberto TTY setup is: 213132451Sroberto CFLAG (B4800|CS8|CREAD) 214132451Sroberto IFLAG (BRKINT|IGNPAR|ISTRIP|ICRNL|IXON) 215132451Sroberto OFLAG (OPOST|ONLCR) 216132451Sroberto LFLAG (ICANON|ECHOK) 217132451Sroberto</pre> 218182007Sroberto <p>Special flags are:</p> 219182007Sroberto <pre> PARSE_F_PPSPPS - use CIOGETEV for PPS time stamping 220132451Sroberto PARSE_F_PPSONSECOND - the time code is not related to 221132451Sroberto the PPS pulse (so use the time code 222132451Sroberto only for the second epoch) 223132451Sroberto 224132451Sroberto Timecode 225132451Sroberto 0000000000111111111122222222223333333 / char 226132451Sroberto 0123456789012345678901234567890123456 \ posn 227132451Sroberto >RTMhhmmssdddDDMMYYYYoodnnvrrrrr;*xx< Actual 228132451Sroberto ----33445566600112222BB7__-_____--99- Parse 229132451Sroberto >RTM 1 ;* < Check 230132451Sroberto</pre> 231182007Sroberto <hr> 232182007Sroberto <h4>ELV DCF7000</h4> 233182007Sroberto <p>ELV DCF7000: end='\r', pattern=" - - - - - - - \r"</p> 234182007Sroberto <p>The ELV DCF7000 is a cheap DCF77 receiver sending each second a time code (though not very precise!) delimited by '`r'</p> 235182007Sroberto <pre> 236132451Sroberto Timecode 237132451Sroberto YY-MM-DD-HH-MM-SS-FF\r 238132451Sroberto 239132451Sroberto FF&0x1 - DST 240132451Sroberto FF&0x2 - DST switch warning 241132451Sroberto FF&0x4 - unsynchronised 242132451Sroberto</pre> 243182007Sroberto <hr> 244182007Sroberto <h4>HOPF 6021 und Kompatible</h4> 245182007Sroberto <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> 246182007Sroberto <pre> 247132451Sroberto hopf Funkuhr 6021 248132451Sroberto used with 9600,8N1, 249132451Sroberto UTC via serial line 250132451Sroberto "Sekundenvorlauf" ON 251132451Sroberto ETX zum Sekundenvorlauf ON 252132451Sroberto dataformat 6021 253132451Sroberto output time and date 254132451Sroberto transmit with control characters 255132451Sroberto transmit evry second 256132451Sroberto </pre> 257182007Sroberto <p>Type 6021 Serial Output format</p> 258182007Sroberto <pre> 259132451Sroberto 000000000011111111 / char 260132451Sroberto 012345678901234567 \ position 261132451Sroberto sABHHMMSSDDMMYYnre Actual 262132451Sroberto C4110046231195 Parse 263132451Sroberto s enr Check 264132451Sroberto 265132451Sroberto s = STX (0x02), e = ETX (0x03) 266132451Sroberto n = NL (0x0A), r = CR (0x0D) 267132451Sroberto 268132451Sroberto A B - Status and weekday 269132451Sroberto 270132451Sroberto A - Status 271132451Sroberto 272132451Sroberto 8 4 2 1 273132451Sroberto x x x 0 - no announcement 274132451Sroberto x x x 1 - Summertime - wintertime - summertime announcement 275132451Sroberto x x 0 x - Wintertime 276132451Sroberto x x 1 x - Summertime 277132451Sroberto 0 0 x x - Time/Date invalid 278132451Sroberto 0 1 x x - Internal clock used 279132451Sroberto 1 0 x x - Radio clock 280132451Sroberto 1 1 x x - Radio clock highprecision 281132451Sroberto 282132451Sroberto B - 8 4 2 1 283132451Sroberto 0 x x x - MESZ/MEZ 284132451Sroberto 1 x x x - UTC 285132451Sroberto x 0 0 1 - Monday 286132451Sroberto x 0 1 0 - Tuesday 287132451Sroberto x 0 1 1 - Wednesday 288132451Sroberto x 1 0 0 - Thursday 289132451Sroberto x 1 0 1 - Friday 290132451Sroberto x 1 1 0 - Saturday 291132451Sroberto x 1 1 1 - Sunday 292132451Sroberto</pre> 293182007Sroberto <hr> 294182007Sroberto <h4>Diem Computime Clock</h4> 295182007Sroberto <p>The Computime receiver sends a datagram in the following format every minute</p> 296182007Sroberto <pre> 297132451Sroberto Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLF 298132451Sroberto Pos 0123456789012345678901 2 3 299132451Sroberto 0000000000111111111122 2 2 300132451Sroberto Parse T: : : : : : : \r\n 301132451Sroberto 302132451Sroberto T Startcharacter "T" specifies start of the timestamp 303132451Sroberto YY Year MM Month 1-12 304132451Sroberto MD Day of the month 305132451Sroberto WD Day of week 306132451Sroberto HH Hour 307132451Sroberto MM Minute 308132451Sroberto SS Second 309132451Sroberto CR Carriage return 310132451Sroberto LF Linefeed 311132451Sroberto</pre> 312182007Sroberto <hr> 313182007Sroberto <h4>WHARTON 400A Series Clock with a 404.2 Serial interface</h4> 314182007Sroberto <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> 315182007Sroberto <pre> 316132451Sroberto Programmable Selected 317132451Sroberto Option No Option 318132451Sroberto BST or CET display 3 9 or 11 319132451Sroberto No external controller 7 0 320132451Sroberto Serial Output Format 1 9 1 321132451Sroberto Baud rate 9600 bps 10 96 322132451Sroberto Bit length 8 bits 11 8 323132451Sroberto Parity even 12 E 324132451Sroberto</pre> 325182007Sroberto <p>WHARTON 400A Series output format 1 is as follows :</p> 326182007Sroberto <pre> 327132451Sroberto Timestamp STXssmmhhDDMMYYSETX 328132451Sroberto Pos 0 12345678901234 329132451Sroberto 0 00000000011111 330132451Sroberto 331132451Sroberto STX start transmission (ASCII 0x02) 332132451Sroberto ETX end transmission (ASCII 0x03) 333132451Sroberto ss Second expressed in reversed decimal (units then tens) 334132451Sroberto mm Minute expressed in reversed decimal 335132451Sroberto hh Hour expressed in reversed decimal 336132451Sroberto DD Day of month expressed in reversed decimal 337132451Sroberto MM Month expressed in reversed decimal (January is 1) 338132451Sroberto YY Year (without century) expressed in reversed decimal 339132451Sroberto S Status byte : 0x30 + 340132451Sroberto bit 0 0 = MSF source 1 = DCF source 341132451Sroberto bit 1 0 = Winter time 1 = Summer time 342132451Sroberto bit 2 0 = not synchronised 1 = synchronised 343132451Sroberto bit 3 0 = no early warning 1 = early warning 344132451Sroberto</pre> 345182007Sroberto <hr> 346182007Sroberto <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script> 347182007Sroberto </body> 348132451Sroberto 349132451Sroberto</html>