f



Raspberry PI Zero GPS fed NTP server issue

Hello,

I'm attempting to configure a Raspberry PI Zero as a GPS fed NTP server for my home network.  During the configuration process, I've gotten stuck with the following problem (output below):

pi@raspberrypi:/usr/local/ntp/bin $ ./ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
o127.127.22.0    .kPPS.           0 l   13   16  377    0.000   -3.949   0.353
x127.127.28.0    .GPSD.           1 l   13   16  377    0.000  641.741  23.654
*128.138.140.44  .NIST.           1 u   21   64  377   13.514   -1.368   4.476

Note that my "kPPS" entry is prefaced with an "o", which I'm told is good, and my "GPSD" entry is prefaced with an "x", which I'm told is not good.  The "x" before the "GPSD" entry seems to come and go; good output follows:

pi@raspberrypi:/usr/local/ntp/bin $ ./ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
o127.127.22.0    .kPPS.           0 l    6   16  377    0.000    0.002   0.005
+127.127.28.0    .GPSD.           1 l    6   16  377    0.000  494.358  56.547
*128.138.140.44  .NIST.           1 u   28   64  377   13.444    2.847   0.446
pi@raspberrypi:/usr/local/ntp/bin $

Any ideas what would cause my "GPSD" entry to switch between "x" and "+"?

I've been following How-To documents located here:

http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html
http://www.satsignal.eu/ntp/Raspberry-Pi-quickstart.html
http://www.satsignal.eu/raspberry-pi/Schmidt-RPZ-NTP-2016.pdf
http://mythopoeic.org/pi-ntp/
https://musingsfromthe8thfloor.com/2015/02/08/stratum-1-ntp-server-on-raspberry-pi/comment-page-1/#comment-28

along with a variety of forums where people are asking for and discussing configuration issues...

My GPS unit is an Adafruit Ultimate GPS, which I connected to my PI Zero using these documents:

https://learn.adafruit.com/adafruit-ultimate-gps-on-the-raspberry-pi/introduction
http://www.satsignal.eu/raspberry-pi/Schmidt-RPZ-NTP-2016.pdf

My configuration information follows:

root@raspberrypi:/usr/local/ntp/sbin# ./ntpd --version
ntpd 4.3.93@1.2483 Tue Oct 18 02:16:02 UTC 2016 (1)


root@raspberrypi:/usr/local/ntp/sbin# uname -a
Linux raspberrypi 4.4.23+ #913 Tue Oct 4 13:56:56 BST 2016 armv6l GNU/Linux


root@raspberrypi:/usr/local/ntp/sbin# ppswatch -a /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
timestamp: 1476797579, sequence: 34974, offset:  2697026
timestamp: 1476797580, sequence: 34975, offset:  2694208
timestamp: 1476797581, sequence: 34976, offset:  2699390
timestamp: 1476797582, sequence: 34977, offset:  2694572
timestamp: 1476797583, sequence: 34978, offset:  2692754
timestamp: 1476797584, sequence: 34979, offset:  2693936
timestamp: 1476797585, sequence: 34980, offset:  2694118
timestamp: 1476797586, sequence: 34981, offset:  2692301
^C

Total number of PPS signals: 8
Maximum divergence: 2699390


root@raspberrypi:/usr/local/ntp/sbin# 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 1476797595.002692614, sequence: 34990 - clear  0.000000000, sequence: 0
source 0 - assert 1476797596.002691797, sequence: 34991 - clear  0.000000000, sequence: 0
source 0 - assert 1476797597.002689979, sequence: 34992 - clear  0.000000000, sequence: 0
source 0 - assert 1476797598.002691161, sequence: 34993 - clear  0.000000000, sequence: 0
^C

root@raspberrypi:/usr/local/ntp/sbin#  dmesg | grep -i pps
[    4.141313] pps_core: LinuxPPS API ver. 1 registered
[    4.141344] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    4.160400] pps pps0: new PPS source pps.-1
[    4.160518] pps pps0: Registered IRQ 184 as PPS source
[ 2099.460453] pps_ldisc: PPS line discipline registered
[ 2099.462264] pps pps1: new PPS source ttyAMA0
[ 2099.462367] pps pps1: source "/dev/ttyAMA0" added


