[time-nuts] quick and very dirty phase comparator

Bruce Griffiths bruce.griffiths at xtra.co.nz
Mon Jun 2 19:28:38 EDT 2008

Ulrich Bangert wrote:
> Kasper,
> 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. 
> and
> 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   

Actually you need the largest common denominator to be smaller not larger.
In your case the duration of 768 cycles at 12.288MHz is equal to the 
duration of 625 periods at 10MHz.
Thus the time interval between coincidences is only 62.5us which is 
somewhat shorter than the corresponding time interval of 312.5us with 
10MHz and 11.0592MHz clocks.

A frequency like 17.73447 MHz (1734470=1229x37x13x3 x10 ) is a better 
choice as the duration of 1773447 cycles at 17.34470MHz is equal to the 
duration (0.1sec) of 1000000 cycles at 10MHz.
The largest common denominator of 17734470 and 10000000 is 10.
However the resultant 56 fs resolution will exceed that of all but the 
very fastest flipflops.
In this case it is critical that the 17.73447 MHz crystal oscillator 
have very low phase noise/jitter and be phase locked to one of the 10MHz 
Also the 10MHz sources being compared should not differ from each other 
by more than 0.1Hz or so.


More information about the time-nuts mailing list