Author Topic: A GPS-referenced 1MHz square wave.  (Read 1715 times)

0 Members and 1 Guest are viewing this topic.

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2404
  • Country: nz
A GPS-referenced 1MHz square wave.
« on: September 25, 2018, 10:34:19 pm »
Spurred on by talk of a GPSDO based on an ESP32 mode, last night I had a hack at creating 1MHz GPS referenced signal using an FPGA board. After a good bit of thinking It was surprisingly simple.

1. Have a 100MHz numerically controlled oscillator (NCO) generating the 1MHz signal.
2. Have a second accumulator, which sees how much error is present when the PPS signal is seen
3. Slowly slew the NCO's frequency, proportional to 1/8th of the error over the last second. So at the end of the second, it is 1/8th of the way closer to the magic 1MHz value - basically a slow feedback loop.
4. If the PPS signal goes away, then zero the current error (to stop the NCO's frequency slewing off to infinity).

So rather than the 8 ppm error I would get from the dev board's 100MHz XTAL divided by 100, I now get less than 1 ppm (admittedly with about 10ns of saw-tooth jitter).

There are quite a few enhancements I could play with, (if only I had the time). Examples are adding an DAC, removing lots of the sawtooth jitter, adding a frequency display...).

http://hamsterworks.co.nz/mediawiki/index.php/GPSDO
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: A GPS-referenced 1MHz square wave.
« Reply #1 on: September 25, 2018, 10:39:25 pm »
I am lost. What is the purpose?
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2404
  • Country: nz
Re: A GPS-referenced 1MHz square wave.
« Reply #2 on: September 25, 2018, 10:47:49 pm »
I am lost. What is the purpose?

To amusing myself as there was nothing good to watch on TV.

But I now have access to a better 1 MHz clock than I did before, if I ever need it for some reason.

Maybe I will use it to drive a microcontroller?
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: A GPS-referenced 1MHz square wave.
« Reply #3 on: September 25, 2018, 11:16:19 pm »
Quote
To amusing myself as there was nothing good to watch on TV.

hehe, I was wondering if you had found the correcting algorithm's trick used by military forces to have a better precision on the GPS  :D

We poor people have the GPS voluntary-corrupted and disturbed by them to increase the circular error of the position.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2404
  • Country: nz
Re: A GPS-referenced 1MHz square wave.
« Reply #4 on: September 25, 2018, 11:33:05 pm »
Quote
To amusing myself as there was nothing good to watch on TV.

hehe, I was wondering if you had found the correcting algorithm's trick used by military forces to have a better precision on the GPS  :D

We poor people have the GPS voluntary-corrupted and disturbed by them to increase the circular error of the position.
Most civilian GPS errors are due to uncertainty in ionospheric and atmospheric conditions... the whole "consumer modules with 3cm survey resolution!" hyperbole is with external aiding (e.g. a second GPS receiver at a known fixed location, and sharing error information) and/or retrospective corrections to the satellite orbits and ionosphere conditions. At least for the USA's GPS system - I assume that these errors also apply to other GNSS.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3399
  • Country: lv
Re: A GPS-referenced 1MHz square wave.
« Reply #5 on: September 25, 2018, 11:34:18 pm »
To amusing myself as there was nothing good to watch on TV.

But I now have access to a better 1 MHz clock than I did before, if I ever need it for some reason.

Nice way to have fun :) Unfortunately you can't make good reference clock using discrete NCO. Don't even bother to increase clock frequency because even 2.5ns jitter shall be considered as gigantic. Better consider adding 10bit or ideally 12bit 100MHz DAC and make cordic-based DDS core to generate low jitter pure sine. Idea is more or less to make something like "Arduino Controlled GPS Referenced DDS VFO by Gene Marcus W3PM GM4YRE", using FPGA + DAC, not Arduino + AD9850.
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 2310
  • Country: dk
Re: A GPS-referenced 1MHz square wave.
« Reply #6 on: September 25, 2018, 11:44:30 pm »
Quote
To amusing myself as there was nothing good to watch on TV.

hehe, I was wondering if you had found the correcting algorithm's trick used by military forces to have a better precision on the GPS  :D

We poor people have the GPS voluntary-corrupted and disturbed by them to increase the circular error of the position.

Selective availability was turned off in 2000, there is no error added

 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2404
  • Country: nz
Re: A GPS-referenced 1MHz square wave.
« Reply #7 on: September 26, 2018, 12:09:58 am »
To amusing myself as there was nothing good to watch on TV.

But I now have access to a better 1 MHz clock than I did before, if I ever need it for some reason.

Nice way to have fun :) Unfortunately you can't make good reference clock using discrete NCO. Don't even bother to increase clock frequency because even 2.5ns jitter shall be considered as gigantic. Better consider adding 10bit or ideally 12bit 100MHz DAC and make cordic-based DDS core to generate low jitter pure sine. Idea is more or less to make something like "Arduino Controlled GPS Referenced DDS VFO by Gene Marcus W3PM GM4YRE", using FPGA + DAC, not Arduino + AD9850.

If only I had a nice medium speed DAC - most of the DACs I have to hand are 1MS/s or I2S audio... I wonder how good the R2R video DAC would be, if followed up with a crystal filter - must have a 1MHz crystal in something in the junk bin.

Anyhow given that the GPS PPS itself has at least 10ns jitter, it then starts launching me down a long chain of looking carefully at loop filters, errors, and other uncertainties.

At the moment I am just happy to have (very close to) 1M pulses per second, referenced to things wizzing around in space... If anybody is in Christchurch NZ, and has any calibrated test gear that could be used to look at the output it might be a bit of a laugh to see how bad it is, and assess any improvements small changes could make - there are plenty of possibilities, but I have no way to perform objective measurements.
« Last Edit: September 26, 2018, 12:23:48 am by hamster_nz »
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline PCB.Wiz

  • Frequent Contributor
  • **
  • Posts: 433
  • Country: au
Re: A GPS-referenced 1MHz square wave.
« Reply #8 on: September 26, 2018, 12:18:55 am »
To amusing myself as there was nothing good to watch on TV.

But I now have access to a better 1 MHz clock than I did before, if I ever need it for some reason.

Nice way to have fun :) Unfortunately you can't make good reference clock using discrete NCO. Don't even bother to increase clock frequency because even 2.5ns jitter shall be considered as gigantic. Better consider adding 10bit or ideally 12bit 100MHz DAC and make cordic-based DDS core to generate low jitter pure sine.

or, you could use a VCTCXO, and a MCU with a good DAC (EFM8BB3? etc) , and get into the Analog Domain that way.
That avoids the discrete correction step size of a NCO, and avoids needing a 12b 100MHz DAC  :)
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3399
  • Country: lv
Re: A GPS-referenced 1MHz square wave.
« Reply #9 on: September 26, 2018, 12:30:39 am »
If only I had a nice medium speed DAC - most of the DACs I have to hand are 1MS/s or I2S audio...

Try R2R ladder self-made DAC first. IMHO 5 or even 4 bit DAC with 5th (or 7th) order LC filter having cutoff frequency slightly above target 1MHz could actually work as DDS playground.

Quote
Given that the GPS PPS itself has at least 10ns jitter, it then starts launching me down a long chain of looking carefully at loop filters, errors, and other uncertainties.

Threre's huge difference between 10ns @ 1Hz compared to 2.5ns @ 1MHz clock period.

Quote
At the moment I am just happy to have ~1M pps, referenced to things wizzing around in space...

You shall be not only happy, but proud as well.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 2260
  • Country: ca
Re: A GPS-referenced 1MHz square wave.
« Reply #10 on: September 26, 2018, 01:35:47 am »
You certainly can do much better than 10 ns resolution NCO with FPGA. Sub-ns jitter is definitely feasible. Using MMCM or ODELAY for fine control (either can achieve programmable delays around 50 ps resolution) and controlling temperature (e.g. by heating the FPGA on demand by turning on and off massive logic blocks and using the built-in temperature sensor), you probably can create an NCO with as low as 100 ps real resolution, may be even better.

Of course, you GPS reference will have more jitter than this :(

 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 12424
  • Country: us
  • DavidH
Re: A GPS-referenced 1MHz square wave.
« Reply #11 on: September 26, 2018, 02:22:48 am »
I wonder how good the R2R video DAC would be, if followed up with a crystal filter - must have a 1MHz crystal in something in the junk bin.

Filtering is tricky because it is easy to add more phase error than the GPSDO is capable of.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3399
  • Country: lv
Re: A GPS-referenced 1MHz square wave.
« Reply #12 on: September 26, 2018, 08:35:09 am »
You certainly can do much better than 10 ns resolution NCO with FPGA.

Sure! Apart from mentioned DDS, there are more options like 1) FPGA built-in PLL which gives sub-ns jitter or better 2) pure VCO which means exactly that: crystal oscillator tuned by voltage usually coming from hi-res PWM or PCM.
 

Offline imo

  • Super Contributor
  • ***
  • Posts: 2742
  • Country: li
Re: A GPS-referenced 1MHz square wave.
« Reply #13 on: September 26, 2018, 12:02:36 pm »
Quote
Try R2R ladder self-made DAC first.
@hamster: Icom-718 is using DDS made of a passive R2R ladder, it should work for you as well :)
PS: all recent cheapo ublox gps modules can produce 0.25Hz-12MHz square off the 1PPS pin (with some issues we've discussed few times already)..
« Last Edit: September 26, 2018, 12:08:08 pm by imo »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf