Remco
Posts: 5
Joined: Tue Oct 01, 2013 3:59 pm

RasPi + NTP + PPS.

Fri Oct 04, 2013 11:05 am

I followed both the cookbook recipes from here and here.

For whatever reason ntpd here does not acknowledge my
PPS timestamps when using the ATOM reflock (22.0).

All postings I have seen deal with PPS in conjunction with
(mostly) a NMEA GPS.

Setup here: another machine (preferred peer) delivers a
UTC locked PPS (Motorola Oncore).

With ppstest /dev/pps0 I get time stamps, from which I conclude
that pps_gpio in the kernel works well.

When starting up ntpd, it generally takes a while before the ATOM
refclock is taken into consideration, and this appears in my ntpd.log:

4 Oct 11:37:39 ntpd[24325]: refclock_params: time_pps_setparams: Invalid argument

Any hints/tips?

Remco
Posts: 5
Joined: Tue Oct 01, 2013 3:59 pm

Re: RasPi + NTP + PPS.

Fri Oct 04, 2013 11:53 am

While the moderation of this topic was pending, I found out
that it was the fact that I use the falling edge of
the UTC locked PPS (flag 2 = 1 instead of 0).

I modified my ntp.conf (thus flag2 = 0) and yes.. after a while:

Code: Select all

ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oPPS(0)          .PPS.            0 l    4   16   17    0.000  -198.80   0.049
*Time.remco.org  .GPS.            1 u   61   64   17    0.789   -0.562   0.282
+ntp.nmi.nl      .PPS.            1 u   62   64   17   20.043   -3.769   0.137
I get a lock, but it's the wrong one (i.e. the pulse width) around 198.8 ms here.

Being not a C-programmer at all, I looked into the GPIO kernel patch and see the line:

Code: Select all

+	.assert_falling_edge = false,
Might this be the reason that the falling edge of the PPS pulse cannot generate an interrupt?

With ppstest /dev/pps0 I overlooked the fact that I do not have a 'clear' time stamp.

Code: Select all

sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1380886732.198747532, sequence: 99622 - clear  0.000000000, sequence: 0
A quick fix would be an inverter (transistor) or perhaps someone can integrate usage of the falling edge
of the PPS pulse in the GPIO bcm2708.c patch?
Last edited by Remco on Fri Oct 04, 2013 4:44 pm, edited 2 times in total.

Remco
Posts: 5
Joined: Tue Oct 01, 2013 3:59 pm

Re: RasPi + NTP + PPS.

Fri Oct 04, 2013 12:24 pm

Couldn't wait, so I made a hardware mod. Picture is here.

The inverter has two purposes:
- of course invert the signal
- level the signal to 3.3V

Result after the first lock:

Code: Select all

ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oPPS(0)          .PPS.            0 l    6   16    7    0.000    0.002   0.003
*Time.remco.org  .GPS.            1 u   50   64   17    0.775    0.013   0.073
+ntp.nmi.nl      .PPS.            1 u   47   64   17   20.284   -3.411   0.291
Looks good!

Remco
Posts: 5
Joined: Tue Oct 01, 2013 3:59 pm

Re: RasPi + NTP + PPS.

Thu Oct 10, 2013 7:17 pm

PLL offset of my Raspi* as ntp pool server
(serving several >1000 clients) is depicted below:

Image

I run ntp servers for a long time but I never saw such (good)
performance of a 'clean' server, i.e. no thermostat on the CPU clock.

*Note: picture shown is actual and may vary on
my experiments with (several/port forwarded) ntp servers.
When it's 'Linux/3.6.11', it's the Raspi ; -)

Return to “Other projects”