root@raspberrypi:/usr/local/ntp/sbin# cat /dev/ttyAMA0 
$GPGGA,133335.000,3859.3203,N,10452.4481,W,1,08,0.99,2100.4,M,-21.3,M,,*66
$GPGSA,A,3,02,03,17,19,24,28,12,06,,,,,1.30,0.99,0.84*0A
$GPGSV,3,1,09,06,72,168,17,19,66,021,26,17,50,048,15,24,42,280,20*74
$GPGSV,3,2,09,02,40,207,16,28,27,117,19,12,22,310,12,03,13,050,19*7B
$GPGSV,3,3,09,22,03,036,*46
$GPRMC,133335.000,A,3859.3203,N,10452.4481,W,1.25,194.08,181016,,,A*7B
$GPZDA,133335.000,18,10,2016,,*5F
$GPGGA,133336.000,3859.3200,N,10452.4481,W,1,08,0.99,2100.4,M,-21.3,M,,*66
$GPGSA,A,3,02,03,17,19,24,28,12,06,,,,,1.30,0.99,0.84*0A
$GPRMC,133336.000,A,3859.3200,N,10452.4481,W,1.30,190.94,181016,,,A*7E
$GPZDA,133336.000,18,10,2016,,*5C
$GPGGA,133337.000,3859.3198,N,10452.4481,W,1,08,0.99,2100.5,M,-21.3,M,,*64
$GPGSA,A,3,02,03,17,19,24,28,12,06,,,,,1.30,0.99,0.84*0A
$GPRMC,133337.000,A,3859.3198,N,10452.4481,W,1.25,187.76,181016,,,A*73
$GPZDA,133337.000,18,10,2016,,*5D


pi@raspberrypi:/usr/local/ntp/bin $ grep -v ^# /etc/ntp.conf | grep -v ^$
driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server utcnist.colorado.edu prefer
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0 refid kPPS
server 127.127.28.0 minpoll 4 maxpoll 4 iburst
fudge 127.127.28.0 time1 +1.105 flag1 1 refid GPSD stratum 1


root@raspberrypi:/usr/local/ntp/sbin# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

i2c-dev
pps-gpio


root@raspberrypi:/usr/local/ntp/sbin# grep -v ^# /boot/cmdline.txt 
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles


root@raspberrypi:/usr/local/ntp/sbin# grep -v ^# /boot/config.txt | grep -v ^$
dtparam=audio=on
enable_uart=1
dtoverlay=pps-gpio,gpiopin=24


root@raspberrypi:/usr/local/ntp/sbin# lsmod
Module                  Size  Used by
pps_ldisc               2389  2 
bnep                   11853  2 
bluetooth             365780  5 bnep
cfg80211              499234  0 
rfkill                 21397  3 cfg80211,bluetooth
evdev                  11650  4 
joydev                  9194  0 
hid_logitech_hidpp     11560  0 
pegasus                17484  0 
hid_logitech_dj        11567  0 
snd_bcm2835            23131  1 
snd_pcm                95473  1 snd_bcm2835
snd_timer              22556  1 snd_pcm
snd                    68368  5 snd_bcm2835,snd_timer,snd_pcm
bcm2835_gpiomem         3823  0 
bcm2835_wdt             4133  0 
uio_pdrv_genirq         3718  0 
uio                    10230  1 uio_pdrv_genirq
pps_gpio                2993  1 
pps_core                8756  4 pps_ldisc,pps_gpio
i2c_dev                 6578  0 
fuse                   90216  3 
ipv6                  367607  30


root@raspberrypi:/usr/local/ntp/sbin# systemctl | grep -i gps
gpsd.service                                                                                    loaded active running   GPS (Global Positioning System) Daemon
gpsd.socket                                                                                     loaded active running   GPS (Global Positioning System) Daemon Sockets


root@raspberrypi:/usr/local/ntp/sbin# ping 127.127.22.0
PING 127.127.22.0 (127.127.22.0) 56(84) bytes of data.
64 bytes from 127.127.22.0: icmp_seq=1 ttl=64 time=0.369 ms
64 bytes from 127.127.22.0: icmp_seq=2 ttl=64 time=0.169 ms
^C
--- 127.127.22.0 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.169/0.269/0.369/0.100 ms


root@raspberrypi:/usr/local/ntp/sbin# ping 127.127.28.0
PING 127.127.28.0 (127.127.28.0) 56(84) bytes of data.
64 bytes from 127.127.28.0: icmp_seq=1 ttl=64 time=0.338 ms
64 bytes from 127.127.28.0: icmp_seq=2 ttl=64 time=0.157 ms
^C
--- 127.127.28.0 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.157/0.247/0.338/0.091 ms


root@raspberrypi:/usr/local/ntp/sbin# ufw status
Status: inactive


root@raspberrypi:/usr/local/ntp/sbin# grep ^PATH /etc/init.d/ntp
PATH=/usr/local/ntp/bin:/usr/local/ntp/sbin:/sbin:/bin:/usr/sbin:/usr/bin


