Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-28 Thread Charles Steinmetz

Bob wrote:

You can achieve very good accuracy, but at the cost of waiting 
thousands of seconds between phase points; i.e. where your 1PPS 
coincides with the 10 millionth OCXO pulse.


So, as your 1PPS pulse bobs back and forth, you will often encounter 
an OCXO pulse up to 10ns early, or up to 10ns late.  So, might you 
count 9,999,999 pulses from the OCXO immediately followed by 
10,000,001 pulses.  Neither of those, by itself is a signal to 
change the EFC voltage to your OCXO.  In fact, it is normal for your 
count to alternate between the two for long periods, if you are very 
very close to exactly 10MHz, just from the quantization error on the 
1PPS.  It is also normal for 1/T to control the time between phase 
crossings.  So you have to wait for two miscounts in a row in the 
same direction to make a change.


I have been puzzled more than once by your comments about only 
changing the DAC count every several minutes or more.  I am not 
familiar with the circuit you are using, but in a digital PLL the 
errors (assessed every second) typically feed a digital filter that 
drives the DAC.  So, there is generally a very small correction every 
second according to the long running average of the individual 
errors, rather than a large correction after hundreds or thousands of 
seconds.  If you only adjust the DAC every two miscounts in one 
direction, you are guaranteed to get slipped cycles (which appeared 
to be one of the problems you were having when comparing 
oscillators).  This is a reasonable way to get an oscillator roughly 
on frequency if it is substantially off to start with, but it is not 
a good way to hold an oscillator within ppb of the desired frequency, 
and no way at all to hold it in phase lock with the reference.


If that is really the way the circuit you are using works, perhaps it 
would be better to implement a proper all-digital PLL with digital 
filter than trying to get better results out of the circuit you are 
using than it is capable of delivering.


Or, perhaps I'm not understanding what you are doing?

Best regards,

Charles



___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-28 Thread Bob Stewart
Hi Charles,

The problem is that the only information available is the fact that a phase 
crossing occurred and whether there were more than 10M counts (or less) since 
the last PPS.  The phase error value is not available to me, nor is the 
sawtooth value; which would of course be of no value.  So, if I have a + phase 
crossing and then a - phase crossing, what do I know?  If they are closely 
spaced, I can guess that the reason for the bouncing is the jitter on the PPS.  
If they are not closely spaced, then I can't really conclude anything other 
than that there is a phase offset in one direction or the other..  I could 
count the number of crossings over time and estimate the angle of the phase 
crossing, but I can't really be sure of the direction.  Also, since this is not 
a timing receiver, it tends to wander around about 10-20 ns.  So, that wander 
might be the only reason for a +/- count.  In the case where there are two + 
crossings, or two - crossings in a
 row, it is a 1/T question.  And with 1/T, it may be a long time until the next 
crossing, depending on how close you are in frequency, and how much the 
receiver wanders around.

I'm aware of the limitations of the hardware.  That's why I'm working on a TIC 
daughterboard.  I could have used someone else's board, and a different GPS 
receiver, and on and on, but what fun would that have been?  My goal is to do 
as much as possible with as little extra as possible using this particular 
board, learn as much as possible, and enjoy myself.

I hope that helps.  It's entirely possible that I've made some newbie mistake 
and that there's a good answer available.  But, in that case, I would think 
that someone else would have already applied it to this board.

Oh, and my granddaughter has been pestering me the whole time I've been writing 
this, so I hope I haven't been a bit short.  =)

Bob





 From: Charles Steinmetz csteinm...@yandex.com
To: Discussion of precise time and frequency measurement time-nuts@febo.com 
Sent: Friday, February 28, 2014 12:29 PM
Subject: Re: [time-nuts] GPSDO with all-digital phase/time measurement?
 

Bob wrote:

 You can achieve very good accuracy, but at the cost of waiting thousands of 
 seconds between phase points; i.e. where your 1PPS coincides with the 10 
 millionth OCXO pulse.
 
 So, as your 1PPS pulse bobs back and forth, you will often encounter an OCXO 
 pulse up to 10ns early, or up to 10ns late.  So, might you count 9,999,999 
 pulses from the OCXO immediately followed by 10,000,001 pulses.  Neither of 
 those, by itself is a signal to change the EFC voltage to your OCXO.  In 
 fact, it is normal for your count to alternate between the two for long 
 periods, if you are very very close to exactly 10MHz, just from the 
 quantization error on the 1PPS.  It is also normal for 1/T to control the 
 time between phase crossings.  So you have to wait for two miscounts in a 
 row in the same direction to make a change.

