Synchronize Linux Real Time Targets with Network Time Protocol (NTP) Server

Updated Jul 4, 2018

Reported In

Hardware

  • CompactRIO Controller

Driver

  • NI CompactRIO

Operating System

  • NI Linux Real-Time

Issue Details

I have a Linux Real Time Device (e.g. Compact RIO) and I am experiencing time drift. I want to synchronize its clock with the Network Time Protocol Server. How should I proceed?

Solution

Before getting started, you need to enable the Secure Shell (sshd) server. Using a software to access your device in SSH (e.g. Putty), input the following command lines to install and configure NTP Server:

opkg update
opkg install ntp ntp-tickadj
opkg install ntp ntp-tickadj ntp-utils

The NTP server should be installed and running in the background. Now you need to setup the configuration file to the NTP server of your choice. In this example, I will be using the time.nist.gov server.
To modify the NTP Config file, run the following command

vi /etc/ntp.conf

The file should look like this:



Save the configuration file and reboot the Linux Real Time target. Your target clock and time should now be synchronized to the server you specified in the configuration file.

Additional Information

  • This solution should work on Linux Real Time Targets with Real Time module 14.0 or newer.
  • For this solution to work on Real Time module 13.1 and older, you need to configure third party installation sources as mentionned in this NI forum post.

WAS THIS ARTICLE HELPFUL?

Not Helpful