Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


ntp_calibration

This is an old revision of the document!


NTP Calibration

To use it with the current implementation, you must have a PPS source and you must configure the ATOM driver for that PPS source (as opposed to using, for example NMEA's PPS support), then ntpd will automatically determine the fudge time1 value for the remaining refclock(s).

You can ensure the clock(s) you want to calibrate aren't used by adding noselect to their server lines. You can montior fudge time1 using ntpq's cv ASSOCID/cv &X (X is 1-based index of refclock in billboard/as output, ASSOCID would be from ntpq -c as). Once it's settled configure the fudge time1 for each in ntp.conf, remove the “enable calibrate” and any “noselect”s added for calibration, and if needed revert to your original PPS configuration. Upon restart, all the refclocks should now agree with the PPS.

Note you can calibrate by hand by marking a refclock noselect, ensuring its fudge time1 is 0, enabling peerstats or clockstats, then start ntpd and let it run long enough to settle down. Grab the peer offset for the clock from peerstats/clockstats (possibly averaging over a number of samples after the system had settled), then configure fudge time1 to the negation of the offset (or offset average).

Example

  • Enable calibration, prefer the ATOM PPS source and configure noselect for source to be calibrated. Edit /etc/ntp.conf
    enable calibrate
    server ntp1.polaire.nl iburst
    
    # PPS
    server 127.127.22.0 minpoll 4 maxpoll 4 true prefer
    fudge  127.127.22.0 refid PPS
    
    # GPS 
    server 127.127.28.0 minpoll 4 maxpoll 4 noselect
    fudge 127.127.28.0 refid GPSd
  • Determine ID.
    # ntpq -c as
    ind assid status  conf reach auth condition  last_event cnt
    ===========================================================
      1 15770  963a   yes   yes  none  sys.peer    sys_peer  3
      2 15771  9424   yes   yes  none candidate   reachable  2
      3 15772  9424   yes   yes  none candidate   reachable  2
      4 15773  9024   yes   yes  none    reject   reachable  2
      5 15774  9024   yes   yes  none    reject   reachable  2
  • Monitor fudgetime1.
    ntpq> cv 15774
    associd=15774 status=0000 , no events, clk_unspec,
    device="SHM/Shared memory interface", timecode=, poll=1012, noreply=0,
    badformat=0, baddata=0, fudgetime1=0.000, stratum=0, refid=GPSd, flags=0
ntp_calibration.1403270546.txt.gz · Last modified: 2014/06/20 13:22 by admin