I have been puzzled more than once by your comments about only changing the 
DAC count every several minutes or more.  I am not familiar with the circuit 
you are using, but in a digital PLL the errors (assessed every second) 
typically feed a digital filter that drives the DAC.  So, there is generally a 
very small correction every second according to the long running average of 
the individual errors, rather than a large correction after hundreds or 
thousands of seconds.  If you only adjust the DAC every two miscounts in one 
direction, you are guaranteed to get slipped cycles (which appeared to be one 
of the problems you were having when comparing oscillators).  This is a 
reasonable way to get an oscillator roughly on frequency if it is 
substantially off to start with, but it is not a good way to hold an 
oscillator within ppb of the desired frequency, and no way at all to hold it 
in phase lock with the reference.

If that is really the way the circuit you are using works, perhaps it would be 
better to implement a proper all-digital PLL with digital filter than trying 
to get better results out of the circuit you are using than it is capable of 
delivering.

Or, perhaps I'm not understanding what you are doing?

Best regards,

Charles



___
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.



___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-28 Thread Mark Haun
Thanks to everyone who responded.  I had this bright idea that I would turn
off mail delivery and just read the list through the pipermail interface. 
It works great, until you want to reply to a message.  Sorry if this breaks
the thread in two.

Language is imprecise even when carefully thought out, and I can see I gave
some erroneous impressions.  What I am really trying to get at, is whether
there is any advantage to using an outboard phase detector like the
4046-based circuit recently posted in the arduino GPSDO thread.  I get
that this is going to provide a much faster measurement of phase error than
the digital counter method.  (The RC time constant on that circuit looked
pretty fast, ~ 1 second.)  But if my loop filter has a time constant
measured in the 10s or 100s of seconds, I'm not clear what difference this
makes.  That was the gist of my 100ns/T thought experiment.

Ditto on the comment re: long averaging times != infrequent tuning updates. 

To clarify my requirements a bit more, I am mostly interested in the
learning exercise, but it would be nice to end up with a frequency standard
capable of supporting symbol periods (coherent) on the order of seconds for
VLF and shortwave digital comms experiments.  So, a pretty modest goal of,
say, 1E-9.  Of course, being an engineer I want to do the best job possible
with the parts at hand.

Toolkit: I have a handful of the 26-MHz Pletronics ebay OCXOs.  The spec
sheet says +/- 0.5 ppb over 30 seconds short-term stability.  I will try to
use a GPS module enabling SW sawtooth correction, an NV08C if I could get
it.  MCU of choice is STM32 (ARM Cortex-M4).  I am still reading the fine
print but I believe interrupt handling is strictly deterministic. 

So, based on the OCXO short-term spec and a 1E-9 performance requirement,
could I not then estimate the loop time constant at ~100 seconds, and
furthermore argue that my TIC has an effective measurement accuracy of 
1/(26 MHz)/(100 s) = 0.4 ns ?  Meaning, also, that SW sawtooth correction
would be worthwhile?

Mark
KJ6PC
___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-28 Thread Chris Albertson
Bob,

If your hardware can only measure if the phase leads or lags.  I thnk
you still want to change the DAC every second.  But you don't do it
directly.  Used a PI controller.  (PI is just PID with no D)

You phase detector DOES measure the phase error but the resolution is
poor, you only get one bit plus the sign.  So you must assume a value
for the one bit.  Just call it 0.5 degrees or whatever.  It may not
matter much if you guess wrong.  So you get either -0.5 or +0.5 for
each phase measurement.

Then the correction is to be applied each second is Kp * (phase
measurement) + Ki (the sum of all phase measurements)
Then you set the DAC to whatever it currently is plus the above correction.

If your GPSDO is working correctly and in sync the sum of all phase
measurements is be nearly zero but if at start up yu are way off the
error will add up and you will apply more and more correction.  Then
it over shoots but the error integrated over time eventually goes to
zero.  The key d finding Kp and Ki

This works if your local oscillation is good enough not to loose or
gain a full cycle per second. Have some other way (based on counting
cycles)  to set it close then let the Pi controller take over.
Once teetotal error gets to zero the PI controller should dither the
DAC by one count up and down.

