3

I have two arm-based Linux (ubuntu 14.04) computers, a Jetson TK1 and TX1 that will fly on a multicopter and hence have no internet connection (they are networked together onboard). They also do not have RTC's built-in but I have added an external one to the Jetston TK1. The TK1's time gets set on boot from this RTC no problem (using a sudo hwclock -s -f /dev/rtc0 in rc.local). I am trying to get the TX1 to sync to the TK1's time using ntp.

The TK1's ntp.conf file contains:

driftfile /var/lib/ntp/ntp.drift

server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org

tos orphan 5

The TX'1s ntp.conf file contains:

driftfile /var/lib/ntp/ntp.drift

# Specify one or more NTP servers.

server 10.20.3.149 iburst prefer

server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

where 10.20.3.149 is the IP address of the TK-1. If I run ntpq -p I get ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 192.168.0.10    .INIT.          16 -    -  512    0    0.000    0.000   0.000
 192.168.3.149   .INIT.          16 -    -  512    0    0.000    0.000   0.000

and if I run ntpdate -dv 10.20.3.149 I get

12 Aug 12:36:23 ntpdate[2197]: ntpdate 4.2.6p5@1.2349-o Thu Feb 11 18:30:14 UTC 2016 (1)
Looking for host 10.20.3.149 and service ntp
host found : TK-Astro
transmit(10.20.3.149)
receive(10.20.3.149)
transmit(10.20.3.149)
receive(10.20.3.149)
transmit(10.20.3.149)
receive(10.20.3.149)
transmit(10.20.3.149)
receive(10.20.3.149)
10.20.3.149: Server dropped: Server has gone too long without sync
server 10.20.3.149, port 123
stratum 5, precision -22, leap 00, trust 000
refid [10.20.3.149], delay 0.02838, dispersion 0.00037
transmitted 4, in filter 4
reference time:    00000000.00000000  Sun, Dec 31 1899 19:00:00.000
originate timestamp: db58798a.31270a17  Fri, Aug 12 2016 12:36:26.192
transmit timestamp:  db58798e.185b391c  Fri, Aug 12 2016 12:36:30.095
filter delay:  0.02843  0.02838  0.02869  0.02863 
         0.00000  0.00000  0.00000  0.00000 
filter offset: -3.90380 -3.90424 -3.90470 -3.90468
         0.000000 0.000000 0.000000 0.000000
delay 0.02838, dispersion 0.00037
offset -3.904242

12 Aug 12:36:30 ntpdate[2197]: no server suitable for synchronization found

I see the reference time is way off (even though the system time is correct) - is that what's triggering the message Server has gone too long without a sync? I don't care if the time isn't 100% exactly right as long as the two boards are synced together. Is there a way to force the two boards to sync regardless of when the last server sync was?

2 Answers2

2

In addition to the tos orphan line all members of the Orphan Mode group must be configured in a mesh (i.e. they must all be clients / peers of each other). Any NTP association mode may be used to set up this mesh.

The TK1 configuration is lacking configuration for the TX1. Unless you've truncated the configuration, you should also need the appropriate "restrict" line(s) to allow each other to connect.

restrict default kod nomodify notrap nopeer noquery
restrict 10.20.3.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
  • I added those lines to the TK1's ntp.conf and rebooted both computers. No change - when running ntpdate -dv 10.20.3.149 I get the same error as above – schrödinbug Aug 12 '16 at 18:14
  • Are the the systems running a firewall? (Do you have udp/123 open?) – Aaron Copley Aug 12 '16 at 19:56
  • no there's just a switch between the boards. The two boards appear to be able to talk to each other fine--for some reason though the TX1 is too picky and says the TK1's time source isn't good enough. – schrödinbug Aug 12 '16 at 20:19
1

Both servers must be connected as peers. Add a line like peer 192.0.2.16 to each server using the IP address of the other server on the line.

I believe you need to set one of the servers to provide a clock source. I always configure one server a fallback if network connectivity fails. If you enable the local clock on both servers, set the stratum to different values. Anywhere between 8 and 12 should be good.

# Fallback to local clock if all else fails
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

Recommended setting for orphan is 2 more than the worst case clock, and it appears 6 is the lowest valid setting. If you can sync to the RTC with the above setting, I would set orphan to 12.

If you enable the local clock on both servers, set the stratum to different values. Anywhere between 8 and 12 should be good. As you only have one RTC, this would no apply.

BillThor
  • 4,698