A GPS-referenced 1MHz square wave. - Page 1
Forum section: electronics / general

author: hamster_nz
author_rank: Super Contributor
timestamp: September 25, 2018, 10:34:19 pm
content: 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 seen3. 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

author: legacy
author_rank: Super Contributor
timestamp: September 25, 2018, 10:39:25 pm
content: I am lost. What is the purpose?

author: hamster_nz
author_rank: Super Contributor
timestamp: September 25, 2018, 10:47:49 pm
content: Quote from: legacy on September 25, 2018, 10:39:25 pmTo 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?

author: legacy
author_rank: Super Contributor
timestamp: September 25, 2018, 11:16:19 pm
content: Quotehehe, I was wondering if you had found the correcting algorithm's trick used by military forces to have a better precision on the GPSWe poor people have the GPS voluntary-corrupted and disturbed by them to increase the circular error of the position.

author: hamster_nz
author_rank: Super Contributor
timestamp: September 25, 2018, 11:33:05 pm
content: Quote from: legacy on September 25, 2018, 11:16:19 pmMost 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.

author: ogden
author_rank: Super Contributor
timestamp: September 25, 2018, 11:34:18 pm
content: Quote from: hamster_nz on September 25, 2018, 10:47:49 pmNice way to have funUnfortunately 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.

author: langwadt
author_rank: Super Contributor
timestamp: September 25, 2018, 11:44:30 pm
content: Quote from: legacy on September 25, 2018, 11:16:19 pmSelective availability was turned off in 2000, there is no error added

author: hamster_nz
author_rank: Super Contributor
timestamp: September 26, 2018, 12:09:58 am
content: Quote from: ogden on September 25, 2018, 11:34:18 pmIf 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.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 26, 2018, 12:18:55 am
content: Quote from: ogden on September 25, 2018, 11:34:18 pmor, 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

author: ogden
author_rank: Super Contributor
timestamp: September 26, 2018, 12:30:39 am
content: Quote from: hamster_nz on September 26, 2018, 12:09:58 amTry R2R ladder self-made DAC first. IMHO 5 or even 4 bit DAC with 5th (or 7th) orderLC filterhaving cutoff frequency slightly above target 1MHz could actually work as DDS playground.QuoteThrere's huge difference between 10ns @ 1Hz compared to 2.5ns @ 1MHz clock period.QuoteYou shall be not only happy, but proud as well.

author: NorthGuy
author_rank: Super Contributor
timestamp: September 26, 2018, 01:35:47 am
content: 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

author: David Hess
author_rank: Super Contributor
timestamp: September 26, 2018, 02:22:48 am
content: Quote from: hamster_nz on September 26, 2018, 12:09:58 amFiltering is tricky because it is easy to add more phase error than the GPSDO is capable of.

author: ogden
author_rank: Super Contributor
timestamp: September 26, 2018, 08:35:09 am
content: Quote from: NorthGuy on September 26, 2018, 01:35:47 amSure! 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.

author: iMo
author_rank: Super Contributor
timestamp: September 26, 2018, 12:02:36 pm
content: Quote@hamster: Icom-718 is using DDS made of a passive R2R ladder, it should work for you as wellPS: 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)..