time-nuts@lists.febo.com

Discussion of precise time and frequency measurement

View all threads

algorithms and hardware for comparing clock pulses

CA
Can Altineller
Mon, Sep 21, 2015 5:45 PM

Dear Time-nuts,

I finally found a way to measure 1pps output from my DS3231's, with a
mcu unit, and modify the aging register on the RTC, I have been able to
sync between 2-3 microseconds between clocks by substracting and adding
0.1ppm to 12.8ppm, with 7 bit resolution.

Since the current setup involves a mcu and interrupts to measure the
time between time pulses, *(RTC being calibrated and RTC being used as sync
signal) and when the pulses are within 1 micro seconds away, the interrupt
service routines execute consecutively, loosing microseconds of precision.

I probably need a hardware to measure the time pulses more precisely. I
thought of XOR'ing the clocks, and measuring both rising and falling edges
trough interrupts, but when the pulse is close enough, it will lead to same
condition.

Are there any solutions to this problem? Maybe an analog hack? And what
are the mostly used algorithms to tune an oscillator to another? Currently
my algorithm sign corrects the result difference, and adjusts aging
register simply by adding to it, then runs a conversion command each second
to add or substract the ppms.

This looks a lot of fun,

Best Regards,
Can Altineller

Dear Time-nuts, I finally found a way to measure 1pps output from my DS3231's, with a mcu unit, and modify the aging register on the RTC, I have been able to sync between 2-3 microseconds between clocks by substracting and adding 0.1ppm to 12.8ppm, with 7 bit resolution. Since the current setup involves a mcu and interrupts to measure the time between time pulses, *(RTC being calibrated and RTC being used as sync signal) and when the pulses are within 1 micro seconds away, the interrupt service routines execute consecutively, loosing microseconds of precision. I probably need a hardware to measure the time pulses more precisely. I thought of XOR'ing the clocks, and measuring both rising and falling edges trough interrupts, but when the pulse is close enough, it will lead to same condition. Are there any solutions to this problem? Maybe an analog hack? And what are the mostly used algorithms to tune an oscillator to another? Currently my algorithm sign corrects the result difference, and adjusts aging register simply by adding to it, then runs a conversion command each second to add or substract the ppms. This looks a lot of fun, Best Regards, Can Altineller
RL
Robert LaJeunesse
Mon, Sep 21, 2015 7:13 PM

The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds.

Bob LaJeunesse

Sent: Monday, September 21, 2015 at 1:45 PM
From: "Can Altineller" altineller@gmail.com
To: "Discussion of precise time and frequency measurement" time-nuts@febo.com
Subject: [time-nuts] algorithms and hardware for comparing clock pulses

Dear Time-nuts,

...
I probably need a hardware to measure the time pulses more precisely.
...
Are there any solutions to this problem?
...
Best Regards,
Can Altineller


The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds. Bob LaJeunesse > Sent: Monday, September 21, 2015 at 1:45 PM > From: "Can Altineller" <altineller@gmail.com> > To: "Discussion of precise time and frequency measurement" <time-nuts@febo.com> > Subject: [time-nuts] algorithms and hardware for comparing clock pulses > > Dear Time-nuts, > > ... > I probably need a hardware to measure the time pulses more precisely. > ... > Are there any solutions to this problem? > ... > Best Regards, > Can Altineller > _______________________________________________
JH
Jim Harman
Mon, Sep 21, 2015 8:02 PM

Hi Can,

For a simple analog solution, you might try a 74HC4046 phase detector
followed by a diode and RC network as used in Lars Walenius' GPSDO,
described here in the archives:

https://www.febo.com/pipermail/time-nuts/2014-February/082820.html

The phase detector produces a pulse whose width equals the time difference
between the two pulses. The RC network converts this to a voltage
proportional to the time difference, which you then measure with the MCU's
A/D converter. Using the rising edge of the signal at pin 14 as the
interrupt source triggers the A/D converter at the end of the pulse, which
corresponds to the peak of the analog signal.. The 1 meg resistor
discharges the capacitor between pulses.

Lars' code also includes a filtering algorithm which does a nice job of
controlling one of the oscillators to match the 1-PPS generated by the GPS.
I have enhanced this if you are interested.

