[time-nuts] algorithms and hardware for comparing clock pulses

Can Altineller altineller at gmail.com
Mon Sep 21 13:45:42 EDT 2015


   Dear Time-nuts,

   I finally found a way to measure 1pps output from my DS3231's, with a
mcu unit, and modify the aging register on the RTC, I have been able to
sync between 2-3 microseconds between clocks by substracting and adding
0.1ppm to 12.8ppm, with 7 bit resolution.

   Since the current setup involves a mcu and interrupts to measure the
time between time pulses, *(RTC being calibrated and RTC being used as sync
signal) and when the pulses are within 1 micro seconds away, the interrupt
service routines execute consecutively, loosing microseconds of precision.

   I probably need a hardware to measure the time pulses more precisely. I
thought of XOR'ing the clocks, and measuring both rising and falling edges
trough interrupts, but when the pulse is close enough, it will lead to same
condition.

   Are there any solutions to this problem? Maybe an analog hack? And what
are the mostly used algorithms to tune an oscillator to another? Currently
my algorithm sign corrects the result difference, and adjusts aging
register simply by adding to it, then runs a conversion command each second
to add or substract the ppms.

   This looks a lot of fun,

   Best Regards,
   Can Altineller


More information about the time-nuts mailing list