Puzzling clock offset spikes

Paul Theodoropoulos paul at anastrophe.com
Thu Jul 5 01:37:46 UTC 2018

On 6/29/2018 18:27 PM, Paul Theodoropoulos wrote:
> Raspberry Pi 3B+, Adafruit GPS hat., Raspbian Stretch, ntpsec 1.1.1, 
> gpsd 3.18~dev.
> Everything runs quite lovely, notwithstanding temperature variations, 
> which I'm working on smoothing out.
> *Except* that at regular intervals, there is a spike in clock offset, 
> followed a smaller interval by another spike in offset. My early 
> timings a couple of ago showed eleven minutes between events, and 90 
> seconds between first and second spike - however that has changed to 
> approximately every nine minutes, followed approximately 74 seconds 
> later by the second spike. I believe that shift may be thermally 
> related, as ambient temps have been gradually rising the last few 
> days, and overall offset follows.

An update: I've poked and prodded relentlessly, and while this actually 
appears worse, it does give a clue to where the problem lies, as it 
happened after making the change detailed below. Compare the chart from 
25 June to the chart now, 05 July:

Old chart, 25 June:

New chart, 05 July:

What changed: I'd poked around with assorted parameters of the "dwc" 
module, which apparently drives the USB subsystem. It got to where I'd 
added all of these dwc module options to the /boot/cmdline.txt:

dwc_otg.fiq_fsm_enable=1  dwc_otg.fiq_fix_enable=1 
dwc_otg.nak_holdoff_enable=1 dwc_otg.nak_holdoff=2 dwc_otg.lpm_enable=0

None of the above (added relatively incrementally) made the slightest 
difference to the repeating glitches in frequency offset. So I went the 
other direction:

dwc_otg.fiq_fsm_enable=0 dwc_otg.fiq_enable=0 dwc_otg.nak_holdoff=2 

So turning the dwc 'fiq' parameters *off*, made the repetitive glitches 
much more frequent - but the overall 'error' is much narrower: instead 
of a glitch every 9-11 minutes of about 0.12 ppm, I now have glitches 
that happen a bit more than a minute apart, but the amount of offset is 
only about 0.025 ppm.

More to test, but this certainly gives a pretty clear picture of _where_ 
the problem is occurring, but I don't know if it can be entirely 
eliminated. But it's better than the relentless flailing around, hitting 
a brick wall at every turn.

Tangentially related, only in that it's one of the many dozens of 
avenues I've contemplated - would switching to a Debian/Raspbian 
realtime kernel make accuracy/precision possibly better overall....or worse?

Paul Theodoropoulos

More information about the users mailing list