Radarcape:NTP

From Beast Wiki
Revision as of 13:34, 5 August 2017 by imported>Nunojpg
Jump to navigation Jump to search
For Experts Required Linux/Unix skills to execute this task: Advanced

NTP client or server on Debian

NTP client

Debian uses systemd NTP client by default. To check the state you can type: systemctl status systemd-timesyncd.

NTP stratum 1 server

Instructions and files to set Radarcape as a NTP stratum 1 server (PPS reference from GPS) is available at:

https://github.com/Jetvision/radarcape-ntp-pps

If you have before compiled and installed manually NTPD or Chrony it is recommended that you remove it before.

NTP client or server on Angstrom (deprecated)

Configuring Angstrom as a NTP server is not recommend and not supported, as Debian provides much better compatibility and performance.

Radarcape and Local Time Synchronisation via NTP

In order to have correct time on Angstrom based Radarcapes, due to a hardware probelm in our cape board, a special kernel is required.

The Radarcape's hardware design will support true NTP using the GPS. Both, the Trimble serial data stream as well as the 1PPS, are available on the Beaglebone. However due to time constraints using those in order to create a Stratum 1 NTP server was not yet implemented.

Important Note: Timestamping of the Mode-AC/Mode-S raw data frames is _not_ done using the system time which is described here. All received frames are directly time stamped in the FPGA without any interaction of the local CPU. However, the __date__ in Port 30003 messages is always the Linux system date. The __timestamp__ instead is a GPS timestamp when the config is set to GPS timestamps and system time when the Radarcape operates in legacy 12MHz timstamp mode.

Meanwhile, all Radarcapes should synchronize their date and time via connmand and its NTP service. This is for example essential for the port 30003 protocol. So here is a list of checks in case that your Radarcape's date and time are not correct. Experience with this will tell us later which steps may be necessary in case that NTP does not work.

Basic System Checks

Check your Linux kernel version, connmand version and date/time.

root@rc12:~# uname -a
Linux rc12 3.8.13 #1 SMP Tue Jul 30 11:56:13 CEST 2013 armv7l GNU/Linux
root@rc12:~# connmand -v
1.4
root@rc12:~# date
Sat Nov  9 14:01:08 UTC 2013

connmand settings are in /var/lib/connman/settings. I added the PTB servers into this, as then we have a reliable 2nd server farm for NTP. You may do so, too.

root@rc12:~# cd /var/lib/connman
root@rc12:/var/lib/connman# cat settings
[global]
Timeservers=ptbtime1.ptb.de;ptbtime2.ptb.de;ptbtime3.ptb.de;0.angstrom.pool.ntp.org;1.angstrom.pool.ntp.org;2.angstrom.pool.ntp.org;3.angstrom.pool.ntp.org
OfflineMode=false

[Wired]
Enable=true

[WiFi]
Enable=true

Startup check: NTP is started once the network is up. journalctl can tell you what happend. Below you can see the first setting immediately after startup, and another synchronisation with 85sec offset later. If your Radarcape was running for longer, you will see a resynchronisation message about once each hour.

root@rc12:/var/lib/connman# journalctl --no-pager | grep -i ntp
Jan 10 06:54:20 rc12 connmand[122]: connmand[122]: ntp: time slew +436516610.758686 s
Jan 10 06:54:20 rc12 connmand[122]: ntp: time slew +436516610.758686 s
Nov 09 13:49:41 rc12 connmand[122]: connmand[122]: ntp: time slew +85.321813 s
Nov 09 13:48:15 rc12 connmand[122]: ntp: time slew +85.321813 s

Note: On a few devices I saw that after some days the time sync via NTP is suddenly lost. NTP update messages disappear in journalctl.

Links

http://stackoverflow.com/questions/11219832/what-is-the-best-way-to-run-ntpdate-at-reboot-only-after-network-is-ready