time-nuts@lists.febo.com

Discussion of precise time and frequency measurement

View all threads

Recommendation for cheap GBIP adapter for Linux

AK
Attila Kinali
Mon, Nov 20, 2017 1:47 AM

On Mon, 20 Nov 2017 11:47:09 +1300 (NZDT)
Bruce Griffiths bruce.griffiths@xtra.co.nz wrote:

That's a fairly standard JFET BJT negative feedback amp that's not usually unstable.

Uh.. uhmm.. sorry about that... I'm electronically challenged, it seems.

		Attila Kinali

--
You know, the very powerful and the very stupid have one thing in common.
They don't alters their views to fit the facts, they alter the facts to
fit the views, which can be uncomfortable if you happen to be one of the
facts that needs altering.  -- The Doctor

On Mon, 20 Nov 2017 11:47:09 +1300 (NZDT) Bruce Griffiths <bruce.griffiths@xtra.co.nz> wrote: > That's a fairly standard JFET BJT negative feedback amp that's not usually unstable. Uh.. uhmm.. sorry about that... I'm electronically challenged, it seems. Attila Kinali -- You know, the very powerful and the very stupid have one thing in common. They don't alters their views to fit the facts, they alter the facts to fit the views, which can be uncomfortable if you happen to be one of the facts that needs altering. -- The Doctor
AK
Attila Kinali
Mon, Nov 20, 2017 1:52 AM

On Sun, 19 Nov 2017 22:56:41 +0000
Angus not.again@btinternet.com wrote:

The MV89 is a beast of an OCXO and uses more power at warm-up than any
other
I know of. But it is spec'ed ~1W for steady state. Which means the
outside of the OCXO should be about hand-warm. If it's too hot, then
the heater circuit is probably broken and running at full-throttle.

If so, I think something is not OK with my MV89. It is probably 110
degrees or so.

They do run hot, so if that's 110 DegF and not DegC it's OK (depending
on ambient...) The data sheet says 4.2W at 25 DegC.

Oops.. I miscalculated the power consumption of the MV89..
Sorry about.

Today doesn't seem to be a good day for me to answer questions it seems.

		Attila Kinali

--
You know, the very powerful and the very stupid have one thing in common.
They don't alters their views to fit the facts, they alter the facts to
fit the views, which can be uncomfortable if you happen to be one of the
facts that needs altering.  -- The Doctor

On Sun, 19 Nov 2017 22:56:41 +0000 Angus <not.again@btinternet.com> wrote: > >> The MV89 is a beast of an OCXO and uses more power at warm-up than any > >> other > >> I know of. But it is spec'ed ~1W for steady state. Which means the > >> outside of the OCXO should be about hand-warm. If it's too hot, then > >> the heater circuit is probably broken and running at full-throttle. > > > >If so, I think something is not OK with my MV89. It is probably 110 > >degrees or so. > > They do run hot, so if that's 110 DegF and not DegC it's OK (depending > on ambient...) The data sheet says 4.2W at 25 DegC. Oops.. I miscalculated the power consumption of the MV89.. Sorry about. Today doesn't seem to be a good day for me to answer questions it seems. Attila Kinali -- You know, the very powerful and the very stupid have one thing in common. They don't alters their views to fit the facts, they alter the facts to fit the views, which can be uncomfortable if you happen to be one of the facts that needs altering. -- The Doctor
V
Vlad
Mon, Nov 20, 2017 2:12 AM

Assuming the STM32 is set to trigger on the rising edge, a 2x output
will occur if there is bounce from a falling edge. Normally this is
not desirable, but there are cases where measuring both rising and
falling edge improves resolution. For example I have a version of the
picPET that timestamps both edges (this gives you pulse width and duty
cycle information). The CNT-91 counter also does this in raw timestamp
mode.

I'll need to experiment with this. I think the drawback cold be for the
signal with long pulse width (more than one second).
__|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

26.5837255
26.23559295
26.5941842

