Author Topic: DIY GPSDO project w/ STM32, TDC7200  (Read 46107 times)

0 Members and 1 Guest are viewing this topic.

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #25 on: December 17, 2019, 08:16:39 am »
The std dev is better: 97ps.
The squarer - there is a discussion in Lars' thread.

Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #26 on: December 17, 2019, 08:48:15 am »
Yes, it's definitely better. I also tried removing any residual drift with a FIR high-pass filter, but the improvement is only marginal.
Everybody likes gadgets. Until they try to make them.
 

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 814
  • Country: gb
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #27 on: December 17, 2019, 08:58:39 am »
Just for kicks I've added an Allan variance plot.
Numbers look unusually bad for variance, are you sure it is not deviation?
Leo

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #28 on: December 17, 2019, 09:09:36 am »
Just for kicks I've added an Allan variance plot.
Numbers look unusually bad for variance, are you sure it is not deviation?
Leo

Yep, you're right. It's Allan deviation (tau-sigma). I'm correcting the post.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #29 on: December 17, 2019, 11:12:55 am »
And it is ADEV of what? How did you get the ADEV off pps2log?
Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #30 on: December 17, 2019, 02:36:49 pm »
Well that's just the pps2.log.txt dataset scaled to 1ps and then run through "octave" and a function for ADEV. What it shows I think is that for observation intervals longer than 400 seconds, you get down to a resolution of about 60ps and no improvement from there on. If I understood it correctly, that's the limit of the TDC7200.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #31 on: December 17, 2019, 02:53:21 pm »
With TimeLab (all trends subtracted) I get the same result, but 5ps (not 60ps). You've got 5ps too, it seems.
I've multiplied the data by 1e-12.
Have you filtered the data in pps2log.txt above somehow?

PS: doublecheck your 7200 math. As I wrote earlier, the first step should be to test the 7200 such it returns correct data. Best with well defined start-stop, ie. 1us directly on the board (not with external sources with undefined params).
« Last Edit: December 17, 2019, 03:27:55 pm by imo »
Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #32 on: December 17, 2019, 05:14:48 pm »
With TimeLab (all trends subtracted) I get the same result, but 5ps (not 60ps). You've got 5ps too, it seems.
I've multiplied the data by 1e-12.
Have you filtered the data in pps2log.txt above somehow?

PS: doublecheck your 7200 math. As I wrote earlier, the first step should be to test the 7200 such it returns correct data. Best with well defined start-stop, ie. 1us directly on the board (not with external sources with undefined params).

The data is unfiltered, I just cut of a section at the beginning with an obvious temperature drift, then multiplied it by 1e-12. You're right, it's somewhere in the 5ps range, I misread the graph.

The math is indeed a bit tricky. I used the well-known Arduino library for the TDC7200 (there is only one I believe) and translated it into plain C. There's definitely some pitfalls in there due to the mixed data types (32bit unsigned int vs. 64bit signed int etc), I had to get in with the debugger and look at intermediate results to get all the casts correct. I had to introduce a few temporary variables to make sure the compiler does everything correctly. When I have a bit of quality time to wire up an inverter, I'll definitely make a sanity check.

Menawhile I checked a couple of ideas around the squarer and decided that no amount of trickery with the current single-chip solution will get me to the required stability. So I'll add an additional inverter gate, probably an SN74LVC1G04 in SOT23-5 package, might be able to squeeze it in there if I push the chips around a little bit.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #33 on: December 17, 2019, 05:21:41 pm »
« Last Edit: December 17, 2019, 05:41:10 pm by imo »
Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #34 on: December 18, 2019, 09:52:50 am »
That's only the frontend part of it, though. There's an additional inverter after it, too.
Everybody likes gadgets. Until they try to make them.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #35 on: December 18, 2019, 09:58:00 am »
I've taken some time to assemble the Ublox breakout module. Seems to be working, at least Lady Heather claims it's a Ublox timing receiver. Bought it on Ebay from some French guy. Seems he has got the real stuff.

No antenna connected for now, I'll do that tonight when I'm back home.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #36 on: December 18, 2019, 05:35:49 pm »
Readers discretion is advised..
 

Online edpalmer42

  • Super Contributor
  • ***
  • Posts: 2331
  • Country: ca
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #37 on: December 18, 2019, 05:59:24 pm »
That's only the frontend part of it, though. There's an additional inverter after it, too.

The first stage is the key.  The performance of this frontend will determine the performance of your entire circuit.  Many people have tried many different circuits to determine what works best.  There doesn't seem to be a clear winner, but if you insist on the best possible performance, start researching circuits that NIST uses.  I don't have any links handy.

Turning a sine wave into a square wave is an analog function.  Trying to use a digital IC like a 74AC04 means you're operating far outside the normal operating parameters.  You're trying to make a digital circuit act like an analog comparator.  Standard rules do NOT apply.  Once you're past the first stage, you're now back into a normal digital environment.  Good performance in this environment is relatively easy to obtain.

The LPRO User's Guide and Integration Guidelines includes some good info on the topic.

http://www.ko4bb.com/getsimple/index.php?id=download&file=02_GPS_Timing/Datum/LPRO/Datum_LPRO_Users_guide1.pdf
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #38 on: December 18, 2019, 07:39:09 pm »
I've taken some time to assemble the Ublox breakout module. Seems to be working, at least Lady Heather claims it's a Ublox timing receiver. Bought it on Ebay from some French guy. Seems he has got the real stuff.

No antenna connected for now, I'll do that tonight when I'm back home.

With antenna connected - looks good. Not surprising, however. Biggest unknown was the origin of the ublox module, but it seems it's a good one.
The breakout board is trivial, the only complex item is a microstrip transmission line to connect the antenna socket with the module.
Everybody likes gadgets. Until they try to make them.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #39 on: December 18, 2019, 07:46:44 pm »

The LPRO User's Guide and Integration Guidelines includes some good info on the topic.

http://www.ko4bb.com/getsimple/index.php?id=download&file=02_GPS_Timing/Datum/LPRO/Datum_LPRO_Users_guide1.pdf

Yep, that's what I was using as a reference. They recommend the 74AC04, actually, in a non-self biasing configuration. I copied the circuit almost verbatim, but the decision to use the remaining inverters to distribute the 10MHz and as a driver for a sine wave output was quite likely a mistake. I skimped on the decoupling network they suggested, which was the second mistake.
Everybody likes gadgets. Until they try to make them.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #40 on: December 18, 2019, 08:02:56 pm »
FYI - some thoughts on sine squarer:
http://www.wenzel.com/documents/waveform.html
http://www.ke5fx.com/ac.htm

The TAPR-TICC input squarer frontend looks like a verbatim copy of the Wenzel paper. I likely won't need the a large input range for my purpose, so I'll pass here. I do like your version with the resonant LC tank for its simplicity.

How do you tune the circuit? I guess a fixed L and a trimmer capacitor are the best option here.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #41 on: December 18, 2019, 08:12:51 pm »
FYI - some thoughts on sine squarer:
http://www.wenzel.com/documents/waveform.html
http://www.ke5fx.com/ac.htm

The TAPR-TICC input squarer frontend looks like a verbatim copy of the Wenzel paper. I likely won't need the a large input range for my purpose, so I'll pass here. I do like your version with the resonant LC tank for its simplicity.

How do you tune the circuit? I guess a fixed L and a trimmer capacitor are the best option here.

The TAPR-TICC has got some "improvements" there, so it is not a verbatim copy. LC tank - I used to use a tuned L actually (off my junkbox), the fixed L and a combination of cap trimmer and fixed C would be more feasible today.

PS: off topic - still thinking how to get someone's position (lat, long) off the UTC and the position of the satellites listed :)
« Last Edit: December 18, 2019, 08:29:09 pm by imo »
Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #42 on: December 19, 2019, 10:30:08 am »
FYI - some thoughts on sine squarer:
http://www.wenzel.com/documents/waveform.html
http://www.ke5fx.com/ac.htm

The TAPR-TICC input squarer frontend looks like a verbatim copy of the Wenzel paper. I likely won't need the a large input range for my purpose, so I'll pass here. I do like your version with the resonant LC tank for its simplicity.

How do you tune the circuit? I guess a fixed L and a trimmer capacitor are the best option here.

The TAPR-TICC has got some "improvements" there, so it is not a verbatim copy. LC tank - I used to use a tuned L actually (off my junkbox), the fixed L and a combination of cap trimmer and fixed C would be more feasible today.

PS: off topic - still thinking how to get someone's position (lat, long) off the UTC and the position of the satellites listed :)

