[time-nuts] The amazing $5 timestamper with 6ns resolution (next stop: 184ps)

Jeremy Elson jelson at gmail.com
Wed Feb 17 07:48:12 UTC 2021


I've used jlcpcb before, but I have to admit I'm more of a pcbway guy. I've
had a lot of good experiences with them, and their assembly special ($30
for qty 10) plus LCSC parts is very cheap, I"ve had good luck with them.

You're right - the test I did conflated more than one thing. It was not a
pure test of my timestamper so my next attempt once I get some time will be
to use my Rb xo to run both the clock on my timestamper and a signal
generator and then see really how much jitter there is. Of course, there
will be some question if the jitter is coming from the timestamper or the
signal generator, but I suppose the best case is that there is not jitter
in either one! I'll keep the list updated as I do more experiments.

Cheers!

-Jeremy

On Tue, Feb 16, 2021 at 6:43 AM Bob kb8tq <kb8tq at n1k.org> wrote:

> Hi
>
> You can indeed do some pretty fancy things with easy to get
> chips !!!
>
> If you take a look at JLPCB
>
> https://jlcpcb.com <https://jlcpcb.com/>
>
> They seem to have a range of STM32’s (though not all of them …. :) )
> in stock. You can do up an assembled PCB very cheaply through them.
>
> One thing you might want to try:
>
> Run the *same* clock into the timebase on the STM32 *and* into the
> DUT input. Collect a few million samples and take the standard deviation.
> That will give you a pretty good idea of what’s what.
>
> At least on a conventional HP counter, the test comes up with one number
> for the “LSB” of the measurement and another (much larger) number for
> the one sigma average. Just what term you use to refer to that one sigma
> seems to be up to the marketing guys.
>
> With a time interval counter, you get to divide the measured one sigma
> by sqrt(2) to get the per channel number. With a time tagger, doing that
> can generate some level of debate. Usually it’s back to the fine print on
> this or that spec sheet to see what marketing decided to do this time ….
>
> Fun !!
>
> Bob
>
> > On Feb 15, 2021, at 9:50 PM, Jeremy Elson <jelson at gmail.com> wrote:
> >
> > I spent this past weekend building a little gadget I'm proud of and
> wanted
> > to share.
> >
> > I use STM32-based microcontrollers for a variety of personal projects,
> and
> > realized that I could use one to acquire reasonably high-precision
> > timestamps. The STM32G431
> > <https://www.st.com/en/microcontrollers-microprocessors/stm32g4x1.html>,
> > which costs about $5
> > <
> https://www.digikey.com/en/products/detail/stmicroelectronics/STM32G431C6T6/10326704
> >,
> > can
> > run up to 170Mhz and has counters that run at the same speed. It has an
> > input capture mode that can record counter values at the moment a GPIO
> > signal goes high. So this weekend I put together all the pieces needed to
> > do high precision timestamping:
> >
> > * A Rubidium oscillator I bought on Ebay some time ago (an LPRO-101)
> with a
> > diode clamper circuit to shift its voltage up, so it can drive the clock
> of
> > the STM32. This serves as the frequency standard for the timestamper. I
> > configured the STM32's internal PLL to multiply the Rb XO's 10Mhz x17 to
> > give a 170MHz system clock.
> > * Software on the STM32 that waits for input capture interrupts, reads
> the
> > captured counter value and writes the values over a serial port, where
> it's
> > logged on a PC
> > * A basic Python script that reads the data and does some statistical
> > analysis and draws graph
> > * A GPS receiver as a test signal generator -- the STM32 timestamps the
> PPS
> > signal coming from the GPS.
> >
> > The results of an 18-hour run are in the attached graph. The blue points
> > are the phase error between the Rubidium oscillator and the GPS PPS over
> > time after some outliers were rejected. The orange line is the linear
> > regression line, which has a slope (and thus implied frequency error
> > between Rb and GPS) of about 2e-10. My guess is that my Rubidium
> oscillator
> > needs some calibration since I think the performance of these things is
> > supposed to be closer to 1e-11. I suspect the larger discontinuities (and
> > the short term frequency error) are the GPS receiver gaining and losing
> > lock as birds come and go. My GPS receiver does not have a very good sky
> > view and is single-constellations, so is usually about 30 meters
> incorrect
> > about its location. It's actually the GPS inside of Nick Sayer's GPSDO
> > <https://www.tindie.com/products/nsayer/gps-disciplined-ocxo/>, though
> in
> > this case I am just using the PPS output directly from the GPS and not
> > Nick's conditioned and disciplined 10mhz output.
> >
> > I've also attached a second graph of a shorter run (tau=3000s) which
> gives
> > you a better view of the short-term jitter.
> >
> > I'm pretty pleased with the results, and all done with a single $5 chip.
> > RIght now it's just a mess of wires on a breadboard, but I'll probably
> make
> > a PCB out of it. With the cost of PCB fabrication and connectors, I
> suspect
> > the BOM would still be under $15 even in small quantities, which is
> > remarkable considering that such a device would have cost tens of
> thousands
> > of dollars a few decades ago.
> >
> > The higher-end, $10 version of this chip -- the STM32G474 -- has a
> special
> > high resolution timer that can run at 32x the system clock rate, for an
> > incredible 184ps resolution. I might try to get that running on some
> future
> > weekend; I didn't use it this past weekend because the '431 happened to
> be
> > what I had in the house already when I had the idea. Honestly, though,
> > anything higher resolution will be tougher to test unless I have a more
> > stable time standard to test against; maybe I should get a second Rb XO.
> >
> > The firmware
> > <
> https://github.com/jelson/rulos/blob/master/src/app/timestamper/timestamper.c
> >
> > and graph generator
> > <https://github.com/jelson/rulos/blob/master/src/app/timestamper/eval.py
> >
> > are both available on github. If there's interest, I will probably turn
> > this into a PCB and make that available too.
> >
> > Cheers,
> > -Jeremy
> >
> <gpsdo-pps-vs-rubidium-feb14.time.plot.png><gpsdo-pps-vs-rubidium-feb15.time.plot.png>_______________________________________________
> > time-nuts mailing list -- time-nuts at lists.febo.com
> > To unsubscribe, go to
> http://lists.febo.com/mailman/listinfo/time-nuts_lists.febo.com
> > and follow the instructions there.
>
> _______________________________________________
> time-nuts mailing list -- time-nuts at lists.febo.com
> To unsubscribe, go to
> http://lists.febo.com/mailman/listinfo/time-nuts_lists.febo.com
> and follow the instructions there.
>



More information about the Time-nuts_lists.febo.com mailing list