On Fri, Feb 28, 2014 at 11:31 AM, Bob Stewart b...@evoria.net wrote:
 Hi Charles,

 The problem is that the only information available is the fact that a phase 
 crossing occurred and whether there were more than 10M counts (or less) since 
 the last PPS.  The phase error value is not available to me, nor is the 
 sawtooth value; which would of course be of no value.  So, if I have a + 
 phase crossing and then a - phase crossing, what do I know?  If they are 
 closely spaced, I can guess that the reason for the bouncing is the jitter on 
 the PPS.  If they are not closely spaced, then I can't really conclude 
 anything other than that there is a phase offset in one direction or the 
 other..  I could count the number of crossings over time and estimate the 
 angle of the phase crossing, but I can't really be sure of the direction.  
 Also, since this is not a timing receiver, it tends to wander around about 
 10-20 ns.  So, that wander might be the only reason for a +/- count.  In the 
 case where there are two + crossings, or two - crossings in a
  row, it is a 1/T question.  And with 1/T, it may be a long time until the 
 next crossing, depending on how close you are in frequency, and how much the 
 receiver wanders around.

 I'm aware of the limitations of the hardware.  That's why I'm working on a 
 TIC daughterboard.  I could have used someone else's board, and a different 
 GPS receiver, and on and on, but what fun would that have been?  My goal is 
 to do as much as possible with as little extra as possible using this 
 particular board, learn as much as possible, and enjoy myself.

 I hope that helps.  It's entirely possible that I've made some newbie mistake 
 and that there's a good answer available.  But, in that case, I would think 
 that someone else would have already applied it to this board.

 Oh, and my granddaughter has been pestering me the whole time I've been 
 writing this, so I hope I haven't been a bit short.  =)

 Bob





 From: Charles Steinmetz csteinm...@yandex.com
To: Discussion of precise time and frequency measurement time-nuts@febo.com
Sent: Friday, February 28, 2014 12:29 PM
Subject: Re: [time-nuts] GPSDO with all-digital phase/time measurement?


Bob wrote:

 You can achieve very good accuracy, but at the cost of waiting thousands of 
 seconds between phase points; i.e. where your 1PPS coincides with the 10 
 millionth OCXO pulse.

 So, as your 1PPS pulse bobs back and forth, you will often encounter an 
 OCXO pulse up to 10ns early, or up to 10ns late.  So, might you count 
 9,999,999 pulses from the OCXO immediately followed by 10,000,001 pulses.  
 Neither of those, by itself is a signal to change the EFC voltage to your 
 OCXO.  In fact, it is normal for your count to alternate between the two 
 for long periods, if you are very very close to exactly 10MHz, just from 
 the quantization error on the 1PPS.  It is also normal for 1/T to control 
 the time between phase crossings.  So you have to wait for two miscounts in 
 a row in the same direction to make a change.

I have been puzzled more than once by your comments about only changing the 
DAC count every several minutes or more.  I am not familiar with the circuit 
you are using, but in a digital PLL the errors (assessed every second) 
typically feed a digital filter that drives the DAC.  So, there is generally 
a very small correction every second according to the long running average of 
the individual errors, rather than a large correction after hundreds or 
thousands of seconds.  If you only adjust the DAC every two miscounts in one 
direction, you are guaranteed to get slipped cycles

Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-27 Thread Hal Murray

hau...@keteu.org said:
 That being said, I find myself wondering as follows: Suppose that we count
 OCXO cycles (at, say, 10 MHz) using one of the MCU's timer/counter
 peripherals, and periodically sample the counter value with an interrupt
 triggered on the rising edge of the GPS 1pps.  Assume that this interrupt is
 the highest priority in the system, so that our measurement is fully
 deterministic, having only the +/- one cycle ambiguity inherent in the
 counting.  Also assume that we keep the counter running continuously. 

In general, things like highest priority interrupt don't guarantee what you 
want.  The fine print depends upon your MCU.  Some instructions take more 
than 1 cycle.  Consider what happens if your interrupt arrives just after 
another interrupt got started.

For this problem, I'd check the fine print on the counter/timers.  They often 
have a mode where it will copy the counter to a holding register (and 
generate an interrupt) on the rising edge of an input pin.  If you also get 
an interrupt on the counter overflowing, you can work out the total number of 
cycles between rising edges.

--

The other problem you need to be aware of if you want to build a GPSDO is 
hanging bridges.
  tvb: Motorola GPS M12+ Sawtooth
  http://www.leapsecond.com/pages/m12/sawtooth.htm
  Tom Clark and Rick Hambly: Timing for VLBI
  http://gpstime.com/files/tow-time2009.pdf


-- 
These are my opinions.  I hate spam.



___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-27 Thread Bob Stewart
Hi Hal,

I've reviewed this a bit and I used the wrong terminology.  Either Timer1 or 
Timer3 can use the T1CKI input as a clock.  Along with that, the CCP1 or CCP2 
pin can be used to trigger a capture of the timer in use into the CCPR1 or 
CCPR2 register pair.  I had considered this as an interrupt function, but after 
looking at the manual, it's a matter of switchable dedicated hardware.  Sorry 
for the bad info.

Bob





 From: Hal Murray hmur...@megapathdsl.net
To: Bob Stewart b...@evoria.net; Discussion of precise time and frequency 
measurement time-nuts@febo.com 
Cc: hmur...@megapathdsl.net 
Sent: Thursday, February 27, 2014 1:13 AM
Subject: Re: [time-nuts] GPSDO with all-digital phase/time measurement?
 


b...@evoria.net said:
 At least on the PIC I'm using, the CCP and timer interrupts don't seem to be
 synchronous with the PIC clock.  I could be mistaken. 

Unless you have a very strange architecture, it doesn't make sense for an 
interrupt to not be synchronous with the CPU clock.  You are in the middle of 
an add instruction, and now you want to start an interrupt.  What does that 
mean?

I expect there is the standard 2 FF synchronizer on all the input pins.  
Things like the counter/timers run on the CPU clock, taking their input after 
the synchronizer.  I don't remember seeing a data sheet that comes out and 
says that, but sometimes you can get some (strong?) hints with things like 
minimum pulse widths or max clock rate.


-- 
These are my opinions.  I hate spam.






___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-27 Thread Bob Stewart
Hi Alex,

As these guys have told me, and as I have learned, Rb standards are very 
regular, but that doesn't mean they are very accurate.  So, unless your Rb 
standard was being disciplined to the right frequency you'd probably have to do 
some sort of analysis to see the quantizing errors on your 1PPS pulse.

Bob






 From: Alexander Pummer alex...@ieee.org
To: Bob Stewart b...@evoria.net; Discussion of precise time and frequency 
measurement time-nuts@febo.com 
Sent: Thursday, February 27, 2014 7:42 AM
Subject: Re: [time-nuts] GPSDO with all-digital phase/time measurement?
 


it would be interesting to see the accuracy of the 1pps pulses by 
comparing them with a second 1pps pulse, which is derived from a 
rubidium standard, which on his own does not have quantizing errors,
73
KJ6UHN
Alex


___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-27 Thread Alexander Pummer


it would be interesting to see the accuracy of the 1pps pulses by 
comparing them with a second 1pps pulse, which is derived from a 
rubidium standard, which on his own does not have quantizing errors,

73
KJ6UHN
Alex

On 2/26/2014 6:03 PM, Bob Stewart wrote:

Hi Mark,

I'm neither an engineer, nor an expert, but here are my comments.

I think that the idea of 100ns/T is wrong.  There are several variables that control 
accuracy, but the time between pulses from your OCXO (assuming no phase or frequency 
drift) isn't one of them.  So, that gives 1/T.  Here the problem is that T must get large 
before your accuracy can be good.  You can achieve very good accuracy, but at the cost of 
waiting thousands of seconds between phase points; i.e. where your 1PPS 
coincides with the 10 millionth OCXO pulse.  The theoretical maximum would be infinity, 
of course, but your oscillator won't be that stable.

Another big problem is the accuracy of the 1PPS pulse.  I'm using an Adafruit 
GPS receiver, and it's listed as accurate to within 10ns.  And it is, but you 
have to be wary of exactly what that means.  It doesn't mean +/- 5ns.  So, as 
your 1PPS pulse bobs back and forth, you will often encounter an OCXO pulse up 
to 10ns early, or up to 10ns late.  So, might you count 9,999,999 pulses from 
the OCXO immediately followed by 10,000,001 pulses.  Neither of those, by 
itself is a signal to change the EFC voltage to your OCXO.  In fact, it is 
normal for your count to alternate between the two for long periods, if you are 
very very close to exactly 10MHz, just from the quantization error on the 1PPS. 
 It is also normal for 1/T to control the time between phase crossings.  So you 