What was the Q of the inductor you used? Is it even relevant, I'm guessing that R would be the dominant factor anyway?

Regarding the position - that's an intriguing thought. But I doubt the precision would be better than city-level.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #43 on: December 19, 2019, 02:13:11 pm »
The L's quality - the higher the better.. The output impedance of the source should be kept low, as it is the part of the parallel LC tank (low Z coupling at the cold side, the tank's hot side is the inverter's input). The Rin=47-100ohm. Tune with o'scope (10Meg probe + few pF serial coupling) at the inverter's input to max amplitude (or to the max slope of edges, as the clamping diodes will limit the amplitude at the inverter's input). Mind it is a highZ point sensitive to parasitic C. Also the best inductor core would be iron powder (low TC) - see amidon toroid cores:
http://www.qrz.lt/ly1gp/amidon.html
« Last Edit: December 19, 2019, 04:03:24 pm by imo »
Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #44 on: December 23, 2019, 09:57:32 pm »
Took some time today to wire up an inverter between STOP and START. The results are - interesting.

Instead of steady 1µs measurement I get two clusters, one at 1µs and one at 3µs. Both in itself are stable, but the measurements jump randomly between the two.

Not SPI weirdness, I took a scope to the SPI bus and decoded the line protocol, the values I read in the software are actual, visible on the line.

There difference between the clusters is only from the TIME1 register, it jumps to and fro between them.

However, In "mode 2", TIME1 is the ring oscillator count from start to the next rising edge of the clock input. The clock input is 10MHz, so I cannot quite see how even a missed edge there could amount to a 2µs offset. There must be something very odd in my calculation. Something wrong with the LSB calculation from the calibration values, I guess.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #45 on: December 23, 2019, 10:07:58 pm »
Doublecheck whether you always calculate off the first s-s clock counter of the 7200 (there are 5).
Is the 1us pulse ok on your oscope?
Also what exact numbers you read?

In mode2 the ring oscillator counts 2x - TIME1 (start) and TIME2 (stop), plus it counts 10MHz periods CLOCK_COUNT1.

Quote
There difference between the clusters is only from the TIME1 register, it jumps to and fro between them.
TIME1 gives you max 100ns so no way to jump between 1u and 3us. Even with TIME2 it is not possible. With fully messed TIME1 and TIME2 it should show 1us +/- 200ns.
Nope - all those TIMEx and CLOCK_COUNTx are 24bit counters - so a lot of space for math problems..
« Last Edit: December 23, 2019, 10:47:41 pm by imo »
Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #46 on: December 24, 2019, 08:38:52 am »
Yes, there's something very strange about the TIME1 measurements. The readings are around 36620 for the 3µs cluster and 1262 for the 1µs cluster.
normLSB is reasonable and computes to around 56ps. The COUNT1 register always reads 10, which is also what it should be.

Provided there's nothing wrong with the circuit, what could be the reason for the strange TIME1 reading? It's almost as if the TDC was missing edges on the clock input and the ring oscillator doesn't stop. But on the scopes the signal there looks good.
Everybody likes gadgets. Until they try to make them.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5241
  • Country: bj
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #47 on: December 24, 2019, 09:01:45 am »
The best way would be to log (and post here) an excel table with a series (say 100 measurements) of following data:

Code: [Select]
PulseN.  TIME1  TIME2  CLOCK_COUNT1  CALIBRATION1  CALIBRATION2  YOUR_TOF1


The assumption would also be the clock period is 100ns and CALIBRATION2_PERIODS is 10.
« Last Edit: December 24, 2019, 09:09:25 am by imo »
Readers discretion is advised..
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #48 on: December 25, 2019, 06:47:19 am »
Santa brought an SDG2042X. Guess what happens if you use a proper signal source instead of a sketchy GPSDO from ebay.

 :palm:

Anyway, the measurements I'm getting are now 999999ps +/- 1. No glitches, no outliers.

I'm guessing the GPSDO has a high-impedance output, not 50 \$\Omega\$ and the BNC connectors are just decoration.
Everybody likes gadgets. Until they try to make them.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: DIY GPSDO project w/ STM32, TDC7200
« Reply #49 on: December 27, 2019, 10:10:23 am »
Photo of the test setup before I tore it down again to return to real world testing.
897436-0
Everybody likes gadgets. Until they try to make them.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf