[time-nuts] 1PPS to 32.768 khz

Tom Van Baak tvb at LeapSecond.com
Fri Oct 21 15:59:50 EDT 2016

Hi Jim,

I'm glad you mentioned the DS3231 aging trick. Many PIC's also have the ability to digitally tune their internal low power oscillator. Attached is a plot showing the 32 steps of the OSCTUNE register in a $1 8-pin PIC12F683.

Notice in the plot that the frequency adjustment range (and step size) of the PIC tuning is very large (+/- 10% fs) compared to the DS3231 (0.1ppm/lsb). This is both good and bad, depending on your application.

One trick that I've used is to apply PWM to the 7-bit OSCTUNE register. Although most people set the value once and forget it, there's no rule that says you can't update the register periodically, even rapidly. So for improved frequency resolution I update OSCTUNE every millisecond (!) as one would with PWM.

Using 1% PWM resolution, the 32 coarse OSCTUNE steps now turn into 3200 fine frequency tunings. With additional effort a GPS/1PPS pin capture directs the step size/direction and you can thus eliminate both the DS3231 and the Arduino. It's my $1 "best worst GPSDO" project. For you PIC assembly programmers the frequency microstep test code is at http://leapsecond.com/pic/src/pg41.asm

The key realization is that many microcontrollers now have internal oscillators, programmable oscillator tuning, and pulse capture capability. So they can function as a crude 1-chip GPSDO. Still, from a practical standpoint, the two chip DS3231 + PIC/AVR/Arduino is a more robust and stable solution, especially in the case where the goal is 32 kHz output.


----- Original Message ----- 
From: "Jim Harman" <j99harman at gmail.com>
To: "Discussion of precise time and frequency measurement" <time-nuts at febo.com>
Sent: Friday, October 21, 2016 10:42 AM
Subject: Re: [time-nuts] 1PPS to 32.768 khz

> On Thu, Oct 20, 2016 at 7:08 AM, Bob Camp <kb8tq at n1k.org> wrote:
>> One problem with a PLL and a 1 Hz input are the values of components
>> you get in the loop.
>> The other issue is the cost of the VCXO that will get
>> you to 32,768 KHz.
> As I mentioned earlier, the DS3231 chip (about $6.50 qty 1 or $17.50 on a
> breakout board) might be a reasonable approach for this. It is a
> self-contained 32.768 KHz TCXO that lets you vary the frequency in steps of
> 0.1 ppm using its I2C interface. Left to its own devices, it measures the
> ambient temperature and switches its on-chip capacitors in and out to
> control its frequency.
> It has both 1 PPS and 32,768 Hz outputs. Connected to an Arduino-class
> processor, you could measure the time delay between its PPS and the PPS
> from a GPS and tweak the oscillator accordingly, making a complete 32.768
> KHz GPSDO including the GPS with just 3 chips.
> And you get RTC functionality and battery backup circuitry thrown in for
> free.
> -- 
> --Jim Harman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: log3303-1.gif
Type: image/gif
Size: 20733 bytes
Desc: not available
URL: <http://www.febo.com/pipermail/time-nuts/attachments/20161021/ad2d7ab3/attachment.gif>

More information about the time-nuts mailing list