have to wait for two miscounts in a row in the same direction to make a change. 
 And even then, you can't be 100% sure that it's not due to the quantization 
errors in your 1PPS
  signal.

The better GPS receivers will output a quantization error value every second.  
But if you're using the 1/T method, there's nothing you can do with it, so you 
have to live with whatever quantization errors you get.

Anyway, those are my experiences.

Bob - AE6RV







From: Mark Haun hau...@keteu.org
To: time-nuts@febo.com
Sent: Wednesday, February 26, 2014 3:51 PM
Subject: [time-nuts] GPSDO with all-digital phase/time measurement?


Hi everyone,

I'm new to the list, and have been reading the recent threads on
Arduino-based GPSDOs and the pros/cons of 10-kHz vs 1-Hz time pulses with
interest.

As I understand it, there are a couple of reasons why one needs a
time-interval / phase measurement implemented outside the MCU:

1) Time resolution inside the MCU is limited by its clock period, which is
much too coarse.  The GPSDO would ping-pong within a huge dead zone.
2) Software tends to inject non-determinism into the timing.

snip

Thanks,

Mark
KJ6PC



___
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.



___
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.


[time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-26 Thread Mark Haun
Hi everyone,

I'm new to the list, and have been reading the recent threads on
Arduino-based GPSDOs and the pros/cons of 10-kHz vs 1-Hz time pulses with
interest.

As I understand it, there are a couple of reasons why one needs a
time-interval / phase measurement implemented outside the MCU:

1) Time resolution inside the MCU is limited by its clock period, which is
much too coarse.  The GPSDO would ping-pong within a huge dead zone.
2) Software tends to inject non-determinism into the timing.

Are there others?  I have no background or experience with PLLs/DLLs, so
I'm really just feeling my way blindly here.

That being said, I find myself wondering as follows:
Suppose that we count OCXO cycles (at, say, 10 MHz) using one of the MCU's
timer/counter peripherals, and periodically sample the counter value with an
interrupt triggered on the rising edge of the GPS 1pps.  Assume that this
interrupt is the highest priority in the system, so that our measurement is
fully deterministic, having only the +/- one cycle ambiguity inherent in the
counting.  Also assume that we keep the counter running continuously.

At this point the time measurement is quite crude, with 100-ns resolution. 
But because we keep the counter running, the unknown residuals will keep
accumulating, and we should be able to average out this quantization noise
in the long run.  That is, we can measure any T-second period to within 100
ns, so the resolution on a per-second basis becomes 100 ns / T.

Is there any reason why this sort of processing cannot attain equivalent
performance to the more conventional analog phase-detection approach?

Thanks,

Mark
KJ6PC
___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-26 Thread Tom Van Baak
Hi Mark,

Not to worry. It's not really too coarse. Your method is more than enough for 
millisecond or microsecond timing. Consider that everything about time  
frequency is merely an exponent; avoid fuzzy words like coarse or fine. Your 
approach will work just fine; many a GPSDO has been designed that way.

If you measure your oscillator to a second using WWVB and make adjustments, or 
if you measure your oscillator to a millisecond using NTP and make adjustments, 
or if you measure your oscillator to a microsecond using GPS and make 
adjustments, it is really all the same thing. The exponent is different but the 
concept is the same.

The final result depends on the time quality of the external 1PPS, the 
frequency quality of your oscillator, the resolution quality of your 
measurement, and the granularity of your adjustment. So every GPSDO works, 
the question is simply how well does it work? And does it meet your needs? For 
many applications 1 ms or 1 us timing accuracy is more than enough. For only a 
few applications does 100 ns or 50 ns matter. It gets much, much harder as you 
get into the double and single ns digit range.

Several members on this list have developed GPSDO that are based on a MCU 
timestamping of 1PPS pulses. It works fine. Perfecting the tuning constants 
takes some time, and is somewhat dependent on your GPS receiver, your antenna, 
your location. Your oscillator, environment, and MCU also play a key part. But 
the art is to be able to *measure* all of this, to document it, to experiment, 
and to possibly improve on it over time.