root@raspberrypi:/usr/local/ntp/sbin# grep ^DAEMON /etc/init.d/ntp
DAEMON=/usr/local/ntp/sbin/ntpd


root@raspberrypi:/usr/local/ntp/sbin# ps -ef | grep -i gps
gpsd      2429     1  0 Oct17 ?        00:00:31 /usr/sbin/gpsd -N -n /dev/ttyAMA0
root      3101  3062  0 07:37 pts/1    00:00:00 grep -i gps


root@raspberrypi:/usr/local/ntp/sbin# ps -ef | grep -i ntp
ntp       2520     1  0 Oct17 ?        00:00:08 /usr/local/ntp/sbin/ntpd -p /var/run/ntpd.pid -g -u 106:111
root      3103  3062  0 07:37 pts/1    00:00:00 grep -i ntp
0
ramseyrt
10/19/2016 1:19:26 AM
comp.protocols.time.ntp 4895 articles. 2 followers. Post Follow

3 Replies
395 Views

Similar Articles

[PageSpeed] 33

Le mercredi 19 octobre 2016 03:19:28 UTC+2, Rob a =C3=A9crit=C2=A0:
> Hello,
>=20
> I'm attempting to configure a Raspberry PI Zero as a GPS fed NTP server f=
or my home network.  During the configuration process, I've gotten stuck wi=
th the following problem (output below):
>=20
> pi@raspberrypi:/usr/local/ntp/bin $ ./ntpq -pn
>      remote           refid      st t when poll reach   delay   offset  j=
itter
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> o127.127.22.0    .kPPS.           0 l   13   16  377    0.000   -3.949   =
0.353
> x127.127.28.0    .GPSD.           1 l   13   16  377    0.000  641.741  2=
3.654
> *128.138.140.44  .NIST.           1 u   21   64  377   13.514   -1.368   =
4.476
>=20
> Note that my "kPPS" entry is prefaced with an "o", which I'm told is good=
, and my "GPSD" entry is prefaced with an "x", which I'm told is not good. =
 The "x" before the "GPSD" entry seems to come and go; good output follows:
>=20
> pi@raspberrypi:/usr/local/ntp/bin $ ./ntpq -pn
>      remote           refid      st t when poll reach   delay   offset  j=
itter
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> o127.127.22.0    .kPPS.           0 l    6   16  377    0.000    0.002   =
0.005
> +127.127.28.0    .GPSD.           1 l    6   16  377    0.000  494.358  5=
6.547
> *128.138.140.44  .NIST.           1 u   28   64  377   13.444    2.847   =
0.446
> pi@raspberrypi:/usr/local/ntp/bin $
>=20
> Any ideas what would cause my "GPSD" entry to switch between "x" and "+"?
>=20
>=20
> pi@raspberrypi:/usr/local/ntp/bin $ grep -v ^# /etc/ntp.conf | grep -v ^$
> driftfile /var/lib/ntp/ntp.drift
> statsdir /var/log/ntpstats/
> statistics loopstats peerstats clockstats
> filegen loopstats file loopstats type day enable
> filegen peerstats file peerstats type day enable
> filegen clockstats file clockstats type day enable
> server utcnist.colorado.edu prefer
> server 127.127.22.0 minpoll 4 maxpoll 4
> fudge 127.127.22.0 refid kPPS
> server 127.127.28.0 minpoll 4 maxpoll 4 iburst
> fudge 127.127.28.0 time1 +1.105 flag1 1 refid GPSD stratum 1
>=20
>=20
> root@raspberrypi:/usr/local/ntp/sbin# cat /etc/modules
> # /etc/modules: kernel modules to load at boot time.
> #
> # This file contains the names of kernel modules that should be loaded
> # at boot time, one per line. Lines beginning with "#" are ignored.
>=20

Hi,

I remark that your time 1 value is quite high, it is usually around 0.5 for=
 normal RMC NMEA sentence. It seems that your communication line with your =
Pi0 has difficulties to receive all NMEA information.

You should decrease the number of sentences send by your GPS and be focused=
 on RMC.

Have a look also on the TOS command in your ntp.conf file; mine is like tha=
t:
tos minsane 0 mindist 0.3  # minimum sane clock for PPS and minimum dist 30=
0ms

Best,
Jean-Michel
0
girino66
10/19/2016 5:08:13 AM
1- If that can help you, my results and configuation file on a PI 1 with a Garmin 18xLVC:

