3

I have already read about compiling NTP with timepps.h provided to get PPS support. Is there an easy way to check the already precompiled or rather installed version of an repository (Ubuntu 14.04.1, Kernel 3.13.0-37) for PPS support?

EDIT some googles later...

I inserted this in my /etc/ntp.conf and restartet ntpd. Seems this configuration to be correct? I'm using this GPS breakout board on /dev/ttyS0. According to documentation this should satisfy GPS with PPS. Baudrate is 9600.

server 127.127.20.0 mode 18 minpoll 4 iburst prefer true
fudge 127.127.20.0 flag1 1 flag2 0 flag3 1 flag4 1

I spent some time to get it work because apparmor blocked ntpd open the serial port. I figured that out from the syslos. Therefore I added this line to /etc/apparmor.d/tunables/ntpd. Then it worked.

@{NTPD_DEVICE}="/dev/ttyS0"

The permissions on the devices are

$ ll /dev/ttyS0 /dev/pps* /dev/gps*
lrwxrwxrwx 1 root root          5 Okt 18 23:00 /dev/gps0 -> ttyS0
lrwxrwxrwx 1 root root          4 Okt 18 23:00 /dev/gpspps0 -> pps0
crw-rw-rw- 1 root dialout 251,  0 Okt 18 23:00 /dev/pps0
crw-rw-rw- 1 root dialout   4, 64 Okt 18 23:09 /dev/ttyS0
$ id ntp
uid=106(ntp) gid=113(ntp) Gruppen=113(ntp),20(dialout)

To achieve this permanently I created some udev rules. Whereas the setserial command seems not to take effect if I check the port with setserial -a /dev/ttyS0 after system boot.

$ cat /etc/udev/rules.d/09-pps.rules
# Provide a symlink to /dev/ttyS0 and set low_latency for latency improvement
KERNEL=="ttyS0", SYMLINK+="gps0", MODE="0666"
KERNEL=="ttyS0", RUN+="/bin/setserial /dev/%k low_latency"
KERNEL=="ttyS0", RUN+="/usr/sbin/ldattach pps /dev/%k"

# Symlink /dev/pps0 to /dev/gpspps0
KERNEL=="pps0", SUBSYSTEM=="pps", DRIVER=="", SYMLINK+="gpspps0"
KERNEL=="pps0", GROUP="dialout"
KERNEL=="pps0", MODE="0666"

After that I had to delete /var/lib/ntp/ntp.conf.dhcp once. Because it is derived from /etc/ntp.conf at any DHCP event or just reboot. So it will generate a new one on startup.

Do I still need 127.127.22.* entry (ATOM PPS driver)? Because as stated in the documentation if I use flag1=1 PPS will be used implicitly? No, it works just with GPS NMEA (127.127.20.u).

My output of ntpq -p is now

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-fritz.box       185.31.136.34    3 u   36   64  177    0.298    4.496   0.076
*arcticfox.dorid 192.53.103.104   2 u   43   64  177   14.125    2.041   1.307
+monitman.com    158.43.128.33    2 u   44   64  177   25.325    4.703   0.314
+spacys.de       212.82.32.15     2 u   43   64  177   24.156   -1.503   2.094
-cse-server.com  122.227.206.195  3 u   38   64  177   24.372   -3.421   0.618
oGPS_NMEA(0)     .GPS.            0 l    1   16  377    0.000   -0.270   0.024

For ATOM clock support I have to compile ntp with enabled ATOM clock support.

0

Why not make it easy on yourself and try to use the PPS functionality. Edit your config file and to include the relevant PPS flag and start ntpd. This seems so obvious I am not sure if I am missing a constraint.

It is not clear to me what you mean by "installed version of an repository"? Do you mean linux distribution? If you do the answer is yes but it depends on what distribution you are using. But just attempting to make use of PPS seems like the best test.

Rebuilding ntp with PPS support

Once you verify that you have the gps device configured corectly you can rebuild ntp with pps support by:

 # apt-get build-dep ntp
 # apt-get install pps-tools ubuntu-dev-tools
 # apt-get source ntp
 # cd <The ntp version directory something like ntp-4.2.6.p5+dfsg >
 # dpkg-buildpackage -uc -us -nc 
 # dpkg -i ../ntp*.deb 

To avoid that apt doesn't install a new version, again without ATOM clock support, use

 # echo ntp hold  | dpkg --set-selections
  • Thanks for the reply. I meant Ubuntu >= 14.04.1 repository. Ok, so am I expecting an error message if NTP cannot support PPS? – wenzul Oct 18 '14 at 14:13
  • I dont think PPS is enabled by default with ubuntu. Can you add the output of ntpq -pcrv to you question? If the GPS is not showing up at all it most likely means you have a problem with your configuration of the serial device. Is the ntp user in the dialout group or whatever group owns pps0 and serial port? I will add instructions for rebuilding ntp with pps. – dfc Oct 18 '14 at 18:25
  • 1
    PPS is not enabled. The asterisk next to GPS would be a o The static-ip.blah prints PPS because it is synced to a PPS source. – dfc Oct 19 '14 at 2:33
  • Building did it! Thank you very much. Now it appears oGPS_NMEA(0). Thanks for the build steps above! Made life easier. Compiling failed at a debug print in refclock_jupiter.c. Fixed it then it worked. After I set time2 o appeared. So I don't need an extra PPS Clock Discipline entry in ntp.conf right? Furthermore, should I use falling or rising edge (flag2)? And should I use ntp clock or kernel discipline? I've read that min/maxpoll 4 and ntp clock discipline is better then kernels due to a median algorithm. – wenzul Oct 19 '14 at 4:53
  • I have answered a number of ntp questions for you and you have nt marked any as accepted. Instead of expaning the focus of this question please mark it as accepted if I answered your question about verifying PPS support and or how to build with PPS support. If you have other questions please make a new post and I will be happy to help. – dfc Oct 20 '14 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.