/tvb

- Original Message - 
From: Mark Haun hau...@keteu.org
To: time-nuts@febo.com
Sent: Wednesday, February 26, 2014 1:51 PM
Subject: [time-nuts] GPSDO with all-digital phase/time measurement?


 Hi everyone,
 
 I'm new to the list, and have been reading the recent threads on
 Arduino-based GPSDOs and the pros/cons of 10-kHz vs 1-Hz time pulses with
 interest.
 
 As I understand it, there are a couple of reasons why one needs a
 time-interval / phase measurement implemented outside the MCU:
 
 1) Time resolution inside the MCU is limited by its clock period, which is
 much too coarse.  The GPSDO would ping-pong within a huge dead zone.
 2) Software tends to inject non-determinism into the timing.
 
 Are there others?  I have no background or experience with PLLs/DLLs, so
 I'm really just feeling my way blindly here.
 
 That being said, I find myself wondering as follows:
 Suppose that we count OCXO cycles (at, say, 10 MHz) using one of the MCU's
 timer/counter peripherals, and periodically sample the counter value with an
 interrupt triggered on the rising edge of the GPS 1pps.  Assume that this
 interrupt is the highest priority in the system, so that our measurement is
 fully deterministic, having only the +/- one cycle ambiguity inherent in the
 counting.  Also assume that we keep the counter running continuously.
 
 At this point the time measurement is quite crude, with 100-ns resolution. 
 But because we keep the counter running, the unknown residuals will keep
 accumulating, and we should be able to average out this quantization noise
 in the long run.  That is, we can measure any T-second period to within 100
 ns, so the resolution on a per-second basis becomes 100 ns / T.
 
 Is there any reason why this sort of processing cannot attain equivalent
 performance to the more conventional analog phase-detection approach?
 
 Thanks,
 
 Mark
 KJ6PC


___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-26 Thread Chris Albertson
At this point the time measurement is quite crude, with 100-ns resolution.
 But because we keep the counter running, the unknown residuals will keep
 accumulating, and we should be able to average out this quantization
 noise


What you are saying is With a long enough gate time you can measure
frequency to any desired level of accuracy.

For that to be true the  frequency must remain stable over the long period
you are averaging.  For example let's say you average over 10 seconds.
 What happens of the nominal 10MHz oscillator ran at  10.1 Mhz for five
seconds and then 9.9 Mhz for 5 seconds.   You'd measure 10Mhz and be happy.
  So there is the problem.  With long period averaging, you can only do it
for so long as you trust the clock to not change.

All the long gate time tells you is the AVERAGE so it only works of the
change over the period is smooth and monotonic.

If you want very good accuracy, say one part in 10^14 you can't get there
by waiting days and weeks because the frequency will move while you are
measuring it.

The quicker way is to measure the phase.  You can still do this digitally.
 Make a one bit measurement.  zero if the phase leads, 1 if it lags and
then over time you want the average to be 0.5  This works much faster
because your controller does not have to wait for an entire cycle of error
to accumulate.

Your counting system would have to wait for a one cycle error and then make
a very large and infrequent correction.   It could work for some use cases.
-- 

Chris Albertson
Redondo Beach, California
___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-26 Thread Bob Stewart
Hi Mark,

I'm neither an engineer, nor an expert, but here are my comments.  

I think that the idea of 100ns/T is wrong.  There are several variables that 
control accuracy, but the time between pulses from your OCXO (assuming no phase 
or frequency drift) isn't one of them.  So, that gives 1/T.  Here the problem 
is that T must get large before your accuracy can be good.  You can achieve 
very good accuracy, but at the cost of waiting thousands of seconds between 
phase points; i.e. where your 1PPS coincides with the 10 millionth OCXO 
pulse.  The theoretical maximum would be infinity, of course, but your 
oscillator won't be that stable.

