[time-nuts] Question for my new GPSDO

Tobias Pluess tobias.pluess at xwmail.ch
Wed Oct 23 10:22:55 UTC 2019


Hi colleagues

thanks to your inputs I could design the EFC circuit for my new GPSDO and I think its quite clear how that will work.
So in the past days, I spent my spare time on thinking about the control algorithm. I used FLL previously, which gave unsatisfactory results, so I think PLL is the way to go.
Since I will use an STM32F407VG microcontroller, I have plenty of times for this job, and I had the following idea.

Assume a timer is clocked with the 10MHz clock. The timer overflows when it reaches 9999999 (=10e6-1). Further, this timer is used to generate the 1PPS pulse output: each time when the timer reaches the value of 0, a pulse is generated on one of the output pins. Since this happens all in hardware, this should be fine and shouldn't have jitter introduced (e.g. by interrupts or whatever).
Further, the *same* timer is used also for input capture: each time when the GPS module outputs a 1PPS pulse, the timer value is copied to some shadow register, while the timer continues to run.
So what we have now is a very basic TIC which measures the time interval between the GPS 1PPS and the 1PPS derived from the OCXO!
If the OCXO is slow, the timer will not count up to 10e6 during one second, i.e. the captured timer value will be a large number, say 9999000 for instance. On the other hand, if the OCXO is fast, during one second, the timer will overflow and when the 1PPS pulse from the GPS arrives, the captured timer value will be some low number, for instance 1000. So this very basic capture function allows to detect the phase between the two 1PPS signals, with a basic resolution of 100ns.
Knowing the phase difference, we can now implement a basic PLL which tries to push this phase difference to zero. And now comes the cool stuff: as soon as the time interval is low enough, I can enable a TDC7200 which then gives a higher resolution measurement as the phase difference becomes smaller and smaller!

OK I read about this GPSDO simulator which was written by TvB (http://www.leapsecond.com/pages/gpsdo-sim/). I looked at the sourcecode and tried to make my own simulation tool using Matlab since I have no data files available to feed into TvB's program. My Matlab code is attached.
Basically, it simulates an oscillator with 10MHz nominal frequency, and a 1PPS pulse which can have an adjustable jitter (e.g. +/-50 ns) which can have a Gaussian distribution or a uniform distribution.
The code then implements a simple PLL which is based on the approach I outlined above. The PLL locks using a PID controller, similar to the GPSDO simulator. I made two observations:
a) the PLL does never lock but oscillates as long as the proportional gain is 0.
b) when the PLL locks and the oscillator frequency is at 10.000000 MHz, the frequency is somewhat unstable because of the proportional term which feeds the 1PPS jitter more or less directly to the DAC. The frequency fluctuations I could observe are up to 20 mHz, which is a terrible performance.

I think issue a) could be addressed if I made a proper model of the whole thing, taking the z-transfer functions of the individual blocks into account. This would perhaps show what properties of the controller are important. I am familiar with digital filters and their transfer functions and such, but I have never dealt with a digital PLL so I don't know yet how I should model the whole thing. (e.g. how would a digital model of the OCXO look like? no idea.)
Further, I am sure there is a solution to issue b), but I don't know what that solution is. Or maybe issue b) doesn't really exist but is related to my code being wrong?
any hints on that?

I have also attached a screenprint of the charts produced with my simulation tool. One can see the time between two 1PPS pulses. The time interval between the GPS 1PPS and the OCXO-derived 1PPS is also plotted and one can see how the PLL locks nicely after about 45 hours runtime (which is extremely slow, but having a faster PLL gave me worse noise performance). The EFC voltage and OCXO frequency are also plotted and if one zooms in one can see that the frequency is indeed not very stable (and this is related to the proportional term of the PI controller).

best
Tobias
HB9FSX

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpsim.m
Type: text/x-objcsrc
Size: 3091 bytes
Desc: gpsim.m
URL: <http://febo.com/pipermail/time-nuts_lists.febo.com/attachments/20191023/00977225/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpsim.png
Type: image/png
Size: 74663 bytes
Desc: gpsim.png
URL: <http://febo.com/pipermail/time-nuts_lists.febo.com/attachments/20191023/00977225/attachment.png>


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