[ntp:questions] gps outlier

Brian Inglis Brian.Inglis at SystematicSw.ab.ca
Mon Nov 21 21:19:58 UTC 2016

On 2016-11-21 12:04, folkert wrote:
> I have 5 rpis with 3 adafruit gpses, some glonas and a venus gps;
> they all agree with each other about when a second starts.
> Now I added a garmin 18x lvc (via a level shifter) and even after an
> hour it shows an offset of around -0.114ms upto -0.123ms (it jumps),
> jitter of 12us.
> What can be the cause of this strange offset? The jitter I can
> understand as I use the userspace tool for interfacing it to ntp.

Excuse me if I'm teaching granny about egg-sucking - ignore those parts.

With ntp 4.2.6p5 (Debian stable) and only the NMEA driver, you should
specify fudge time2 about 0.5, flag1 1, and flag3 1 if kernel pps is
With pps, using the leading edge, you should not need to tune time2,
but it is obvious you do when the offset in ms ~ time2 value.
If you are using time2, try reducing it 100ms, restart and run until
clk_jitter and clk_wander are minimized and frequency stabilizes
within ppb.
My clk_jitter with 18x on W10 is single digit us, and clk_wander
stays 0.000; the same with Adafruit on RPi2; use ntpq -c cv to get
these, and watch poll vs badformat: I get a bit over 1% badformat
with Adafruit on RPi2; only 1 initial noreply with 18x on W10 - YMMV.

If you are running on an RPi3, remember you have to jump thru some
more hoops to disable BT and get the UART setup back to normal: see
the forums, Google, etc. for bad and good advice on that.

I set up the Garmin 18x to run 9600 bps, with minimum pps length (20ms?),
and output only the $GPRMC sentence, NMEA mode 17 in /etc/ntp.conf:
neither the Garmin nor RPi are fast so no need to stress them.

What kind of level shifter: some are inverters - bad; others are
buffers - good?
If you're using 5V USB power, you're pretty safe as it should be stable.
To just drop the voltage, you can use any 3 same value R24 5% series
resistors, say 2.2k range to give a 5-7k load, or to be conservative and
drop a bit more voltage, use one 2k and one 3k or a bit more in either
case, wired as follows on each pin, or an equivalent chip:
            _____ sig             _____ sig
           |                     |
gpio _____{ 2.2k      gpio _____{ 2k
           { 2.2k                |
           { 2.2k                { 3k
  gnd _____|_____ gnd   gnd _____|_____ gnd

Numbering the pins from the corner mounting hole, with even pins going
down the outside right edge of the connector, pins 6 or 14 are Gnd,
pin 8 is gpio14 TxD, pin 10 gpio15 RxD, and pin 12 gpio18 CD/PPS,
are the standard connections.

With these or similar, you can enable the Linux kernel pps-gpio module,
install pps-tools, and run ppstest as a check.
You can also install and run gpsd manually just for checks - disable it
with update-rc.d or systemd.

Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

More information about the questions mailing list