On Mon, Sep 21, 2015 at 1:45 PM, Can Altineller altineller@gmail.com
wrote:

I probably need a hardware to measure the time pulses more precisely. I

thought of XOR'ing the clocks, and measuring both rising and falling edges
trough interrupts, but when the pulse is close enough, it will lead to same
condition.

Are there any solutions to this problem? Maybe an analog hack? And what

are the mostly used algorithms to tune an oscillator to another? Currently
my algorithm sign corrects the result difference, and adjusts aging
register simply by adding to it, then runs a conversion command each second
to add or substract the ppms.

This looks a lot of fun,

Best Regards,
Can Altineller

time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

--

--Jim Harman

Hi Can, For a simple analog solution, you might try a 74HC4046 phase detector followed by a diode and RC network as used in Lars Walenius' GPSDO, described here in the archives: https://www.febo.com/pipermail/time-nuts/2014-February/082820.html The phase detector produces a pulse whose width equals the time difference between the two pulses. The RC network converts this to a voltage proportional to the time difference, which you then measure with the MCU's A/D converter. Using the rising edge of the signal at pin 14 as the interrupt source triggers the A/D converter at the end of the pulse, which corresponds to the peak of the analog signal.. The 1 meg resistor discharges the capacitor between pulses. Lars' code also includes a filtering algorithm which does a nice job of controlling one of the oscillators to match the 1-PPS generated by the GPS. I have enhanced this if you are interested. On Mon, Sep 21, 2015 at 1:45 PM, Can Altineller <altineller@gmail.com> wrote: > > > I probably need a hardware to measure the time pulses more precisely. I > thought of XOR'ing the clocks, and measuring both rising and falling edges > trough interrupts, but when the pulse is close enough, it will lead to same > condition. > > Are there any solutions to this problem? Maybe an analog hack? And what > are the mostly used algorithms to tune an oscillator to another? Currently > my algorithm sign corrects the result difference, and adjusts aging > register simply by adding to it, then runs a conversion command each second > to add or substract the ppms. > > This looks a lot of fun, > > Best Regards, > Can Altineller > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. > -- --Jim Harman
JL
Jim Lux
Mon, Sep 21, 2015 8:08 PM

On 9/21/15 12:13 PM, Robert LaJeunesse wrote:

The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds.

I have, literally, a box full of teensy 3.1s at work.
If there's a quick test that would help answer any questions, I'm
willing to set them up.
I have, in the lab with the Teensys, a SRS Rb and a Wenzel OCXO (not a
superduper, just the streamline).

Is there a Flex Timer Module in the teensyduino library?

Bob LaJeunesse

Sent: Monday, September 21, 2015 at 1:45 PM
From: "Can Altineller" altineller@gmail.com
To: "Discussion of precise time and frequency measurement" time-nuts@febo.com
Subject: [time-nuts] algorithms and hardware for comparing clock pulses

 Dear Time-nuts,

...
I probably need a hardware to measure the time pulses more precisely.
...
Are there any solutions to this problem?
...
Best Regards,
Can Altineller



time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

On 9/21/15 12:13 PM, Robert LaJeunesse wrote: > The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds. > I have, literally, a box full of teensy 3.1s at work. If there's a quick test that would help answer any questions, I'm willing to set them up. I have, in the lab with the Teensys, a SRS Rb and a Wenzel OCXO (not a superduper, just the streamline). Is there a Flex Timer Module in the teensyduino library? > Bob LaJeunesse > >> Sent: Monday, September 21, 2015 at 1:45 PM >> From: "Can Altineller" <altineller@gmail.com> >> To: "Discussion of precise time and frequency measurement" <time-nuts@febo.com> >> Subject: [time-nuts] algorithms and hardware for comparing clock pulses >> >> Dear Time-nuts, >> >> ... >> I probably need a hardware to measure the time pulses more precisely. >> ... >> Are there any solutions to this problem? >> ... >> Best Regards, >> Can Altineller >> _______________________________________________ > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. >
JL
Jim Lux
Mon, Sep 21, 2015 10:22 PM

On 9/21/15 12:13 PM, Robert LaJeunesse wrote:

The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds.

I was looking at the discussion of the Flex Timer on the teensy forum..
One might want to be careful about the quality of the clock fed to those
timers.  It's the regular old CPU clock, but it runs through a DPLL.
(e.g. the crystal is a 48 MHz crystal, and converted to either 72 or 96
MHz as you select..)

I run my teensys at 48MHz, so I could hook up a 1pps to a pin and log
some data pretty easily.  I suspect that the ADEV will be dominated by
the CPU crystal, so I can use any convenient 1pps.

Bob LaJeunesse

Sent: Monday, September 21, 2015 at 1:45 PM
From: "Can Altineller" altineller@gmail.com
To: "Discussion of precise time and frequency measurement" time-nuts@febo.com
Subject: [time-nuts] algorithms and hardware for comparing clock pulses

 Dear Time-nuts,

...
I probably need a hardware to measure the time pulses more precisely.
...
Are there any solutions to this problem?
...
Best Regards,
Can Altineller



time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

On 9/21/15 12:13 PM, Robert LaJeunesse wrote: > The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds. > I was looking at the discussion of the Flex Timer on the teensy forum.. One might want to be careful about the quality of the clock fed to those timers. It's the regular old CPU clock, but it runs through a DPLL. (e.g. the crystal is a 48 MHz crystal, and converted to either 72 or 96 MHz as you select..) I run my teensys at 48MHz, so I could hook up a 1pps to a pin and log some data pretty easily. I suspect that the ADEV will be dominated by the CPU crystal, so I can use any convenient 1pps. > Bob LaJeunesse > >> Sent: Monday, September 21, 2015 at 1:45 PM >> From: "Can Altineller" <altineller@gmail.com> >> To: "Discussion of precise time and frequency measurement" <time-nuts@febo.com> >> Subject: [time-nuts] algorithms and hardware for comparing clock pulses >> >> Dear Time-nuts, >> >> ... >> I probably need a hardware to measure the time pulses more precisely. >> ... >> Are there any solutions to this problem? >> ... >> Best Regards, >> Can Altineller >> _______________________________________________ > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. >
JL
Jim Lux
Tue, Sep 22, 2015 12:52 AM

On 9/21/15 12:13 PM, Robert LaJeunesse wrote:

The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds.

A bit of googling:  FreqMeasure library for the Teensy can time stamp
zero crossings on pin 3
Apparently, the code is there to use up to 4 pins, but it's not really
set up for multiple pins.
It uses the hardware to capture, and then an ISR to unload the register
and buffer them up.

It also works on Arduinos.

https://www.pjrc.com/teensy/td_libs_FreqMeasure.html

