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