************************************************************************ * * * Copyright (c) David L. Mills 1997-1998 * * * * Permission to use, copy, modify, and distribute this software and * * its documentation for any purpose and without fee is hereby granted, * * provided that the above copyright notice appears in all copies and * * that both the copyright notice and this permission notice appear in * * supporting documentation, and that the name University of Delaware * * not be used in advertising or publicity pertaining to distribution * * of the software without specific, written prior permission. The * * University of Delaware makes no representations about the * * suitability this software for any purpose. It is provided "as is" * * without express or implied warranty. * * * ************************************************************************ Release notes on Precision Radio Clock for Station WWV/H Transmissions Distribution Contents index.htm program documentation in HTML format relnotes.txt release notes and copyright statement (this file) wwv.asm TASM source file, copiously commented and adorned wwv.obj TASM object file, suitable for downline loading wwv.lst TASM listing file Include files from the DSP93 Distribution regs.inc TMC320 registers ports.inc DSP93 ports serial.inc 16550 UART 23 June 97 You may be interested in a DSP-93 modem program which implements a radio clock based on WWV/WWVH transmissions. It has a nominal timing error less than +-125 us when tracking one of the stations and nominal frequency error less than +-0.4 PPM when not tracking a station. The clock produces an ASCII timecode that can be used to set the time of another device, such as a computer, as well as precision reference signals that can be used for other purposes, such as to drive laboratory test equipment. This has been a fun project and something I wanted to do since I was a consultant to Precision Standard Time, Inc. (PSTI), when they made the 1020 Integrated Time Source, which is synchronized by WWV/H. I made rash suggestions to scrap the conventional microprocessor that runs the thing and replace with a DSP chip with appropriately elegant demodulation and decoding algorithms. I also suggested to rely more on sophisticated signal processing, which can dig deep in the noise, and less on multiple-frequency scanning, both of these things to provide better accuracy and lower cost. Well, they sold the business to Traconex before I had the chance to put the ideas in practice. The program is no toy; the design is based on optimum receiver principles using a maximum likelihood approach and matched filter, synchronous detection and soft decision algorithms. The clock discipline is modelled as a Markov process, with probabilistic state transitions corresponding to a conventional time-of-century clock and the probabilities of received data correlated with each decimal digit as it advances. The result is a performance level which results in very low error rates, even under conditions when the one-minute beep from the WWV signal, normally its most prominent feature, cannot be detected by ear with a communications receiver. The program produces ASCII timecodes in two formats, one compatible with the Spectracom radio clock, which is supported by the Network Time Protocol (NTP) distribution for Unix and Windows, plus another including more performance data. It also produces a number of debugging formats and various signals synchronized to the WWV/H signal. It can operate at a number of baud rates from 300 bps to 153.6 kbps. The DSP-93 front panel LEDs are intricately coded to reveal the health of the program and the various demodulation and decoding algorithms. There are a couple of things that have stumped me so far, both having to do with the 16550 UART in the DSP-93. I have not been able to get transmit interrupts to work, which would provide better accuracy for the ASCII timecode. Also, I have not been able to wiggle either the RTS or DTR lines to provide a precision pulse-per-second (PPS) signal to discipline the computer clock down to the microseconds. A mystery remains why the matched filters for the WWV and WWVH seconds tick can't pry the two apart. Suitable mea culpae are revealed in the documenttion. The distribution containing the program source, DSP-93 binary, functional description and operating instructions, is available for anonymous FTP from ftp.udel.edu in the file pub/ntp/wwv.tar.Z. This is a work in progress and I invite anybody to monkey with the algorithms, experiment with new features and generally have a good time. Your comments and suggestions are most welcome. 29 June 1997 Further investigation of the WWV/H radio clock program for the DSP-93 revealed a number of improvements and a couple of bugs. The most important improvement is a much more careful grooming of the 1-s sync signal, which serves as the master timing source for all clock functions. The ensemble of median filter, sync counter, jitter counter, various thresholds and gates, as well as a gallon of snake oil, seems to have tamed the critter, even under the harshest conditions. The annoying feature where the clock would sometimes lurch backward a few milliseconds under deep multipath fading conditions is believed fixed. This involved using 1-s integrator time constants that depend on the frequency averaging time, which increases from 8 s when first started to 1024 s after an hour or two. The UART RTS/DTR problem mentioned in my last message was a simple coding error and is fixed. With advice from my friends, I have given up, at least temporarily, using UART interrupts. I have also fixed minor typos and casual lies in the documentation. In trying to justify the month of 16-hour days spent on this project, I propose that the program be rewritten in portable C for an ordinary (fast) PC and/or Unix workstation. It would then be adapted as a radio clock driver for the Network Time Protocol software for Unix and Windows, which some of you know is among my interests. Together with a cheap shortwave receiver, the gadget could serve as a pretty good timing source for an isolated Internet ghetto. As before, the updated version is on ftp.udel.edu in pub/ntp/wwv.zip. Your comments and suggestions are most welcome. 2 July 1997 Don'tcha hate it when somebody drops buggy software on you? My hastily written code to handle the 30 June insertion of a leap second meant that, until I fixed it minutes before the actual leap, the program didn't work on a leap day. That fix, along with working UART interrupts and several minor adjustments that reduce signal acquisition time under real mean and rotten conditions, is on ftp.udel.edu in pub/ntp/wwv.zip. I've tested it with one of our Internet primary NTP time servers simulating a WWVB clock and found the residual errors within nominals. My confusion over the fact that the WWVH mode didn't work very well was traced to a bug in the MatLab program that generates the filter coefficients. The matched filter for one station suppresses the other station about 6 dB, but this might not be enough. Here on the right coast, WWVH reception is too spotty to realistically evaluate performance. I would cherish reports from the left coast or anywhere else closer to Hawaii. 3 July 1997 Sorry to pester your mailboxes; but, some of the things I found with the WWV/H Most Immaculate Clock (remember the Heath clock of similar name?) may be of interest to others wading in the same swamps. I thought I was all through with the thing and plugged it into different radios for final check. Ooop. Most communications receivers have a lowpass filter that rolls off the response below 250 Hz or so - I expected that and so cranked up the 100-Hz subcarrier gain to compensate. I forgot about the PHASE DELAY, which any student in my circuit analysis class would instantly recognize. The active lowpass filters used in modern radios can have delays of many milliseconds and wreck the alignment of the 100- Hz synchronous demodulator relative to the 1-s synch pulse. Furthermore, every radio is different, so either an ugly calibration procedure is necessary or some kind of automatic means. My solution was to disconnect the internal 100-Hz signal from the 1-s sync signal and use a phase-lock loop for the phase adjustment and demodulation functions. There is so much processing gain going on in the program that the slight loss in sensitivity shouldn't be noticed, even on the weakest signals. As before, the updated version is on ftp.udel.edu in pub/ntp/wwv.zip. Your comments and suggestions are most welcome. An interesting reflection on this project is that the design philosophy where we try to extract as much information as fast as possible all the time from the received signals is really misdirected. Like all modem programs, the first thing this one does is try to synchronize to the data signal frequency and phase, and this one can hold its own with any others I know of. But, once a radio clock has synchronized to the presumed-correct time-of-century, the only thing it has to know is how much to speed up or slow down and whether it might have made an error when originally synchronizing. Had I really appreciated the importance of this philosophy when beginning the adventure, I might have saved myself a lot of work. 31 July 1997 After thorough testing under real-world conditions, I found a few areas of improvement in the various synchronization, demodulation and decoding algorithms. Most of these had to do with reducing false-alarm indications under conditions where the clock just barely manages to scrape the signals off the ionosphere. The program now tolerates intrinsic DSP-93 clock frequency errors over 62 PPM, but the clanking and banging when correcting for such large errors and coping with weak signals is unbelievable - watch the D3 debug output just after reset for grins. The distribution containing the program source, DSP-93 binary, functional description and operating instructions, is available for anonymous FTP from ftp.udel.edu in the file pub/ntp/wwv.tar.Z. There is also a comprehensive report on the project "A precision radio clock for WWV transmissions" at www.eecis.udel.edu/~mills/reports.html. It includes a detailed description of the algorithms, a mathematical analysis of performance and a summary of results of a detailed suite of experiments designed to determine the ultimate sensitivity of the thing. Among the conclusions are either (a) a paperclip may be a useful antenna or (b) the WWV transmitter power can be reduced from 10 kW to 25 W for additional taxpayer savings. 5 June 1998 After a year in sporadic testing and tinkering, I found a few more areas of improvement. The most persistent, although infrequent, problem is maintaining correct subcarrier demodulator phase under marginal signal conditions. I rewrote the 100-Hz subcarrier envelope detection and noise estimation code and coupled the averaging time to the frequency discipline averaging time, which normally grows to 1024 s. This represents a processing gain of 30 dB over the original program, which is more than enough to scrape the subcarrier signals from the ionosphere as long as the program is synchronized to the second and minute. The original program was a bit picky, in that only a single demodulated data bit error during a minute caused an error indication. From experience, the program functions reliably even when a moderate number of bit errors are present, since the maximum-likelihood algorithms used after demodulation avoids propagating these errors through the decoder. The new program does not signal the error, unless the number of data bit errors exceeds 30 during the minute. The original code tended to go off the rails during conditions where both WWV and WWVH signals are present at approximately equal amplitudes. Under these conditions, the 100-Hz subcarriers from both stations can constructively and destructively add at the envelope detector. This in turn can cause surges in the phase discipline and result in a decoding error which persists for some minutes. In order to prevent these errors, the digit comparison interval was increased from four to a maximum of nine minutes. The distribution containing the new program source, DSP-93 binary, functional description and operating instructions, is available for anonymous FTP from ftp.udel.edu in the file pub/ntp/wwv.tar.Z. There is also a comprehensive report on the original program "A precision radio clock for WWV transmissions" at www.eecis.udel.edu/~mills/reports.html. It includes a detailed description of the algorithms, a mathematical analysis of performance and a summary of results of a detailed suite of experiments designed to determine the ultimate sensitivity of the thing. Among the conclusions are either (a) a paperclip may be a useful antenna or (b) the WWV transmitter power can be reduced from 10 kW to 25 W for additional taxpayer savings. Finally, the documentation has been updated in HTML for browsers. Dave, w3hcf