[time-nuts] quick and very dirty phase comparator

Bruce Griffiths bruce.griffiths at xtra.co.nz
Sun Jun 1 21:51:03 EDT 2008

Kasper Pedersen wrote:
> This is to poke my head in, and to share a simple multichannel
> phase comparator/monitor that turned out to be useful.
> I have a few homebuilt boxes that will do ~100ps timestamps,
> I have other uses for them, and tying them up with a single
> long term experiment is unacceptable. So I needed a phase
> comparator that I could rebuild in an hour if I wanted to,
> something in the spirit of TVB's PIC16 divider.
> Something simple.
> The idea is this:
> Beat a number of 10MHz inputs against another clock frequency
> using the input flipflops in a microcontroller as samplers,
> sample a number of times to cover the phase circle, and
> calculate the phase. Beating against 11.0592MHz gives a period
> of 3456 clocks, sampling every 8 clocks gives 432 samples, that
> should give 230ps resolution. Add clock jitter and aperture
> jitter, and precision should be around 500ps.
> How much performance can one get for $10?
> schematic: http://n1.taur.dk/timenuts/phasecomp8.pdf
> samples: http://n1.taur.dk/timenuts/phasesamples.png
> When comparing a 10MHz source with itself through
> a cable delay, the peak noise is 400ps. That's for a
> 300-microsecond acquisition time, which means the
> update rate is limited by how fast I can compute the
> vector and shovel data over to a PC. When monitoring
> beating 10MHz sources with an adjusted  (-3ppm)
> microcontroller clock, it's about 600ps peak.
> When misadjusted to be -30 ppm off, it's 1.1ns peak.
> At the moment there is only a crude windows program for
> turning the output into decimal plottable data, so some
> programming skill or beer drinking friend with programming
> skill is required, as well as knowledge of what one wants to
> measure (that's usually the hard part).
> source, hex: http://n1.taur.dk/timenuts/phasecomp.zip
> converter: http://n1.taur.dk/timenuts/phasehex2dec_win.zip
> I'm aware that 600ps is a very large figure in a lot of
> cases but for my oscillators it's good enough.
> /Kasper Pedersen.

Such techniques are quite sensitive (as you have demonstrated) to the 
ratio of the 11.0592MHz and 10MHz frequencies.
Thus in practice its best to phase lock the 11.0592MHz source to one of 
the 10MHz sources and the frequency differences between all the 10MHz 
sources being compared should be 1Hz or less.

This should maintain the resolution somewhat closer to the theoretical 
value derived by a naive analysis.
A low phase noise 11.0592MHz source is also required.


More information about the time-nuts mailing list