<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Rick,</p>
    <p>I noticed that, except from the NTS part, our setups look similar
      (Pi 3B+, Buster, NTPsec 1.1.8, u-Blox MAX-M8Q GNSS, you probably
      use GPSd 3.20?).</p>
    <p>I also noticed that you don't have quite as good precision and
      jitter as I do (but close), and that you seem to use multiple GNSS
      systems. I offer below many elements that helped me get my Pi to
      it's best, use what you need. I very recently went through all my
      notes and validated them to the current ways as there is a lot of
      obsolete stuff out there. This is from my refreshed notes for
      Buster.<br>
    </p>
    <p>Extract from my ntp.conf:</p>
    <pre># kernel PPS
refclock pps unit 0     refid kPPS flag2 0 flag3 0 minpoll 4 prefer     # Best is minpoll 4!

# GPS PPS reference - PPS shm from GPSd - the serial shm is redundant as the PPS shm has all the info
refclock shm unit 1     refid gPPS minpoll 4    # Best is minpoll 4!

# *** NOTE: by default, the ARP cache flushes after 60 seconds. If so, use maxpoll 5 ***
# *** I modified the ARP flush on rPi to 65sec, so maxpoll 6  (64s) works ***
# sudo cat /etc/sysctl.d/ntp_arp.conf < net.ipv4.neigh.default.gc_stale_time = 65

# Take note: using iburst will make the ntpd first lock to the pool, instead of the PPS.

# LAN servers: <example>
server 192.168.10.11    minpoll 4 maxpoll 6             # !!! On LAN !!! # For ARP reasons, set maxpoll 6 -> 64s

# I use official government NTP servers to validate the quality of the pool
# Less an issue with a reliable GNSS timesource, but helps if you have an antenna problem and GNSS becomes unsynchronized
# Official Canadian gov NTP servers (Stratum 2)
server time.nrc.ca      maxpoll 6       # For ARP reasons, set maxpoll 6 -> 64s
server time.chu.nrc.ca  maxpoll 6       # For ARP reasons, set maxpoll 6 -> 64s

# Pool: use a geographically near pool - I set maxpoll to 10, but it is usually set to 6 by NTPsec
pool <local pool>.pool.ntp.org    maxpoll 10
</pre>
    <p>Also, if not already done, you should configure the Max-M8Q for
      time service. GPSd settings are too general purpose: <br>
    </p>
    <ul>
      <li>UBX-CFG-PRT set baudrate to 115200 but GPSd will need to be
        told about it in it's startup script, ubxtool can set the uBlox
        GNSS,<br>
      </li>
      <li>UBX-CFG-PRT set protocol out to 0-UBX, ubxtool can set the
        uBlox GNSS,<br>
      </li>
      <li>UBX-CFG-GNSS enable only ONE GNSS system (GPS or Galileo or
        GLONASS or BeiDou), <br>
      </li>
      <li>UBX-CFG-SBAS select the SBAS system covering your zone else
        disable, disable all SBAS features except integrity (activate
        it), <br>
      </li>
      <li>UBX-CFG-PMS set power to 0-Full power or</li>
      <li>UBX-CFG-RXM set power to 0-Continous mode<br>
      </li>
      <li>UBX-CFG-NAV5 set dynamic model to 2-Stationary, Fix mode to
        1-2D,</li>
      <li>UBX-CFG-TMODE2 set Time mode to 2-Fixed mode, enter surveyed
        (fairly accurate) coordinates, <br>
      </li>
      <li>UBX-CFG-TP5 set antenna cable delay (from cable length and
        velocity, google it)<br>
      </li>
      <li>Last, UBX-CFG-CFG Save configuration to nvram<br>
      </li>
    </ul>
    <p>That should optimize your Max-M8Q for stationary time service.
      Sorry, I'm too lazy to write some script using ubxtool to do it,
      so I use uBlox's u-Center on Windows, save, and disconnect the RxD
      line of the M8Q to prevent GPSd from re-configuring it. I think
      there is a GPSd toggle (for "Broken" receivers, -u?) that prevents
      GPSd from writing to the GPS, but my home-made interface card has
      a jumper I remove.<br>
    </p>
    <p>Also, check if you need to disable the systemd time setting
      service:</p>
    <pre># <a class="moz-txt-link-freetext" href="https://www.freedesktop.org/software/systemd/man/systemd-timesyncd.service.html">https://www.freedesktop.org/software/systemd/man/systemd-timesyncd.service.html</a>
sudo timedatectl set-ntp false
</pre>
    <p>From your graphs, it looks like it's OK, but it is an SNTP time
      setting service that competes with NTPd and messes with precision.
      It shows up as a few time jumps per hour on ntpviz graphs.<br>
    </p>
    <p>If you want my scripts/notes/miscellaneous files, just ask. I'm
      open to corrections too, as I said, there is plenty of outdated
      information out there and I want to get rid of mine. <br>
    </p>
    <p>Have a nice day!<br>
      Martin<br>
    </p>
  </body>
</html>