Another big problem is the accuracy of the 1PPS pulse.  I'm using an Adafruit 
GPS receiver, and it's listed as accurate to within 10ns.  And it is, but you 
have to be wary of exactly what that means.  It doesn't mean +/- 5ns.  So, as 
your 1PPS pulse bobs back and forth, you will often encounter an OCXO pulse up 
to 10ns early, or up to 10ns late.  So, might you count 9,999,999 pulses from 
the OCXO immediately followed by 10,000,001 pulses.  Neither of those, by 
itself is a signal to change the EFC voltage to your OCXO.  In fact, it is 
normal for your count to alternate between the two for long periods, if you are 
very very close to exactly 10MHz, just from the quantization error on the 1PPS. 
 It is also normal for 1/T to control the time between phase crossings.  So you 
have to wait for two miscounts in a row in the same direction to make a change. 
 And even then, you can't be 100% sure that it's not due to the quantization 
errors in your 1PPS
 signal.

The better GPS receivers will output a quantization error value every second.  
But if you're using the 1/T method, there's nothing you can do with it, so you 
have to live with whatever quantization errors you get.

Anyway, those are my experiences.

Bob - AE6RV






 From: Mark Haun hau...@keteu.org
To: time-nuts@febo.com 
Sent: Wednesday, February 26, 2014 3:51 PM
Subject: [time-nuts] GPSDO with all-digital phase/time measurement?
 

Hi everyone,

I'm new to the list, and have been reading the recent threads on
Arduino-based GPSDOs and the pros/cons of 10-kHz vs 1-Hz time pulses with
interest.

As I understand it, there are a couple of reasons why one needs a
time-interval / phase measurement implemented outside the MCU:

1) Time resolution inside the MCU is limited by its clock period, which is
much too coarse.  The GPSDO would ping-pong within a huge dead zone.
2) Software tends to inject non-determinism into the timing.

snip

Thanks,

Mark
KJ6PC


___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-26 Thread Bob Stewart
Tom,

I took his 100ns figure to be simply the period of 10MHz.  He mentioned using 
an interrupt driven system, so the counts should not necessarily be limited to 
100ns accuracy.  At least on the PIC I'm using, the CCP and timer interrupts 
don't seem to be synchronous with the PIC clock.  I could be mistaken.

Bob






 From: Tom Van Baak t...@leapsecond.com
To: Discussion of precise time and frequency measurement time-nuts@febo.com 
Sent: Wednesday, February 26, 2014 11:22 PM
Subject: Re: [time-nuts] GPSDO with all-digital phase/time measurement?
 

 At this point the time measurement is quite crude, with 100-ns resolution. 
 But because we keep the counter running, the unknown residuals will keep
 accumulating, and we should be able to average out this quantization noise
 in the long run.  That is, we can measure any T-second period to within 100
 ns, so the resolution on a per-second basis becomes 100 ns / T.

No. The timing resolution per second is always 100 ns. You're probably 
thinking about average frequency, in which case dividing by T is sometimes 
valid, and it looks better and better as time goes by, usually.

What saves you here is that your counter noise (100 ns) is likely greater than 
the quantization noise. So you can pretty much ignore the receiver 1PPS 
quantization noise. For people with much lower measurement noise (e.g., 1 ns) 
the quantization noise becomes a more important piece of the error pie.

Try not to say average out; that sounds like it goes away over time or gets 
smaller. You're doing a timing measurement so the 100 ns measurement 
granularity is always there, on every measurement.

 Is there any reason why this sort of processing cannot attain equivalent
 performance to the more conventional analog phase-detection approach?

All other factors equal, a GPSDO based on 100 ns measurement resolution can 
never attain the equivalent of a GPSDO based on 10 ns or 1 ns measurement 
resolution. Waiting shorter or longer doesn't change the RMS timing accuracy.

/tvb

___
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.



___
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.


Re: [time-nuts] GPSDO with all-digital phase/time measurement?

2014-02-26 Thread Hal Murray

b...@evoria.net said:
 At least on the PIC I'm using, the CCP and timer interrupts don't seem to be
 synchronous with the PIC clock.  I could be mistaken. 

Unless you have a very strange architecture, it doesn't make sense for an 
interrupt to not be synchronous with the CPU clock.  You are in the middle of 
an add instruction, and now you want to start an interrupt.  What does that 
mean?

I expect there is the standard 2 FF synchronizer on all the input pins.  
Things like the counter/timers run on the CPU clock, taking their input after 
the synchronizer.  I don't remember seeing a data sheet that comes out and 
says that, but sometimes you can get some (strong?) hints with things like 
minimum pulse widths or max clock rate.


-- 
These are my opinions.  I hate spam.



___
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.