However, it is some "spikes" in the data flow (see above the number
"26.23559295", which suppose to be something as "26.58..."). I can't
understand the reason for that.

That's a software problem for sure. Do you use interrupts? Or some
library code for formatting and output?

STM32 has an internal counter which counting MCU ticks (I clocked my
stone by 40Mhz. So, it will be 40 mln. ticks per second). I am using
this ticks number to get microseconds as signal capture event has
occurred.
My other timer generate interrupt each second. This is used to start
count the microseconds over again. So, its pretty simple.
I'll need to dig this issue deeper, since its occurred only when I was
using DDS generator as a signal source. I know DDS chips sometimes
generates some spurs. But not sure if this is related.

It sounds like you have two problems: 1) h/w signal conditioning
before the STM32, and 2) a s/w timing issue in your code or in how you
use the USART. To separate them, try a clean square wave directly into
the STM32 over a range of frequencies from slow to fast to faster than
the STM32 can keep up.

If I raise the input freq. to 1Mhz, the STM32 become unresponsive, since
number "capture" interrupts is too high. The signal capture interrupt
routine doing nothing more than one assignment : "cur_tick =
DWT->CYCCNT"
Which means that I am getting current number of ticks.
USART will print the number as event will be detected. The speed is
115200. And I am not using interrupt for this.

BTW, the good news is that your time stamping output looks like the
picPET -- http://leapsecond.com/pic -- which means that you can use
TimeLab to directly capture and/or display all your data (phase,
frequency, adev, etc.).

I think I'll need to order few picPETs to use them as a reference for my
project. Let me know if you could ship to Canada.

As an example, the old PIC I'm using is limited to 125 samples per
second (mostly due to RS232 transmit time at 19,200 baud), but with an
8-bit event count you can directly measure frequencies up to 256 times
greater (32 kHz). With a 16-bit event counter that number climbs to 8
MHz. All this without a pre-scaler.

I was try to use DMA to keep counter value. And then I was counting
number of overflows. However, I noticed this is more complex
computations is necessary to get microseconds from this comb. STM32F103
has no 32bit timers. Using 40Mhz clock, I can't go low than 610Hz
without some tricks, like using pre-scaler or cascading the timers. I
tried those methods but results was not impressive. Probably because of
my software implementation. I am using DMA and other timer to capture
1PPS events. It works OK for me. But in that case I just need one
number. Which ideally should be 23040 in my case (40000000 % 65536 =
23040). I don't care about number of overflows and anything else in this
case. If I am getting something different from magic number - its time
to tweak DAC to control OCXO.

--
WBW,

V.P.

> Assuming the STM32 is set to trigger on the rising edge, a 2x output > will occur if there is bounce from a falling edge. Normally this is > not desirable, but there are cases where measuring both rising and > falling edge improves resolution. For example I have a version of the > picPET that timestamps both edges (this gives you pulse width and duty > cycle information). The CNT-91 counter also does this in raw timestamp > mode. I'll need to experiment with this. I think the drawback cold be for the signal with long pulse width (more than one second). __|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> 26.5837255 >> 26.23559295 >> 26.5941842 > >> However, it is some "spikes" in the data flow (see above the number >> "26.23559295", which suppose to be something as "26.58..."). I can't >> understand the reason for that. > > That's a software problem for sure. Do you use interrupts? Or some > library code for formatting and output? STM32 has an internal counter which counting MCU ticks (I clocked my stone by 40Mhz. So, it will be 40 mln. ticks per second). I am using this ticks number to get microseconds as signal capture event has occurred. My other timer generate interrupt each second. This is used to start count the microseconds over again. So, its pretty simple. I'll need to dig this issue deeper, since its occurred only when I was using DDS generator as a signal source. I know DDS chips sometimes generates some spurs. But not sure if this is related. > It sounds like you have two problems: 1) h/w signal conditioning > before the STM32, and 2) a s/w timing issue in your code or in how you > use the USART. To separate them, try a clean square wave directly into > the STM32 over a range of frequencies from slow to fast to faster than > the STM32 can keep up. If I raise the input freq. to 1Mhz, the STM32 become unresponsive, since number "capture" interrupts is too high. The signal capture interrupt routine doing nothing more than one assignment : "cur_tick = DWT->CYCCNT" Which means that I am getting current number of ticks. USART will print the number as event will be detected. The speed is 115200. And I am not using interrupt for this. > BTW, the good news is that your time stamping output looks like the > picPET -- http://leapsecond.com/pic -- which means that you can use > TimeLab to directly capture and/or display all your data (phase, > frequency, adev, etc.). I think I'll need to order few picPETs to use them as a reference for my project. Let me know if you could ship to Canada. > As an example, the old PIC I'm using is limited to 125 samples per > second (mostly due to RS232 transmit time at 19,200 baud), but with an > 8-bit event count you can directly measure frequencies up to 256 times > greater (32 kHz). With a 16-bit event counter that number climbs to 8 > MHz. All this without a pre-scaler. I was try to use DMA to keep counter value. And then I was counting number of overflows. However, I noticed this is more complex computations is necessary to get microseconds from this comb. STM32F103 has no 32bit timers. Using 40Mhz clock, I can't go low than 610Hz without some tricks, like using pre-scaler or cascading the timers. I tried those methods but results was not impressive. Probably because of my software implementation. I am using DMA and other timer to capture 1PPS events. It works OK for me. But in that case I just need one number. Which ideally should be 23040 in my case (40000000 % 65536 = 23040). I don't care about number of overflows and anything else in this case. If I am getting something different from magic number - its time to tweak DAC to control OCXO. -- WBW, V.P.
V
Vlad
Mon, Nov 20, 2017 3:28 AM

26.5837255
26.23559295
26.5941842

However, it is some "spikes" in the data flow (see above the number
"26.23559295", which suppose to be something as "26.58..."). I can't
understand the reason for that.

That's a software problem for sure. Do you use interrupts? Or some
library code for formatting and output?

I think I found the problem and the solution (partially).
Since I am using capture interrupt which change the value
"on-the-flight" - its appeared that some capture event could happen when
USART doing its work (printing).
So, I put the "lock" there. If USART is already printing, then the
interrupt routine will not change the value. It seems its helps to some
degree. At least I have normal data flow. No strange numbers any more.
However it make me think that I definitely loosing something, when USART
is busy to print.

--
WBW,

V.P.

>>> 26.5837255 >>> 26.23559295 >>> 26.5941842 >> >>> However, it is some "spikes" in the data flow (see above the number >>> "26.23559295", which suppose to be something as "26.58..."). I can't >>> understand the reason for that. >> >> That's a software problem for sure. Do you use interrupts? Or some >> library code for formatting and output? I think I found the problem and the solution (partially). Since I am using capture interrupt which change the value "on-the-flight" - its appeared that some capture event could happen when USART doing its work (printing). So, I put the "lock" there. If USART is already printing, then the interrupt routine will not change the value. It seems its helps to some degree. At least I have normal data flow. No strange numbers any more. However it make me think that I definitely loosing something, when USART is busy to print. -- WBW, V.P.
TV
Tom Van Baak
Mon, Nov 20, 2017 3:54 AM

I'll need to experiment with this. I think the drawback cold be for the
signal with long pulse width (more than one second).
__|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm not sure I understand. If you're building some kind of time interval counter or timestamp counter the duration is only limited by how many digits or bits you allocate to your timestamp. Longer than one second should be very easy.

That's a software problem for sure. Do you use interrupts? Or some
library code for formatting and output?

STM32 has an internal counter which counting MCU ticks (I clocked my
stone by 40Mhz. So, it will be 40 mln. ticks per second). I am using
this ticks number to get microseconds as signal capture event has
occurred.

That sounds fine.

My other timer generate interrupt each second. This is used to start
count the microseconds over again. So, its pretty simple.