the diagram in the K20 manual shows a two stage D flip-flop synchronizer
driven off the system clock, and then a simple rising/falling edge (or,
really, a 0->1 or 1->0 transition detector, which then latches the counter.
(Figure 37-175 in the manual)

Is this "time-nuts" precision capable. I've not tried to drive an
Arduino or teensy with an external clock, which I think might be a
starting point.

Bob LaJeunesse

Sent: Monday, September 21, 2015 at 1:45 PM
From: "Can Altineller" altineller@gmail.com
To: "Discussion of precise time and frequency measurement" time-nuts@febo.com
Subject: [time-nuts] algorithms and hardware for comparing clock pulses

 Dear Time-nuts,

...
I probably need a hardware to measure the time pulses more precisely.
...
Are there any solutions to this problem?
...
Best Regards,
Can Altineller



time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

On 9/21/15 12:13 PM, Robert LaJeunesse wrote: > The Teensy 3.1 (http://www.pjrc.com/store/teensy31.html ~$20) has a Flex Timer Module that appears to allow a single counter to be captured into independent registers from independent inputs. Not sure, but PJRC tends to run the clock fast (96MHz) so relative timing resolution should be much better than 0.1 microseconds. > A bit of googling: FreqMeasure library for the Teensy can time stamp zero crossings on pin 3 Apparently, the code is there to use up to 4 pins, but it's not really set up for multiple pins. It uses the hardware to capture, and then an ISR to unload the register and buffer them up. It also works on Arduinos. https://www.pjrc.com/teensy/td_libs_FreqMeasure.html the diagram in the K20 manual shows a two stage D flip-flop synchronizer driven off the system clock, and then a simple rising/falling edge (or, really, a 0->1 or 1->0 transition detector, which then latches the counter. (Figure 37-175 in the manual) Is this "time-nuts" precision capable. I've not tried to drive an Arduino or teensy with an external clock, which I think might be a starting point. > Bob LaJeunesse > >> Sent: Monday, September 21, 2015 at 1:45 PM >> From: "Can Altineller" <altineller@gmail.com> >> To: "Discussion of precise time and frequency measurement" <time-nuts@febo.com> >> Subject: [time-nuts] algorithms and hardware for comparing clock pulses >> >> Dear Time-nuts, >> >> ... >> I probably need a hardware to measure the time pulses more precisely. >> ... >> Are there any solutions to this problem? >> ... >> Best Regards, >> Can Altineller >> _______________________________________________ > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. >
MD
Magnus Danielson
Tue, Sep 22, 2015 8:31 PM

Jim,

I had the intent to try this, but never got around doing it. Thanks for
reminding me. Please share any enhancements.

I did exchange some emails with Lars, but as that project never got off
the ground, it faded out.

Cheers,
Magnus

On 09/21/2015 10:02 PM, Jim Harman wrote:

Hi Can,

For a simple analog solution, you might try a 74HC4046 phase detector
followed by a diode and RC network as used in Lars Walenius' GPSDO,
described here in the archives:

https://www.febo.com/pipermail/time-nuts/2014-February/082820.html

The phase detector produces a pulse whose width equals the time difference
between the two pulses. The RC network converts this to a voltage
proportional to the time difference, which you then measure with the MCU's
A/D converter. Using the rising edge of the signal at pin 14 as the
interrupt source triggers the A/D converter at the end of the pulse, which
corresponds to the peak of the analog signal.. The 1 meg resistor
discharges the capacitor between pulses.

Lars' code also includes a filtering algorithm which does a nice job of
controlling one of the oscillators to match the 1-PPS generated by the GPS.
I have enhanced this if you are interested.

On Mon, Sep 21, 2015 at 1:45 PM, Can Altineller altineller@gmail.com
wrote:

 I probably need a hardware to measure the time pulses more precisely. I

thought of XOR'ing the clocks, and measuring both rising and falling edges
trough interrupts, but when the pulse is close enough, it will lead to same
condition.

 Are there any solutions to this problem? Maybe an analog hack? And what

are the mostly used algorithms to tune an oscillator to another? Currently
my algorithm sign corrects the result difference, and adjusts aging
register simply by adding to it, then runs a conversion command each second
to add or substract the ppms.

 This looks a lot of fun,

 Best Regards,
 Can Altineller

time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Jim, I had the intent to try this, but never got around doing it. Thanks for reminding me. Please share any enhancements. I did exchange some emails with Lars, but as that project never got off the ground, it faded out. Cheers, Magnus On 09/21/2015 10:02 PM, Jim Harman wrote: > Hi Can, > > For a simple analog solution, you might try a 74HC4046 phase detector > followed by a diode and RC network as used in Lars Walenius' GPSDO, > described here in the archives: > > https://www.febo.com/pipermail/time-nuts/2014-February/082820.html > > The phase detector produces a pulse whose width equals the time difference > between the two pulses. The RC network converts this to a voltage > proportional to the time difference, which you then measure with the MCU's > A/D converter. Using the rising edge of the signal at pin 14 as the > interrupt source triggers the A/D converter at the end of the pulse, which > corresponds to the peak of the analog signal.. The 1 meg resistor > discharges the capacitor between pulses. > > Lars' code also includes a filtering algorithm which does a nice job of > controlling one of the oscillators to match the 1-PPS generated by the GPS. > I have enhanced this if you are interested. > > On Mon, Sep 21, 2015 at 1:45 PM, Can Altineller <altineller@gmail.com> > wrote: > >> >> >> I probably need a hardware to measure the time pulses more precisely. I >> thought of XOR'ing the clocks, and measuring both rising and falling edges >> trough interrupts, but when the pulse is close enough, it will lead to same >> condition. >> >> Are there any solutions to this problem? Maybe an analog hack? And what >> are the mostly used algorithms to tune an oscillator to another? Currently >> my algorithm sign corrects the result difference, and adjusts aging >> register simply by adding to it, then runs a conversion command each second >> to add or substract the ppms. >> >> This looks a lot of fun, >> >> Best Regards, >> Can Altineller >> _______________________________________________ >> time-nuts mailing list -- time-nuts@febo.com >> To unsubscribe, go to >> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts >> and follow the instructions there. >> > > >
BH
Bill Hawkins
Wed, Sep 23, 2015 4:25 AM

Group,

Seems to me that what's needed here is a current source for linear volts
vs. time and the cmos switching to control the duration of the capacitor
charge while the phase flip-flop is on. When it turns off, it interrupts
the processor and isolates the capacitor so it acts as a sample-and-hold
device. The processor can take its own sweet time reading the capacitor
voltage (although this sets minimum limits on the pulse duration). When
the reading has been captured, the micro toggles a FF that shorts the
capacitor with a cmos switch. The short is removed when the phase FF
toggles on.

This is a lot of analog circuitry, but it will operate as fast as the
parts are capable of switching and not at the whim of whatever the micro
is doing.

Hope that's useful. Probably already been done.

Bill Hawkins

-----Original Message-----
From: Magnus Danielson
Sent: Tuesday, September 22, 2015 3:32 PM

Jim,

I had the intent to try this, but never got around doing it. Thanks for
reminding me. Please share any enhancements.

I did exchange some emails with Lars, but as that project never got off
the ground, it faded out.

Cheers,
Magnus

On 09/21/2015 10:02 PM, Jim Harman wrote:

Hi Can,

For a simple analog solution, you might try a 74HC4046 phase detector
followed by a diode and RC network as used in Lars Walenius' GPSDO,
described here in the archives:

https://www.febo.com/pipermail/time-nuts/2014-February/082820.html

The phase detector produces a pulse whose width equals the time
difference between the two pulses. The RC network converts this to a
voltage proportional to the time difference, which you then measure
with the MCU's A/D converter. Using the rising edge of the signal at
pin 14 as the interrupt source triggers the A/D converter at the end
of the pulse, which corresponds to the peak of the analog signal.. The

1 meg resistor discharges the capacitor between pulses.

Lars' code also includes a filtering algorithm which does a nice job
of controlling one of the oscillators to match the 1-PPS generated by

the GPS.

I have enhanced this if you are interested.

Group, Seems to me that what's needed here is a current source for linear volts vs. time and the cmos switching to control the duration of the capacitor charge while the phase flip-flop is on. When it turns off, it interrupts the processor and isolates the capacitor so it acts as a sample-and-hold device. The processor can take its own sweet time reading the capacitor voltage (although this sets minimum limits on the pulse duration). When the reading has been captured, the micro toggles a FF that shorts the capacitor with a cmos switch. The short is removed when the phase FF toggles on. This is a lot of analog circuitry, but it will operate as fast as the parts are capable of switching and not at the whim of whatever the micro is doing. Hope that's useful. Probably already been done. Bill Hawkins -----Original Message----- From: Magnus Danielson Sent: Tuesday, September 22, 2015 3:32 PM Jim, I had the intent to try this, but never got around doing it. Thanks for reminding me. Please share any enhancements. I did exchange some emails with Lars, but as that project never got off the ground, it faded out. Cheers, Magnus On 09/21/2015 10:02 PM, Jim Harman wrote: > Hi Can, > > For a simple analog solution, you might try a 74HC4046 phase detector > followed by a diode and RC network as used in Lars Walenius' GPSDO, > described here in the archives: > > https://www.febo.com/pipermail/time-nuts/2014-February/082820.html > > The phase detector produces a pulse whose width equals the time > difference between the two pulses. The RC network converts this to a > voltage proportional to the time difference, which you then measure > with the MCU's A/D converter. Using the rising edge of the signal at > pin 14 as the interrupt source triggers the A/D converter at the end > of the pulse, which corresponds to the peak of the analog signal.. The > 1 meg resistor discharges the capacitor between pulses. > > Lars' code also includes a filtering algorithm which does a nice job > of controlling one of the oscillators to match the 1-PPS generated by the GPS. > I have enhanced this if you are interested. >
CA
Can Altineller
Wed, Sep 23, 2015 7:56 AM

Hello All,

Another night heroically wasted, and I have achieved a PID lock within 50 /
80 000 000 th of a second between two clocks. 50 is there because it is the
minimum clock ticks for the irq handler to execute.

To summarize:

  1. I am using a TI launchpad running at 80mhz. I was using micros() to
    measure time, but then I realized I could use SysClockTicks, which is
    80,000,000 per second. In Energia, I had to use: time_micros =
    HWREG(DWT_BASE + DWT_O_CYCCNT) to get the sysTicks. I am not sure if PID
    algorithm is the right one for tuning clocks, but thats what I only knew.

  2. The diffuculty arises from the fact that I am using 1pps signal to tune
    a DS3231, which also gives out a 1pps signal, (it can be configured to give
    faster pulses, but then when I modify the ppms, they wont be reflected in
    the pulse output) So in order to observe the reaction after setting aging
    register, I have to compare 1pps signal.
    If I had a RTC with a tunable 10mhz clock, I could feed that into a PLL /
    counter, not the case. Eitherway, I am in the process of ordering a VCTCXO,
    and probably will build my own RTC.

  3. I have investigated and experimented different interrupt schemes, like
    taking measurements on both rising and falling edge, and XOR'ing the clock
    signals. Using a 74hc74 and a XOR gate, I have made a mini-circuit so that
    if one clock is lagging behind, it will send pulses from one pin, and if
    reverse, it will pulse from other pin. However this scheme failed because
    same difficulty with interrupts arise again. The pulse is too fast in order
    to trigger interrupts on the falling and rising edge, and measure time.

  4. I think an analog solution like Bill Hawkins described, would be best
    suited for this task. But I have not understood it enough to build it.

Best Regards,
C.A.

On Wed, Sep 23, 2015 at 7:25 AM, Bill Hawkins bill@iaxs.net wrote:

Group,

Seems to me that what's needed here is a current source for linear volts
vs. time and the cmos switching to control the duration of the capacitor
charge while the phase flip-flop is on. When it turns off, it interrupts
the processor and isolates the capacitor so it acts as a sample-and-hold
device. The processor can take its own sweet time reading the capacitor
voltage (although this sets minimum limits on the pulse duration). When
the reading has been captured, the micro toggles a FF that shorts the
capacitor with a cmos switch. The short is removed when the phase FF
toggles on.

This is a lot of analog circuitry, but it will operate as fast as the
parts are capable of switching and not at the whim of whatever the micro
is doing.

Hope that's useful. Probably already been done.

Bill Hawkins

-----Original Message-----
From: Magnus Danielson
Sent: Tuesday, September 22, 2015 3:32 PM

Jim,

I had the intent to try this, but never got around doing it. Thanks for
reminding me. Please share any enhancements.

I did exchange some emails with Lars, but as that project never got off
the ground, it faded out.

Cheers,
Magnus

On 09/21/2015 10:02 PM, Jim Harman wrote:

Hi Can,

For a simple analog solution, you might try a 74HC4046 phase detector
followed by a diode and RC network as used in Lars Walenius' GPSDO,
described here in the archives:

https://www.febo.com/pipermail/time-nuts/2014-February/082820.html

The phase detector produces a pulse whose width equals the time
difference between the two pulses. The RC network converts this to a
voltage proportional to the time difference, which you then measure
with the MCU's A/D converter. Using the rising edge of the signal at
pin 14 as the interrupt source triggers the A/D converter at the end
of the pulse, which corresponds to the peak of the analog signal.. The

1 meg resistor discharges the capacitor between pulses.

Lars' code also includes a filtering algorithm which does a nice job
of controlling one of the oscillators to match the 1-PPS generated by

the GPS.

I have enhanced this if you are interested.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Hello All, Another night heroically wasted, and I have achieved a PID lock within 50 / 80 000 000 th of a second between two clocks. 50 is there because it is the minimum clock ticks for the irq handler to execute. To summarize: 1. I am using a TI launchpad running at 80mhz. I was using micros() to measure time, but then I realized I could use SysClockTicks, which is 80,000,000 per second. In Energia, I had to use: time_micros = HWREG(DWT_BASE + DWT_O_CYCCNT) to get the sysTicks. I am not sure if PID algorithm is the right one for tuning clocks, but thats what I only knew. 2. The diffuculty arises from the fact that I am using 1pps signal to tune a DS3231, which also gives out a 1pps signal, (it can be configured to give faster pulses, but then when I modify the ppms, they wont be reflected in the pulse output) So in order to observe the reaction after setting aging register, I have to compare 1pps signal. If I had a RTC with a tunable 10mhz clock, I could feed that into a PLL / counter, not the case. Eitherway, I am in the process of ordering a VCTCXO, and probably will build my own RTC. 3. I have investigated and experimented different interrupt schemes, like taking measurements on both rising and falling edge, and XOR'ing the clock signals. Using a 74hc74 and a XOR gate, I have made a mini-circuit so that if one clock is lagging behind, it will send pulses from one pin, and if reverse, it will pulse from other pin. However this scheme failed because same difficulty with interrupts arise again. The pulse is too fast in order to trigger interrupts on the falling and rising edge, and measure time. 4. I think an analog solution like Bill Hawkins described, would be best suited for this task. But I have not understood it enough to build it. Best Regards, C.A. On Wed, Sep 23, 2015 at 7:25 AM, Bill Hawkins <bill@iaxs.net> wrote: > Group, > > Seems to me that what's needed here is a current source for linear volts > vs. time and the cmos switching to control the duration of the capacitor > charge while the phase flip-flop is on. When it turns off, it interrupts > the processor and isolates the capacitor so it acts as a sample-and-hold > device. The processor can take its own sweet time reading the capacitor > voltage (although this sets minimum limits on the pulse duration). When > the reading has been captured, the micro toggles a FF that shorts the > capacitor with a cmos switch. The short is removed when the phase FF > toggles on. > > This is a lot of analog circuitry, but it will operate as fast as the > parts are capable of switching and not at the whim of whatever the micro > is doing. > > Hope that's useful. Probably already been done. > > Bill Hawkins > > > -----Original Message----- > From: Magnus Danielson > Sent: Tuesday, September 22, 2015 3:32 PM > > Jim, > > I had the intent to try this, but never got around doing it. Thanks for > reminding me. Please share any enhancements. > > I did exchange some emails with Lars, but as that project never got off > the ground, it faded out. > > Cheers, > Magnus > > > On 09/21/2015 10:02 PM, Jim Harman wrote: > > Hi Can, > > > > For a simple analog solution, you might try a 74HC4046 phase detector > > followed by a diode and RC network as used in Lars Walenius' GPSDO, > > described here in the archives: > > > > https://www.febo.com/pipermail/time-nuts/2014-February/082820.html > > > > The phase detector produces a pulse whose width equals the time > > difference between the two pulses. The RC network converts this to a > > voltage proportional to the time difference, which you then measure > > with the MCU's A/D converter. Using the rising edge of the signal at > > pin 14 as the interrupt source triggers the A/D converter at the end > > of the pulse, which corresponds to the peak of the analog signal.. The > > > 1 meg resistor discharges the capacitor between pulses. > > > > Lars' code also includes a filtering algorithm which does a nice job > > of controlling one of the oscillators to match the 1-PPS generated by > the GPS. > > I have enhanced this if you are interested. > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. >
BH
Ben Hall
Wed, Sep 23, 2015 11:15 PM

Hey guys,

I suspect we may have a Z3801A expert on the list.

A couple of nights ago, we had a power failure.  GPSCON says that my
Z3801A has failed self-test, but everything else looks fine:

Self Test: Err
Int Pwr:  OK
Oven Pwr:  OK
OCXO:  OK
EFC:  OK
GPS Rcv:  OK

The whole screen can be seen here:

http://www.kd5byb.net/kd5bybgpscon/gpsstat.htm

When I command a self test via *TST? command, it returns 0, which is no
error.

Not sure why GPSCON is reporting a self test error.  Any advice?  It
seems to be functioning normally in all respects.  :)

thanks much and 73,
ben, kd5byb

Hey guys, I suspect we may have a Z3801A expert on the list. A couple of nights ago, we had a power failure. GPSCON says that my Z3801A has failed self-test, but everything else looks fine: Self Test: Err Int Pwr: OK Oven Pwr: OK OCXO: OK EFC: OK GPS Rcv: OK The whole screen can be seen here: <http://www.kd5byb.net/kd5bybgpscon/gpsstat.htm> When I command a self test via *TST? command, it returns 0, which is no error. Not sure why GPSCON is reporting a self test error. Any advice? It seems to be functioning normally in all respects. :) thanks much and 73, ben, kd5byb