[time-nuts] quick and very dirty phase comparator

Ulrich Bangert df6jb at ulrich-bangert.de
Mon Jun 2 08:13:01 EDT 2008


I am impressed a lot by the simplicity of your ideas. Added what Bruce
has said to it I think the idea can even be improved by

a) using a 12.288 MHz source for the micro. 


b) using one (or two)external d-flip-flop(s)

The GCD of 10000000 Hz and 12288000 Hz is 16000 instead of 3200 as with
10000000 Hz and 11059200 Hz (or the also used 14745600 Hz) which results
in a repetition rate of 19660.8 clock cycles for the coincidence between
the two clocks. This gives you 5 times the resolution. And instead of
heavily sampling port inputs allow the external flip-flop to generate
the capture signal for one of the 16 bit timers/counters using the FULL
resolution of EVERY clock slope. With all AVRs that feature 2 16-bit
counters it will be possible to time stamp at least 2 sources against
the locked 12.288 MHz.

With this arrangement your micro will expect a capture interrupt roughly
every 1.6 ms which is kind of armchair condition for an AVR runing at
12.288 MHz. 

I am not sure whether you are really interested in a update rate of 300
mikroseconds. I am interested in stability on a second to second base.
So why not use 500 of these 1.6 ms apart time stamps to compute a linear
fit from as suggested in your counter paper. Should be no problem to
update all the sums needed for that online and use the last 100 ms to
perform everything else including communication. 

Best regards
Ulrich Bangert   

> -----Ursprungliche Nachricht-----
> Von: time-nuts-bounces at febo.com 
> [mailto:time-nuts-bounces at febo.com] Im Auftrag von Kasper Pedersen
> Gesendet: Sonntag, 1. Juni 2008 16:07
> An: Discussion of precise time and frequency measurement
> Betreff: [time-nuts] quick and very dirty phase comparator
> 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.
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to 
> https://www.febo.com/cgi-> bin/mailman/listinfo/time-nuts
> and 
> follow the instructions there.

More information about the time-nuts mailing list