[time-nuts] Question on crystal jumps

Jim Palfreyman jim77742 at gmail.com
Fri Oct 24 01:12:24 UTC 2008

Thanks Brooke,

Just letting you know I've written the code without interrupts.

Basically I set the internal 16 bit timer to count up and watch it in an
infinite loop. After it gets to a certain number then I reset the timer to
zero and count a "tick". I count these ticks and get my time and 1 PPS from

I recognise there are some possible flaws in my method. I'd expect the flaws
to represent themselves as a slow drift in accuracy of the 1 PPS and/or some
sawtooth of the order of 100ns (1/10 MHz) about the true 1 PPS.

What I wasn't expecting was these jumps of the order of tens of

I suppose a solution is to take the 10MHz from my Thunderbolt and use that
to drive the AVR and see if the problem remains and the fault is in the


2008/10/24 Brooke Clarke <brooke at pacific.net>

> Hi Jim:
> I've made similar clocks using PIC micro controllers where the input is the
> 10
> MHz from the frequency standard.
> http://www.prc68.com/I/PRC68COM.shtml#07092006
> There's a subtle problem that has to do with if an interrupt occurs during
> a 3
> cycle long instruction or a 2 cycle long instruction.  This can cause
> erratic
> behavior if not properly accounted for.
> The 1 PPS from your clock should be spot on all the time, not off by a few
> hundred nano seconds.
> Have Fun,
> Brooke Clarke
> http://www.prc68.com/P/Prod.html  Products I make and sell
> http://www.prc68.com/Alpha.shtml  All my web pages listed based on html
> name
> http://www.PRC68.com
> http://www.precisionclock.com
> http://www.prc68.com/I/WebCam2.shtml 24/7 Sky-Weather-Astronomy Web Cam
> Jim Palfreyman wrote:
> > This discussion has come at an interesting time.
> >
> > I've hooked up an LPRO-101 from ebay to an AVR micro-controller -
> basically
> > using it to clock the processor directly.
> >
> > I've written code so the AVR is a clock and I've been comparing my
> clock's 1
> > PPS to the GPS.
> >
> > Over a few minutes it hops back and forward a few hundred nsec. All quite
> > acceptable given the clock speed.
> >
> > When I come back after a few hours it will suddenly be 10-20 usec slow. I
> > did see it jump over a few seconds from 200nsec to 17 usec.
> >
> > At first I put this down to interference because it coincide with me
> > switching off a light. So I put the whole lot into a metal box, shorter
> > wires and tried again.
> >
> > It still has jumps but this time it is *gaining*.
> >
> > Until this post started I'd assumed it was maybe my code and was about to
> > dive in and check it.
> >
> > Could these crystal "jumps" account for my issues?
> >
> > Regards,
> >
> > Jim
> _______________________________________________
> 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