xref: /freebsd/contrib/ntp/html/drivers/driver6.html (revision 416ba5c74546f32a993436a99516d35008e9f384)
19c2daa00SOllivier Robert<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
29c2daa00SOllivier Robert<html>
39c2daa00SOllivier Robert<head>
4ea906c41SOllivier Robert<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
59c2daa00SOllivier Robert<meta name="generator" content="HTML Tidy, see www.w3.org">
69c2daa00SOllivier Robert<title>IRIG Audio Decoder</title>
7ea906c41SOllivier Robert<link href="scripts/style.css" type="text/css" rel="stylesheet">
89c2daa00SOllivier Robert</head>
99c2daa00SOllivier Robert<body>
109c2daa00SOllivier Robert<h3>IRIG Audio Decoder</h3>
11*2b15cb3dSCy Schubert<p>Author: David L. Mills (mills@udel.edu)<br>
12*2b15cb3dSCy SchubertLast update:
13*2b15cb3dSCy Schubert  <!-- #BeginDate format:En2m -->17-Jul-2014  02:17<!-- #EndDate -->
14*2b15cb3dSCy Schubert  UTC</p>
159c2daa00SOllivier Robert<hr>
169c2daa00SOllivier Robert<h4>Synopsis</h4>
179c2daa00SOllivier RobertAddress: 127.127.6.<i>u</i><br>
189c2daa00SOllivier RobertReference ID: <tt>IRIG</tt><br>
199c2daa00SOllivier RobertDriver ID: <tt>IRIG_AUDIO</tt><br>
209c2daa00SOllivier RobertAudio Device: <tt>/dev/audio</tt> and <tt>/dev/audioctl</tt>
219c2daa00SOllivier Robert<h4>Description</h4>
22*2b15cb3dSCy Schubert<p>This driver synchronizes the computer time using the Inter-Range Instrumentation Group (IRIG) standard time distribution signal. This signal is generated by several radio clocks, including those made by Arbiter, Austron, Bancomm, Odetics, Spectracom, Symmetricom and TrueTime, among others, although it is often an add-on option. The signal is connected via an optional attenuator and cable to either the microphone or line-in port of a workstation or PC.</p>
23*2b15cb3dSCy Schubert<p>The driver requires an audio codec or sound card with sampling rate 8 kHz and &mu;-law companding to demodulate the data. This is the same standard as used by the telephone industry and is supported by most hardware and operating systems, including Solaris, FreeBSD and Linux, among others. In this implementation, only one audio driver and codec can be supported on a single machine. In order to assure reliable signal capture, the codec frequency error must be less than 250 PPM (.025 percent). If necessary, the <tt>tinker codec</tt> configuration command can be used to bracket the codec frequency to this range.</p>
24*2b15cb3dSCy Schubert<p>For proper operation the IRIG signal source should be configured for analog signal levels, not digital TTL levels. In most radios the IRIG signal is driven &plusmn;10 V behind 50 Ohms. In such cases the cable should be terminated at the line-in port with a 50-Ohm resistor to avoid overloading the codec. Where feasible, the IRIG signal source should be operated with signature control so that, if the signal is lost or mutilated, the source produces an unmodulated signal, rather than possibly random digits. The driver automatically rejects the data and declares itself unsynchronized in this case. Some devices, in particular Spectracom radio/satellite clocks, provide additional year and status indication; other devices may not.</p>
25*2b15cb3dSCy Schubert<p>In general and without calibration, the driver is accurate within 500 &mu;s relative to the IRIG time. After calibrating relative to the PPS&nbsp;signal from a GPS&nbsp;receiver, the mean offset with a 2.4-GHz P4 running FreeBSD 6.1 is less than 20 &mu;s with standard deviation 10 &mu;s. Most of this is due to residuals after filtering and averaging the raw codec samples, which have an inherent jitter of 125 &mu;s. The processor load due to the driver is 0.6 percent on the P4.</p>
26*2b15cb3dSCy Schubert<p>However, be acutely aware that the accuracy with Solaris 2.8 and beyond has been seriously degraded to the order of several milliseconds. The Sun kernel driver has a sawtooth modulation with amplitude over 5 ms P-P and period 5.5 s. This distortion is especially prevalent with Sun Blade 1000 and possibly other systems.</p>
27*2b15cb3dSCy Schubert<p>The driver performs a number of error checks to protect against overdriven or underdriven input signal levels, incorrect signal format or improper hardware configuration. The specific checks are detailed later in this page. Note that additional checks are done elsewhere in the reference clock interface routines.</p>
289c2daa00SOllivier Robert<p>This driver incorporates several features in common with other audio drivers such as described in the <a href="driver7.html">Radio CHU Audio Demodulator/Decoder</a> and the <a href="driver36.html">Radio WWV/H Audio Demodulator/Decoder</a> pages. They include automatic gain control (AGC), selectable audio codec port and signal monitoring capabilities. For a discussion of these common features, as well as a guide to hookup, debugging and monitoring, see the <a href="../audio.html">Reference Clock Audio Drivers</a> page.</p>
29*2b15cb3dSCy Schubert<h4>Technical Overview</h4>
30*2b15cb3dSCy Schubert<p>The IRIG signal format uses an amplitude-modulated carrier with pulse-width modulated data bits. For IRIG-B, the carrier frequency is 1000 Hz and bit rate 100 b/s; for IRIG-E, the carrier frequenchy is 100 Hz and bit rate 10 b/s. While IRIG-B provides the best accuracy, generally within a few tens of microseconds relative to IRIG time, it can also generate a significant processor load with older workstations. Generally, the accuracy with IRIG-E is about ten times worse than IRIG-B, but the processor load is somewhat less. Technical details about the IRIG&nbsp;formats can be found in <a href="http://handle.dtic.mil/100.2/ADA346250">IRIG Standard 200-98</a>.</p>
31*2b15cb3dSCy Schubert<p>The driver processes 8000-Hz &mu;-law companded samples using separate signal filters for IRIG-B and IRIG-E, a comb filter, envelope detector and automatic threshold corrector. An infinite impulse response (IIR) 1000-Hz bandpass filter is used for IRIG-B and an IIR 130-Hz lowpass filter for IRIG-E. These are intended for use with noisy signals, such as might be received over a telephone line or radio circuit, or when interfering signals may be present in the audio passband. The driver determines which IRIG format is in use by sampling the amplitude of each filter output and selecting the one with maximum signal.</p>
32*2b15cb3dSCy Schubert<p>Cycle crossings relative to the corrected slice level determine the width of each pulse and its value - zero, one or position identifier (PI). The data encode ten characters (20 BCD digits) which determine the second, minute, hour and day of the year and with some IRIG&nbsp;generators the year and synchronization condition. The comb filter exponentially averages the corresponding samples of successive baud intervals in order to reliably identify the reference carrier cycle.</p>
33*2b15cb3dSCy Schubert<p>A type-II phase-lock loop (PLL) performs additional integration and interpolation to accurately determine the zero crossing of that cycle, which determines the reference timestamp. A pulse-width discriminator demodulates the data pulses, which are then encoded as the BCD digits of the timecode. The timecode and reference timestamp are updated once each second with IRIG-B (ten seconds with IRIG-E) and local clock offset samples saved for later processing. At poll intervals of 64 s, the saved samples are processed by a median filter and used to update the system clock.</p>
349c2daa00SOllivier Robert<h4>Monitor Data</h4>
35*2b15cb3dSCy SchubertThe timecode format used for debugging and data recording includes data helpful in diagnosing problems with the IRIG signal and codec connections. The driver produces one line for each timecode in the following format:
36*2b15cb3dSCy Schubert<p><tt>00 00 98 23 19:26:52 2782 143 0.694 10 0.3 66.5 3094572411.00027</tt></p>
37*2b15cb3dSCy Schubert<p>If clockstats is enabled, the most recent line is written to the clockstats file every 64 s. If verbose recording is enabled (fudge flag 4) each line is written as generated.</p>
38*2b15cb3dSCy Schubert<p>The first field containes the error flags in hex, where the hex bits are interpreted as below. This is followed by the year of century, day of year and time of day. Note that the time of day is for the previous minute, not the current time. The status indicator and year are not produced by some IRIG devices and appear as zeros. Following these fields are the carrier amplitude (0-3000), codec gain (0-255), modulation index (0-1), time constant (4-10), carrier phase error (0&plusmn;0.5) and carrier frequency error (PPM). The last field is the on-time timestamp in NTP format.</p>
399c2daa00SOllivier Robert<p>The error flags are defined as follows in hex:</p>
409c2daa00SOllivier Robert<dl>
41*2b15cb3dSCy Schubert  <dt><tt>x01</tt></dt>
42*2b15cb3dSCy Schubert  <dd>Low signal. The carrier amplitude is less than 100 units. This is usually the result of no signal or wrong input port.</dd>
43*2b15cb3dSCy Schubert  <dt><tt>x02</tt></dt>
44*2b15cb3dSCy Schubert  <dd>Frequency error. The codec frequency error is greater than 250 PPM. This may be due to wrong signal format or (rarely) defective codec.</dd>
45*2b15cb3dSCy Schubert  <dt><tt>x04</tt></dt>
46*2b15cb3dSCy Schubert  <dd>Modulation error. The IRIG modulation index is less than 0.5. This is usually the result of an overdriven codec, wrong signal format or wrong input port.</dd>
47*2b15cb3dSCy Schubert  <dt><tt>x08</tt></dt>
48*2b15cb3dSCy Schubert  <dd>Frame synch error. The decoder frame does not match the IRIG frame. This is usually the result of an overdriven codec, wrong signal format or noisy IRIG signal. It may also be the result of an IRIG signature check which indicates a failure of the IRIG signal synchronization source.</dd>
49*2b15cb3dSCy Schubert  <dt><tt>x10</tt></dt>
50*2b15cb3dSCy Schubert  <dd>Data bit error. The data bit length is out of tolerance. This is usually the result of an overdriven codec, wrong signal format or noisy IRIG signal.</dd>
51*2b15cb3dSCy Schubert  <dt><tt>x20</tt></dt>
52*2b15cb3dSCy Schubert  <dd>Seconds numbering discrepancy. The decoder second does not match the IRIG second. This is usually the result of an overdriven codec, wrong signal format or noisy IRIG signal.</dd>
53*2b15cb3dSCy Schubert  <dt><tt>x40</tt></dt>
54*2b15cb3dSCy Schubert  <dd>Codec error (overrun). The machine is not fast enough to keep up with the codec.</dd>
55*2b15cb3dSCy Schubert  <dt><tt>x80</tt></dt>
56*2b15cb3dSCy Schubert  <dd>Device status error (Spectracom).</dd>
579c2daa00SOllivier Robert</dl>
589c2daa00SOllivier Robert<h4>Fudge Factors</h4>
599c2daa00SOllivier Robert<dl>
60*2b15cb3dSCy Schubert  <dt><tt>time1 <i>time</i></tt></dt>
61*2b15cb3dSCy Schubert  <dd>Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.</dd>
62*2b15cb3dSCy Schubert  <dt><tt>time2 <i>time</i></tt></dt>
63*2b15cb3dSCy Schubert  <dd>Not used by this driver.</dd>
64*2b15cb3dSCy Schubert  <dt><tt>stratum <i>number</i></tt></dt>
65*2b15cb3dSCy Schubert  <dd>Specifies the driver stratum, in decimal from 0 to 15, with default 0.</dd>
66*2b15cb3dSCy Schubert  <dt><tt>refid <i>string</i></tt></dt>
67*2b15cb3dSCy Schubert  <dd>Specifies the driver reference identifier, an ASCII string from one to four characters, with default <tt>IRIG</tt>.</dd>
68*2b15cb3dSCy Schubert  <dt><tt>flag1 0 | 1</tt></dt>
69*2b15cb3dSCy Schubert  <dd>Not used by this driver.</dd>
70*2b15cb3dSCy Schubert  <dt><tt>flag2 0 | 1</tt></dt>
71*2b15cb3dSCy Schubert  <dd>Specifies the microphone port if set to zero or the line-in port if set to one. It does not seem useful to specify the compact disc player port.</dd>
72*2b15cb3dSCy Schubert  <dt><tt>flag3 0 | 1</tt></dt>
73*2b15cb3dSCy Schubert  <dd>Enables audio monitoring of the input signal. For this purpose, the speaker volume must be set before the driver is started.</dd>
74*2b15cb3dSCy Schubert  <dt><tt>flag4 0 | 1</tt></dt>
75*2b15cb3dSCy Schubert  <dd>Enable verbose <tt>clockstats</tt> recording if set.</dd>
769c2daa00SOllivier Robert</dl>
779c2daa00SOllivier Robert<hr>
78ea906c41SOllivier Robert<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
799c2daa00SOllivier Robert</body>
809c2daa00SOllivier Robert</html>
81