IRIG Audio Decoder


Synopsis

Address: 127.127.6.u
Reference ID: IRIG
Driver ID: IRIG_AUDIO
Audio Device: /dev/audio and /dev/audioctl

Description

This driver supports the Inter-Range Instrumentation Group (IRIG) standard time distribution signal using the audio codec native to most workstations and PCs. 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. The driver receives, demodulates and decodes the IRIG-B and IRIG-E signal formats using internal filters designed to reduce the effects of noise and interference.

In general and without calibration, the driver is accurate within 500 ms relative to the IRIG time. When calibrated against a PPS signal from a GPS receiver, the mean error can be reduced to less than 20 ms with standard deviation 10 ms. Most of this is due to residuals after filtering and averaging the raw codec samples, which have an inherent jitter of 125 ms.

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. In order to assure reliable signal capture, the codec frequency error must be less than 250 PPM (.025 percent). The tinker codec configuration command can be used to bracket the codec frequency to this range.

This driver incorporates several features in common with other audio drivers such as described in the Radio CHU Audio Demodulator/Decoder and the Radio WWV/H Audio Demodulator/Decoder 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 Reference Clock Audio Drivers page.

Unlike other drivers, which can have multiple instantiations, this one supports only one. It does not seem likely that more than one audio codec would be useful in a single machine. More than one would probably chew up too much CPU time anyway.

Baseband Signal Processing

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 load on the processor with older workstations. Generally, the accuracy with IRIG-E is about ten times worse than IRIG-B, but the processor load is somewhat less.

The driver processes 8000-Hz m-law companded samples using separate signal filters for IRIG-B and IRIG-E, a comb filter, envelope detector and automatic threshold corrector. Infinite impulse response (IIR) filters are used with both IRIG-B and IRIG-E formats. A 1000-Hz bandpass filter is used for IRIG-B and a 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.

Cycle crossings relative to the corrected slice level determine the width of each pulse and its value - zero, one or position identifier. The data encode ten characters (20 BCD digits) which determine the second, minute, hour and day of the year and sometimes 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.

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.

IRIG-B/E Timecode Format

The 100 elements of the IRIG timecode are numbered from 0 through 99. Position identifiers occur at elements 0, 9 and every ten thereafter to 99. The control function (CF) elements begin at element 50 (CF 1) and extend to element 78 (CF 27). The straight-binary-seconds (SBS) field, which encodes the seconds of the UTC day, begins at element 80 (CF 28) and extends to element 97 (CF 44). The encoding of elements 50 (CF 1) through 78 (CF 27) is device dependent. This driver presently decodes the CF elements, but does nothing with them.

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 will automatically reject the data and declare itself unsynchronized in this case. Some devices, in particular Spectracom radio/satellite clocks, provide additional year and status indication in the format:

     Element   CF        Function
     -------------------------------------
     55        6         time sync status
     60-63     10-13     BCD year units
     65-68     15-18     BCD year tens
Other devices set these elements to zero.

Performance and Horror Stories

The m-law companded data format allows considerable latitude in signal levels; however, an automatic gain control (AGC) function is implemented to further compensate for varying input signal levels and to avoid signal distortion. 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 ±10 V behind 50 Ohms. In such cases the cable should be terminate at the line-in port with a 50-Ohm resistor to avoid overloading the codec.

The accuracy with this driver has been determined for a Pentium 4 running FreeBSD 6.1. For these measurements the computer clock was disciplined within a few microseconds of UTC using a PPS signal and GPS receiver and the measured offsets determined from the peerstats data. The systematic error with AC97 codec is within 20 ms of nominal zero with standard deviation about 20 ms and maximum deviation 30 ms.

However, be acutely aware that the accuracy with Solaris 2.8 and presumably 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.

The processor resources consumed by the daemon can be significant, ranging from about 1.2 percent on the faster UltraSPARC II to 38 percent on the slower SPARC IPC. However, the overall timing accuracy is limited by the resolution and stability of the CPU clock oscillator and the interval between clock corrections, which is 64 s with this driver. This performance, while probably the best that can be achieved by the daemon itself, can be improved with assist from the PPS discipline as described elsewhere in this documentation.

Monitor Data

The timecode format used for debugging and data recording includes data helpful in diagnosing problems with the IRIG signal and codec connections. With debugging enabled (-d on the ntpd command line), the driver produces one line for each timecode in the following format:

00 1 98 23 19:26:52 721 143 0.694 20 0.3 66.5 3094572411.00027

The first field containes the error flags in hex, where the hex bits are interpreted as below. This is followed by the IRIG status indicator, 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-6000), codec gain (0-255), modulation index (0-1), time constant (4-20), carrier phase error (0±0.5) and carrier frequency error (PPM). The last field is the on-time timestamp in NTP format.

The error flags are defined as follows in hex:

x01
Low signal. The carrier amplitude is less than 100 units. This is usually the result of no signal or wrong input port.
x02
Frequency error. The codec frequency error is greater than 250 PPM. This may be due to wrong signal format or (rarely) defective codec.
x04
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.
x08
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.
x10
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.
x20
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.
x40
Codec error (overrun). The machine is not fast enough to keep up with the codec.
x80
Device status error (Spectracom).

Fudge Factors

time1 time
Specifies the time offset calibration factor, in seconds and fraction, with default 0.0.
time2 time
Not used by this driver.
stratum number
Specifies the driver stratum, in decimal from 0 to 15, with default 0.
refid string
Specifies the driver reference identifier, an ASCII string from one to four characters, with default IRIG.
flag1 0 | 1
Not used by this driver.
flag2 0 | 1
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.
flag3 0 | 1
Enables audio monitoring of the input signal. For this purpose, the speaker volume must be set before the driver is started.
flag4 0 | 1
Enable verbose clockstats recording if set.