SparkFun RTK Reference Station Hookup Guide

Pages
Contributors: PaulZC
Favorited Favorite 3

NTP

Network Time Protocol has been around since 1985. It is a simple way for computers to synchronize their clocks with each other, allowing the network latency (delay) to be subtracted:

  • A client sends a NTP request (packet) to the chosen or designated server
    • The request contains the client's current clock time - for identification
  • The server logs the time the client's request arrived and then sends a reply containing:
    • The client's clock time - for identification
    • The server's clock time - when the request arrived at the server
    • The server's clock time - when the reply is sent
    • The time the server's clock was last synchronized - providing the age of the synchronization
  • The client logs the time the reply is received - using its own clock

When the client receives the reply, it can deduce the total round-trip delay which is the sum of:

  • How long the request took to reach the server
  • How long the server took to construct the reply
  • How long the reply took to reach the client

This exchange is repeated typically five times, before the client synchronizes its clock to the server's clock, subtracting the latency (delay) introduced by the network.

Having your own NTP server on your network allows tighter clock synchronization as the network latency is minimized.

The Reference Station can be placed into its dedicated NTP mode, by pressing the MODE button until NTP is highlighted in the display and pausing there.

Animation of selecting NTP mode
Selecting NTP mode

The Reference Station will first synchronize its Real Time Clock (RTC) using the very accurate time provided by the u-blox GNSS module. The module's Time Pulse (Pulse-Per-Second) signal is connect to the ESP32 as an interrupt. The ESP32's RTC is synchronized to Universal Time Coordinate (UTC) on the rising edge of the TP signal using the time contained in the UBX-TIM-TP message.

The WIZnet W5500 interrupt signal is also connected to the ESP32, allowing the ESP32 to accurately log when each NTP request arrives.

The Reference Station will respond to each NTP request within a few 10's of milliseconds.

If desired, you can log all NTP requests to a file on the microSD card, and/or print them as diagnostic messages. The log and messages contain the NTP timing information and the IP Address and port of the Client.

The system debug menu showing how to enable the NTP diagnostics
System Debug Menu - NTP Diagnostics (Click for a closer look)

The logging menu showing how to log the NTP requests
Logging Menu - Log NTP Requests

NTP requests log
Logged NTP Requests

We have been using Meinberg NTP to synchronize Windows PCs to the Reference Station - please see the Product Manual for more details.

NTP uses its own epoch - midnight January 1st 1900. This is different to the standard Unix epoch - midnight January 1st 1970 - and the GPS epoch - midnight January 6th 1980. The times shown in the log and diagnostic messages use the NTP epoch. You can use online calculators to convert between the different epochs: