[time-nuts] 1PPS to 32.768 khz

David davidwhess at gmail.com
Wed Oct 19 03:21:56 EDT 2016

On Tue, 18 Oct 2016 22:59:42 -0700, you wrote:

>> 1. Does anyone know of a device that will take a 1PPS GPS timing signal and
>> generate a 32.768 kHz sine wave output ? I have big digital clock that uses
>> an 8 bit micro processor and an external 32.768 crystal. Obviously the
>> external crystal is awful for accuracy. 
>I don't know of any off-the-shelf device that does that.

I do not either which I found surprising.  I did a search back through
the archives and found lots of posts about synthesizing 32.768kHz from
10 MHz but nothing about 1 PPS.

>Have you looked at the micro?  Is there a spare input pin for the PPS?  Could 
>you rewrite the software to use the PPS rather than counting to 32K?
>If you get a GPSDO with a 10 MHz output, then you could do it in software.  
>I'm a bit surprised that tvb doesn't already have one as an option for his 
>  http://www.leapsecond.com/pic/picdiv.htm

Lots of discussion about this in the archives.

>If you think (analog) hardware is more fun than software, you could build a 
>PLL.  I'm not a PLL wizard.  My guess is that 32K:1 is too big a step.  I'd 
>probably try 2 steps of 256:1 and 128:1.

It is not nearly that complicated.  I would almost call it trivial.
Phase performance is not critical in this application as long as
cycles are not added or lost.

Phase lock a 32.768kHz crystal oscillator to the PPS output either
directly or after dividing it down by a couple powers of 2 to remove
any ambiguity.  Several of the 10 MHz analog GPSDOs work this way. The
time constant just has to be long enough for the required holdover.

How much tuning range does a varactor tuned 32.768kHz crystal
oscillator have?  I knew at one time.

>If you like software, you can do the PLL in software.  (Less hardware than 
>the analog version.)  The idea is to run a tiny CPU at some handy frequency, 
>measure that clock using the PPS, and figure out how many cycles you need for 
>each half cycle at 32K Hz.  You don't need each (half) cycle to be super 
>accurate, but the long term has to be right.  If you knew the clock frequency 
>and it was stable, the cycles-per-tick would turn into the same sort of math 
>at Bresenham's algorithm gets for drawing diagonal lines:  some steps are N 
>cycles, some are N+1.  I'll bet the code is nice and clean after you figure 
>out how to do it.  Maybe it's just a PLL in software.

I think a PIC might be fast enough to DDS it.  The output bandpass
filter will cure a lot of sin.  Using a dedicated switched capacitor
filter would be fun but more expensive.

More information about the time-nuts mailing list