[time-nuts] First success with very simple, very low cost GPSDO, under $8
bob at evoria.net
Thu Apr 10 01:33:43 UTC 2014
Have you considered reading the timer only at PPS? You don't need to keep track of the actual count. You just need to keep track of the difference between counts at each PPS. Resolution isn't a problem since the difference in the lower 16 bits is a fixed number for your purpose. IOW, 10,000,000 is 0x989680. You're only interested in the 0x9680. If there's a difference in two successive timer counts of 0x9680, then you know you counted 10,000,000, unless your oscillator is capable of running at one of the other values that gives 0x9680 as the lower two bytes.
> From: Chris Albertson <albertson.chris at gmail.com>
>To: Discussion of precise time and frequency measurement <time-nuts at febo.com>
>Sent: Wednesday, April 9, 2014 6:35 PM
>Subject: Re: [time-nuts] First success with very simple, very low cost GPSDO, under $8
>On Wed, Apr 9, 2014 at 1:04 PM, Tom Harris <celephicus at gmail.com> wrote:
>> Another point with the software is that your handler for the PPS just reads
>> the counter. This gives an offset between the PPS edge and the value read,
>> as your software takes time to respond to the interrupt and read the
>> counter. In your code, it doesn't matter as you only have one interrupt.
>Actually there are two interrupts. One is for PPS and the other is
>for overflow of the 16-bit counter. This over flow happens about 76
>times per seconds.
>> However, if you have another interrupt enabled, this could run after the
>> PPS pulse but before the handler runs, giving you a very rare jitter.
>> A better way would be to use the input capture feature to read the timer
>> into a capture register. Then the interrupt handler has until the next edge
>> to read the capture register.
>Do you know how to do this. I don't see any way to capture the timer
>value other then reading it with software. The timer capture register
>is 16 bits and is set atomically after each timer increment but I
>don't see a way to make an external interrupt pin capture a timer.
>The two interrupts do bump into each other about roughly every 100
>seconds but I can detect that. I think I'll just ignore that second.
>Redondo Beach, California
>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_lists.febo.com