[time-nuts] 10 MHz to 32.768 kHz converter

Magnus Danielson magnus at rubidium.dyndns.org
Sun Mar 20 17:57:51 EDT 2016


Martyn,

On 03/20/2016 07:26 PM, Martyn Smith wrote:
> Hello,
>
> First of all quick apologies for sending an email last week without deleting all the old information from previous postings.
>
> I have been playing around with producing 32.768 kHz from 10 MHz using a PIC chip.
>
> I  have a real time clock calendar chip that requires a 32.768 kHz crystal.  I want to feed it with 10 MHz signal instead, so it is synchronised to my main 10 MHz in a frequency standard I am designing.
>
> The method I’m using has been documented before where we have two loops running 9632 times through a 39 instruction loop and
> 55904 times through a 38 instruction loop, each time toggling the output pin.
>
> I have done this and am getting approximately 32.768 kHz with the FM modulation as described by previous authors.
>
> My question is should I expect exactly 32.768000000 kHz (obviously assuming we use the same 10 MHz to drive the divider and all test equipment)?
>
> The closest I can get the 32.768 kHz is within about 0.1 Hz.
>
> Does the actual model of PIC chip influence the accuracy?

10 MHz and 32,768 kHz does not have an easy relationship.

10 MHz = 10^7 = 2^7 * 5^7 Hz
32768 Hz = 2^15

So, for 5^7 10 MHz cycles you will run 2^8 32,768 kHz cycles.

There is no way to divide down straight, and most DDSes only operates on 
2^n basis which does not resolve the 5^7 factor accurately.

So, what you have to do is to use your divider (PIC in this case) to 
consume an extra cycle here and there, with some logic to decide when.
Then you can accurately produce the frequency. A DDS with length being 
10^7 (or at least have a length being multiple of 5^7) can produce it 
directly. The alternating division factor can be made to work correctly, 
but it will produce phase deviations, being up to a 32,768 kHz cycle 
(more if you do it sloppy).

Think of it as accumulating the error and correct for it as you go, both 
approaches do that.

Cheers,
Magnus


More information about the time-nuts mailing list