Real-Time-Clock synchronization using the internal GNSS time signal

This page provides an example on how to configure the Real-Time-Clock (RTC) to synchronize using the time provided by the internal GNSS.

The internal GNSS broadcasts a range of output messages on the internal CAN-bus, with GnssTime signals containing UTC time. The RTC can be configured to time synchronize using messages on any CAN-bus (including the internal CAN-bus).


CAN-Internal configuration

To be able to use the GnssTime signals for synchronization, the device must be configured to accept the message. In addition, it is recommended to reduce the frequency of the message to avoid high frequency time synchronization. Below example configures a CAN-Internal receive filter to accept the GnssTime message (ID 0x66) and scale the output to 60 s (60.000 ms):

{
  "name": "GnssTime",
  "state": 1,
  "type": 0,
  "id_format": 0,
  "method": 0,
  "f1": "66",
  "f2": "66",
  "prescaler_type": 2,
  "prescaler_value": 60000
}

RTC synchronization configuration

To use the GnssTime signals for synchronization, the RTC should be configured as listed below:

  • Synchronization method: CAN-bus

  • Synchronization bus: CAN-Internal

  • Synchronization message ID: 0x66

  • Synchronization time valid signal and time value signal interpretations set in accordance with the GnssTime signals specifications

For more information on how to enter signal interpretations, see Section Signal.

Below shows an example of above configuration, using a synchronization tolerance of 30 s. The time valid signal is set to GnssTime->TimeConfirmed and the time value signal is set to GnssTime->Epoch:

{
  "rtc":
  {
    "sync": 3,
    "timezone": 0,
    "adjustment": 0,
    "tolerance": 30,
    "message":
    {
      "chn": 0,
      "id_format": 0,
      "id": "66",
      "id_mask": "7FF"
    },
    "valid_signal":
    {
      "type": 0,
      "byteorder": 1,
      "bitpos": 1,
      "length": 1,
      "factor": 1,
      "offset": 0
    },
    "time_signal":
    {
      "type": 0,
      "byteorder": 1,
      "bitpos": 8,
      "length": 40,
      "factor": 0.001,
      "offset": 1577840400
    }
  }
}

Verification

The RTC synchronization can be verified using the CAN-Internal TimeExternal signals. The expected behavior (assuming above configuration), is to receive one TimeExternal synchronization message each ~60 s, containing a valid external time (obtained from the internal GNSS).

Below shows the first 5 observations of the signals contained in TimeExternal after boot and GNSS fix. It shows that the difference between the external time and the internal time is in this case approximately 5 seconds (below the tolerance, activating continuous time tracking).

Timestamps

InternalEpoch

ExternalEpoch

0.0

1703155057.0

1703155052.0

60.1

1703155118.0

1703155112.0

120.2

1703155178.0

1703155172.0

180.5

1703155238.0

1703155232.0

240.7

1703155298.0

1703155292.0