This could be trouble. You'll have to check for timing windows in your code. It's usually better to let counters free-run rather than to start / stop / reset them all the time.

I'll need to dig this issue deeper, since its occurred only when I was
using DDS generator as a signal source. I know DDS chips sometimes
generates some spurs. But not sure if this is related.

If I raise the input freq. to 1Mhz, the STM32 become unresponsive, since
number "capture" interrupts is too high. The signal capture interrupt
routine doing nothing more than one assignment : "cur_tick =
DWT->CYCCNT"

Make sure this assignment is atomic (a single load/store pair, not multi-byte or multi-word instruction sequence); very timer and cpu dependent.

You don't want unresponsive. When you get an event, capture the timer, format your output, and do the serial transmit. Only when that's all finished then re-enable for the next event. This avoids lock-up. And it means your CPU saturates at the point where your output rate is a maximum. So it's self regulating. Note if you do all your event processing in the interrupt handler and cur_tick is not used at main level, you don't have to worry about atomic loads and stores either.

Another way around all of this is to use capture/compare registers. Most uC have this feature. This way your precise timing is not at all dependent on interrupt latency or what language you write in.

has no 32bit timers. Using 40Mhz clock, I can't go low than 610Hz
without some tricks, like using pre-scaler or cascading the timers. I
tried those methods but results was not impressive. Probably because of

One solution is to use h/w timers for the low bits and s/w overflow counters for the high bits. For example a 64-bit counter could be made using a 16-bit timer and a 48-bit overflow count. This is an overflow every 1.6 ms, which is easy to deal with using either interrupts or polling.

my software implementation. I am using DMA and other timer to capture
1PPS events. It works OK for me. But in that case I just need one
number. Which ideally should be 23040 in my case (40000000 % 65536 =
23040). I don't care about number of overflows and anything else in this
case. If I am getting something different from magic number - its time
to tweak DAC to control OCXO.

Right, if this is just for a GPSDO then you can consider modulus tricks like this. If you're making a more general purpose time interval counter or time stamping counter then you can't rely on that trick. I'm not sure of the context for this thread. It sort of seemed like you were building a counter.

Then again, even if this is a GPSDO I would not want to rely on magic number tricks. What happens if the user decides to change antenna length in order to move the 1PPS by hundreds of us? The magic trick will now cause great trouble. You can avoid that with a FLL instead of PLL version of GPSDO and ignore what look like glitches. But this is now adding hack upon hack. My advise is just implement a 0 to 1.x second TIC. It can't be that hard to do that in a STM32.

/tvb

> I'll need to experiment with this. I think the drawback cold be for the > signal with long pulse width (more than one second). > __|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I'm not sure I understand. If you're building some kind of time interval counter or timestamp counter the duration is only limited by how many digits or bits you allocate to your timestamp. Longer than one second should be very easy. >> That's a software problem for sure. Do you use interrupts? Or some >> library code for formatting and output? > > STM32 has an internal counter which counting MCU ticks (I clocked my > stone by 40Mhz. So, it will be 40 mln. ticks per second). I am using > this ticks number to get microseconds as signal capture event has > occurred. That sounds fine. > My other timer generate interrupt each second. This is used to start > count the microseconds over again. So, its pretty simple. This could be trouble. You'll have to check for timing windows in your code. It's usually better to let counters free-run rather than to start / stop / reset them all the time. > I'll need to dig this issue deeper, since its occurred only when I was > using DDS generator as a signal source. I know DDS chips sometimes > generates some spurs. But not sure if this is related. > If I raise the input freq. to 1Mhz, the STM32 become unresponsive, since > number "capture" interrupts is too high. The signal capture interrupt > routine doing nothing more than one assignment : "cur_tick = > DWT->CYCCNT" Make sure this assignment is atomic (a single load/store pair, not multi-byte or multi-word instruction sequence); very timer and cpu dependent. You don't want unresponsive. When you get an event, capture the timer, format your output, and do the serial transmit. Only when that's all finished then re-enable for the next event. This avoids lock-up. And it means your CPU saturates at the point where your output rate is a maximum. So it's self regulating. Note if you do all your event processing in the interrupt handler and cur_tick is not used at main level, you don't have to worry about atomic loads and stores either. Another way around all of this is to use capture/compare registers. Most uC have this feature. This way your precise timing is not at all dependent on interrupt latency or what language you write in. > has no 32bit timers. Using 40Mhz clock, I can't go low than 610Hz > without some tricks, like using pre-scaler or cascading the timers. I > tried those methods but results was not impressive. Probably because of One solution is to use h/w timers for the low bits and s/w overflow counters for the high bits. For example a 64-bit counter could be made using a 16-bit timer and a 48-bit overflow count. This is an overflow every 1.6 ms, which is easy to deal with using either interrupts or polling. > my software implementation. I am using DMA and other timer to capture > 1PPS events. It works OK for me. But in that case I just need one > number. Which ideally should be 23040 in my case (40000000 % 65536 = > 23040). I don't care about number of overflows and anything else in this > case. If I am getting something different from magic number - its time > to tweak DAC to control OCXO. Right, if this is just for a GPSDO then you can consider modulus tricks like this. If you're making a more general purpose time interval counter or time stamping counter then you can't rely on that trick. I'm not sure of the context for this thread. It sort of seemed like you were building a counter. Then again, even if this is a GPSDO I would not want to rely on magic number tricks. What happens if the user decides to change antenna length in order to move the 1PPS by hundreds of us? The magic trick will now cause great trouble. You can avoid that with a FLL instead of PLL version of GPSDO and ignore what look like glitches. But this is now adding hack upon hack. My advise is just implement a 0 to 1.x second TIC. It can't be that hard to do that in a STM32. /tvb
CS
Charles Steinmetz
Mon, Nov 20, 2017 5:15 AM

Bruce wrote:

Oops I meat to say:

Thats a MOSFET variant of a fairly standard JFET-BJT feedback amplifier.

I think you were right the first time.  Vlad said in his first post that
the input device is a 2N5485 (JFET).

I'm not sure why Vlad designed the input squarer that way.  If the
FET/BJT amp feeds a 74AC gate, which Vlad said it does, the gate is
doing all of the effective squaring.  The discrete components are just
adding noise.  The circuit will have lower noise and jitter if the FET,
BJT, and diodes are left out and the input signal is just cap-coupled
into the gate, with its input biased to half-supply by a voltage divider
from V+.  Note that with AC logic, the gate may oscillate with an open
input and/or no signal, if the termination resistor is too large.  HC
logic is much less prone to this.

A small improvement in the phase noise of this circuit can be made by
filtering the gate input bias divider (well, it could be a larger
improvement if you have noisy power rails...).  This can be easily
accomplished by using a string of four resistors for the divider rather
than two, and bypassing the added nodes to ground with low-leakage
electrolytic capacitors (see attached diagram).

Best regards,

Charles

Bruce wrote: > Oops I meat to say: > > Thats a MOSFET variant of a fairly standard JFET-BJT feedback amplifier. I think you were right the first time. Vlad said in his first post that the input device is a 2N5485 (JFET). I'm not sure why Vlad designed the input squarer that way. If the FET/BJT amp feeds a 74AC gate, which Vlad said it does, the gate is doing all of the effective squaring. The discrete components are just adding noise. The circuit will have lower noise and jitter if the FET, BJT, and diodes are left out and the input signal is just cap-coupled into the gate, with its input biased to half-supply by a voltage divider from V+. Note that with AC logic, the gate may oscillate with an open input and/or no signal, if the termination resistor is too large. HC logic is much less prone to this. A small improvement in the phase noise of this circuit can be made by filtering the gate input bias divider (well, it could be a larger improvement if you have noisy power rails...). This can be easily accomplished by using a string of four resistors for the divider rather than two, and bypassing the added nodes to ground with *low-leakage* electrolytic capacitors (see attached diagram). Best regards, Charles