pi@garmin18xLCV:~ $ ntpq -c rv -pn -c cv
associd=0 status=041d leap_none, sync_uhf_radio, 1 event, kern,
version="ntpd 4.2.8p8@1.3265-o Tue Jul 19 17:24:18 UTC 2016 (4)",
processor="armv6l", system="Linux/4.4.13-KPPS+", leap=00, stratum=1,
precision=-24, rootdelay=0.000, rootdisp=300.450, refid=GPS,
reftime=dbb18019.ccec1fd0  Wed, Oct 19 2016  5:16:09.800,
clock=dbb18037.eab160df  Wed, Oct 19 2016  5:16:39.916, peer=2431, tc=5,
mintc=3, offset=0.000345, frequency=-29.293, sys_jitter=0.000139,
clk_jitter=0.002, clk_wander=0.011
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
o127.127.20.0    .GPS.            0 l   30   32  377    0.000    0.000   0.000
associd=0 status=0000 no events, clk_unspec,
device="NMEA-PPS GPS Clock",
timecode="$GPRMC,051639,A,4548.8941,N,00836.9879,E,000.0,007.7,191016,001.8,E*72",
poll=16333, noreply=0, badformat=0, baddata=0, fudgetime2=550.000,
stratum=0, refid=GPS, flags=5

2- My ntp.conf file:

driftfile /var/lib/ntp/ntp.drift

server 127.127.20.0 mode 17 minpoll 5 maxpoll 5  # NMEA formats 9600 RMC
fudge 127.127.20.0 time2 0.550 flag1 1 flag3 1   # NMEA offset 

tos minsane 0 mindist 0.3  # minimum sane and minimum dist 300ms

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer #noquery
restrict -6 default kod notrap nomodify nopeer #noquery

-3 I don't use GPSD but doing that request kernel and ntp compilations

Best,
Jean-Michel
0
girino66
10/19/2016 5:21:45 AM
ramseyrt@gmail.com wrote:
> Hello,
> 
> I'm attempting to configure a Raspberry PI Zero as a GPS fed NTP server for my home network.  During the configuration process, I've gotten stuck with the following problem (output below):
> 
> pi@raspberrypi:/usr/local/ntp/bin $ ./ntpq -pn
>      remote           refid      st t when poll reach   delay   offset  jitter
> ==============================================================================
> o127.127.22.0    .kPPS.           0 l   13   16  377    0.000   -3.949   0.353
> x127.127.28.0    .GPSD.           1 l   13   16  377    0.000  641.741  23.654
> *128.138.140.44  .NIST.           1 u   21   64  377   13.514   -1.368   4.476
> 
> Note that my "kPPS" entry is prefaced with an "o", which I'm told is good, and my "GPSD" entry is prefaced with an "x", which I'm told is not good.  The "x" before the "GPSD" entry seems to come and go; good output follows:
> 
> pi@raspberrypi:/usr/local/ntp/bin $ ./ntpq -pn
>      remote           refid      st t when poll reach   delay   offset  jitter
> ==============================================================================
> o127.127.22.0    .kPPS.           0 l    6   16  377    0.000    0.002   0.005
> +127.127.28.0    .GPSD.           1 l    6   16  377    0.000  494.358  56.547
> *128.138.140.44  .NIST.           1 u   28   64  377   13.444    2.847   0.446
> pi@raspberrypi:/usr/local/ntp/bin $
> 
> Any ideas what would cause my "GPSD" entry to switch between "x" and "+"?
> 

......

> pi@raspberrypi:/usr/local/ntp/bin $ grep -v ^# /etc/ntp.conf | grep -v ^$
> driftfile /var/lib/ntp/ntp.drift
> statsdir /var/log/ntpstats/
> statistics loopstats peerstats clockstats
> filegen loopstats file loopstats type day enable
> filegen peerstats file peerstats type day enable
> filegen clockstats file clockstats type day enable
> server utcnist.colorado.edu prefer
> server 127.127.22.0 minpoll 4 maxpoll 4
> fudge 127.127.22.0 refid kPPS
> server 127.127.28.0 minpoll 4 maxpoll 4 iburst
> fudge 127.127.28.0 time1 +1.105 flag1 1 refid GPSD stratum 1
> 

Hi

I've no experience with GPSD but have used the shm driver on
one of my pool servers.

How did you calibrate the "fudge 127.127.28.0 time1 +1.105"?

My guess is that you need to recalibrate the value so that the
offset remains between 0.0 and 0.499.

I also set stratum 5 as the offset value varied too much to be
only useful for setting the actual second but not consistent
enough to give even 1ms precision.

My Sure GPS:
remote         refid  st poll  reach   offset
=============================================
*GPS_NMEA(2)   .GPSb.  7   64    377  -14.304
oPPS(2)        .PPSb.  0    8    377    0.001


David

0
David
10/19/2016 2:23:54 PM
Reply: