gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-users] gpsd-users Digest, Vol 63, Issue 12


From: nagaraj
Subject: Re: [gpsd-users] gpsd-users Digest, Vol 63, Issue 12
Date: Thu, 16 Mar 2017 22:35:26 -0700

Hi Gary, Thanks for your reply. Unfortunately I am running older version of gpsd version 3.7 which does not have ntpshmmon utility. I also could not upgrade gpsd on my linux kernel version 3.3.8 (openwrt attitude adjustment distro). However I could get chrony to work properly with the same gpsd-3.7 which indicates that gpsd is writing the information to the shared memory segment. While ntpd still cannot synch up with gpsd. Please let me know if you need any more information. Also how do I update system time using either using chronyd or ntpd ?

Regards,
Nagaraj

address@hidden:/etc/init.d# chronyc sources
210 Number of sources = 10
MS Name/IP address           Stratum Poll LastRx Last sample
============================================================================
#* GPS                           0    4      8  +1514us[+2105us] +/-  200ms
#? PPS                           0    4    10y     +0ns[   +0ns] +/-    0ns
^? ha81.smatwebdesign.com        0    8    10y     +0ns[   +0ns] +/-    0ns
^? 104.200.138.192               0    8    10y     +0ns[   +0ns] +/-    0ns
^? ha81.smatwebdesign.com        0    8    10y     +0ns[   +0ns] +/-    0ns
^? ntp1.wiktel.com               0    8    10y     +0ns[   +0ns] +/-    0ns
^? i5.smatwebdesign.com          0    8    10y     +0ns[   +0ns] +/-    0ns
^? triton.ellipse.net            0    8    10y     +0ns[   +0ns] +/-    0ns
^? six0.ntp3.mattnordhoff.ne     0    8    10y     +0ns[   +0ns] +/-    0ns
^? pegasus.latt.net              0    8    10y     +0ns[   +0ns] +/-    0ns
address@hidden:/etc/init.d#

address@hidden:/etc/init.d# chronyc tracking
Reference ID    : 71.80.83.0 (GPS)
Stratum         : 1
Ref time (UTC)  : Fri Mar 17 04:39:49 2017
System time     : 0.000000253 seconds slow of NTP time
Frequency       : 22.998 ppm slow
Residual freq   : 1.413 ppm
Skew            : 34.955 ppm
Root delay      : 0.200000 seconds
Root dispersion : 0.100510 seconds
address@hidden:/etc/init.d#

address@hidden:~# ps axuw |grep gps
 2451 root      4048 S <  gpsd -n /dev/ttyACM0
28736 root      1344 S    grep gps
address@hidden:~#

==== /etc/init.d/ntp.conf ============================================

# use a random selection of 4 public stratum 2 servers
# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers

restrict 127.0.0.1

driftfile  /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 mask 255.255.255.0

server 0.openwrt.pool.ntp.org iburst
server 1.openwrt.pool.ntp.org iburst
server 2.openwrt.pool.ntp.org iburst
server 3.openwrt.pool.ntp.org iburst

# GPS Serial data reference (NTP0)
server 127.127.28.0
fudge 127.127.28.0 time1 0.9999 refid GPS

# GPS PPS reference (NTP1)
server 127.127.28.1 prefer
fudge 127.127.28.1 refid PPS

address@hidden:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 awesome.bytesta .INIT.          16 u    -   64    0    0.000    0.000   0.000
 chimera.buffero .INIT.          16 u    -   64    0    0.000    0.000   0.000
 ntp2.wiktel.com .INIT.          16 u    -   64    0    0.000    0.000   0.000
 b1-66er.matrix. .INIT.          16 u    -   64    0    0.000    0.000   0.000
 SHM(0)          .GPS.            0 l    -   64    0    0.000    0.000   0.000
 SHM(1)          .PPS.            0 l    -   64    0    0.000    0.000   0.000
address@hidden:~#

address@hidden:~# ps auxw |grep ntp
11076 root      1260 S    /sbin/ntpd -g -p /var/run/ntpd.pid
13743 root      1344 S    grep ntp
address@hidden:~#

address@hidden:~# ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x4e545030 0          root       600        80         2                       
0x4e545031 32769      root       600        80         2                       
0x4e545032 65538      root       666        80         1                       
0x4e545033 98307      root       666        80         1                       
0x47505344 131076     root       666        8232       1                       

address@hidden:~# gpsd -V
gpsd: 3.7 (revision 3.7)

address@hidden:~# ntpd -version
ntpd: illegal option -- v
ntpd - NTP daemon program - Ver. 4.2.6p5

On Mon, Mar 13, 2017 at 2:35 PM, <address@hidden> wrote:
Send gpsd-users mailing list submissions to
        address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.nongnu.org/mailman/listinfo/gpsd-users
or, via email, send a message with subject or body 'help' to
        address@hidden

You can reach the person managing the list at
        address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gpsd-users digest..."


Today's Topics:

   1. ntpd would not synch up with gpsd (nagaraj)
   2. Re: ntpd would not synch up with gpsd (Gary E. Miller)
   3. Re: ppsthread.c broken for FreeBSD gpio (Tony Hain)


----------------------------------------------------------------------

Message: 1
Date: Mon, 13 Mar 2017 13:15:45 -0700
From: nagaraj <address@hidden>
To: address@hidden
Subject: [gpsd-users] ntpd would not synch up with gpsd
Message-ID:
        <CAOFCAh_yDvq=rVLfs_XFDNk+fcRyLRPeJt9eF+G2Ti=x8yWKPQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

/usr/sbin/gpsd -N -n -D 7 -M 10 -i 300 /dev/ttyACM0

Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: launching (Version 3.7)
Mar 12 17:28:52 gpsd[25787]: gpsd:IO: opening IPv4 socket
Mar 12 17:28:52 gpsd[25787]: gpsd:SPIN: passivesock_af() -> 4
Mar 12 17:28:52 gpsd[25787]: gpsd:IO: opening IPv6 socket
Mar 12 17:28:52 gpsd[25787]: gpsd:ERROR: can't create IPv6 socket
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: listening on port gpsd
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: NTPD shmat(0,0,0) succeeded,
segment 0
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: NTPD shmat(32769,0,0) succeeded,
segment 1
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: NTPD shmat(65538,0,0) succeeded,
segment 2
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: NTPD shmat(98307,0,0) succeeded,
segment 3
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: shmat() succeeded, segment 131076
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: shared-segment creation succeeded,
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: PPS thread launched
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: NTPD ntpd_link_activate: 1
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: stashing device /dev/ttyACM0 at
slot 0
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: no etc/gpsd/device-hook present,
skipped running ACTIVATE hook
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: opening GPS data source type 2 at
'/dev/ttyACM0'
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: PPS Create Thread gpsd_ppsmonitor
Mar 12 17:28:52 gpsd[25787]: gpsd:PROG: PPS thread awaiting device
activation
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: speed 9600, 8N1
Mar 12 17:28:52 gpsd[25787]: gpsd:SPIN: open(/dev/ttyACM0) -> 5 in
gpsd_serial_open()
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: gpsd_activate(): activated GPS (fd
5)
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: device /dev/ttyACM0 activated
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: running with effective group ID 0
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: running with effective user ID 0
Mar 12 17:28:52 gpsd[25787]: gpsd:INFO: startup at 2017-03-13T00:28:52.000Z
(1489364932)
tail: /var/log/messages has been replaced; following end of new file
Mar 12 17:28:52 gpsd[25787]: gpsd:DATA: packet type 1 from /dev/ttyACM0
with {ONLINE|PACKET}
Mar 12 17:28:52 gpsd[25787]: gpsd:SPIN: packet_get() fd 5 -> 207 (0)
Mar 12 17:28:52 gpsd[25787]: gpsd:RAW: /dev/ttyACM0 is known to be Generic
NMEA
Mar 12 17:28:52 gpsd[25787]: gpsd:RAW: packet sniff on /dev/ttyACM0 finds
type 1
Mar 12 17:28:52 gpsd[25787]: gpsd:RAW: raw packet of type 1,
55:$GPTXT,01,01,02,HW  UBX-G70xx   00070000 EFFFFFFFo*1B\x0d\x0a
Mar 12 17:28:52 gpsd[25787]: gpsd:IO: <= GPS: $GPTXT,01,01,02,HW  UBX-G70xx
  00070000 EFFFFFFFo*1B^M
Mar 12 17:28:52 gpsd[25787]: gpsd:WARN: unknown sentence:
"$GPTXT,01,01,02,HW  UBX-G70xx   00070000 EFFFFFFFo*1B\x0d\x0a"
Mar 12 17:28:52 gpsd[25787]: gpsd:DATA: packet type 1 from /dev/ttyACM0
with {ONLINE|PACKET}
Mar 12 17:28:52 gpsd[25787]: gpsd:SPIN: packet_get() fd 5 -> 108 (0)
Mar 12 17:28:52 gpsd[25787]: gpsd:RAW: /dev/ttyACM0 is known to be Generic
NMEA

/etc/ntp.conf
=========
# use a random selection of 4 public stratum 2 servers
# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers

pool us.pool.ntp.org iburst

driftfile  /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 mask 255.255.255.0

# GPS(NMEA)+PPS
#server 127.127.20.0 minpoll 4 prefer
#fudge 127.127.20.0 flag3 1 flag2 0
server 127.127.28.0 minpoll 4 maxpoll 4
fudge 127.127.28.0 refid GPS
server 127.127.28.1 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.1 refid PPS

address@hidden:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset
 jitter
==============================================================================
 segfault.boom.n .INIT.          16 u    - 1024    0    0.000    0.000
0.000
 up2.com         .INIT.          16 u    -  512    0    0.000    0.000
0.000
 linode227395.st .INIT.          16 u    - 1024    0    0.000    0.000
0.000
 66-96-98-9.ccup .INIT.          16 u    -  512    0    0.000    0.000
0.000
 SHM(0)          .GPS.            0 l    -   16    0    0.000    0.000
0.000
 SHM(1)          .PPS.            0 l    -   16    0    0.000    0.000
0.000
address@hidden:~#
address@hidden:~# ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status

0x4e545030 0          root       600        80         2

0x4e545031 32769      root       600        80         2

0x4e545032 65538      root       666        80         1

0x4e545033 98307      root       666        80         1

0x47505344 131076     root       666        8232       1


address@hidden:~#

ntpd does not seem to fetch the time from gpsd. Am I missing anything in
here ?

Thanks,
Nagaraj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/gpsd-users/attachments/20170313/62834ae2/attachment.html>

------------------------------

Message: 2
Date: Mon, 13 Mar 2017 13:23:21 -0700
From: "Gary E. Miller" <address@hidden>
To: address@hidden
Subject: Re: [gpsd-users] ntpd would not synch up with gpsd
Message-ID: <20170313132321.6226f70d@spidey.rellim.com>
Content-Type: text/plain; charset="utf-8"

Yo nagaraj!

On Mon, 13 Mar 2017 13:15:45 -0700
nagaraj <address@hidden> wrote:

> ntpd does not seem to fetch the time from gpsd. Am I missing anything
> in here ?


What we really need to see is the output of ppstest and ntpshmon.

On a RasPi it should look like this:

pi4 ntpsec # 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 1489436508.000000943, sequence: 231387 - clear  0.000000000, sequence: 0
source 0 - assert 1489436509.000000771, sequence: 231388 - clear  0.000000000, sequence: 0
^C
pi4 ntpsec # ntpshmmon
ntpshmmon version 1
#      Name address@hidden               Clock                Real                 L Prec
sample NTP1 1489436516.069957555 1489436516.000000562 1489436516.000000000 0 -30
sample NTP0 1489436516.104251363 1489436516.103958499 1489436516.000000000 0 -20
sample NTP1 1489436517.000777725 1489436517.000000172 1489436517.000000000 0 -30
sample NTP0 1489436517.107487480 1489436517.106748835 1489436517.000000000 0 -20
sample NTP1 1489436518.001029006 1489436518.000000151 1489436518.000000000 0 -30
sample NTP0 1489436518.107823655 1489436518.106653969 1489436518.000000000 0 -20
sample NTP1 1489436519.000707253 1489436519.000000169 1489436519.000000000 0 -30
sample NTP0 1489436519.106702477 1489436519.105842842 1489436519.000000000 0 -20
^C

ppstest shows what gpsd can read about pps0.  ntpshmmon shows what
gpsd is sending to ntpd.


RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can?t measure it, you can?t improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.nongnu.org/archive/html/gpsd-users/attachments/20170313/6f81d5b2/attachment.pgp>

------------------------------

Message: 3
Date: Mon, 13 Mar 2017 14:35:17 -0700
From: "Tony Hain" <address@hidden>
To: <address@hidden>
Subject: Re: [gpsd-users] ppsthread.c broken for FreeBSD gpio
Message-ID: <07f901d29c41$b58c16f0$20a444d0$@tndh.net>
Content-Type: text/plain;       charset="utf-8"

Digging into this further ...

> -----Original Message-----
> From: gpsd-users [mailto:gpsd-users-bounces+tony=address@hidden]
> On Behalf Of Tony Hain
> Sent: Friday, March 10, 2017 11:52 AM
> To: address@hidden
> Subject: [gpsd-users] ppsthread.c broken for FreeBSD gpio
>
> The "non-linux" code in ppsthread.c is designed to fail in the case of gpio on
> FreeBSD. The discussion below was on the ntpsec list, but fixing gpsd clearly
> belongs here.
>
> > -----Original Message-----
> > From: bugs [mailto:address@hiddenorg] On Behalf Of Gary E.
> > Miller
> > Sent: Friday, March 10, 2017 9:53 AM
> > To: address@hidden
> > Subject: Re: nmea refclock not locking to the pps
> ...
> > On Thu, 9 Mar 2017 22:33:36 -0800
> > "Tony Hain" <address@hidden> wrote:
> >
> > > Following up with a patch :::
> > >
> > > ...
> > >
> > > I patched ppsthread.c, and I am sure this is not the correct way to
> > > do this since I have not been able to follow the overall structure,
> > > but it does appear to have opened the api.
> > >
> > > ppsthread.c -
> > > ...
> > > #else /* not __linux__ */
> > >     /*
> > >      * On BSDs that support RFC2783, one uses the API calls on serial
> > >      * port file descriptor.
> > >      *
> > >      * FIXME! need more specific than 'not linux'
> > >      */
> > > // inserting if test for /dev/pps name
> > >     if (strncmp(pps_thread->devicename, "/dev/pps", 8) == 0) {
> > >         ret = open(pps_thread->devicename, O_RDWR);
> > >     } else {       // existing
> > >
> > >     (void)strlcpy(path, pps_thread->devicename, sizeof(path));
> > >     // cppcheck-suppress redundantAssignment
> > >     ret  = pps_thread->devicefd;
> > >
> > >     }
> > > //
> > > #endif
> > > // inserting error check for non-linux (makes test in linux block
> > > redundant) if ( 0 > ret ) {
> > >         char errbuf[BUFSIZ] = "unknown error";
> > >         (void)strerror_r(errno, errbuf, sizeof(errbuf));
> > >         pps_thread->log_hook(pps_thread, THREAD_INF,
> > >                 "KPPS:%s running as %d/%d, cannot open %s: %s\n",
> > >                 pps_thread->devicename,
> > >                 getuid(), geteuid(),
> > >                 path, errbuf);
> > >         return -1;
> > >     } else {        // existing
> > >
> > >     /* assert(ret >= 0); */
> > >     pps_thread->log_hook(pps_thread, THREAD_INF,
> > >                 "KPPS:%s RFC2783 path:%s, fd is %d\n",
> > >                 pps_thread->devicename, path,
> > >                 ret);
> > >
> > >     }
> > > //
> > >     /* RFC 2783 implies the time_pps_setcap() needs priviledges * ...
> > >
> > > # grep KPPS /var/log/messages
> > > Mar  9 20:53:59 tic gpsd[67512]: gpsd:INFO: KPPS:/dev/pps1 RFC2783
> > > path:, fd is 7 Mar  9 20:53:59 tic gpsd[67512]: gpsd:INFO:
> > > KPPS:/dev/pps1 pps_caps
> > > 0x1111 Mar  9 20:53:59 tic gpsd[67512]:
> > > gpsd:INFO: KPPS:/dev/pps1 have PPS_CANWAIT  Mar  9 20:53:59 tic
> > > gpsd[67512]: gpsd:WARN: KPPS:/dev/pps1 missing PPS_CAPTURECLEAR,
> > > pulse may be offset Mar  9 20:53:59 tic gpsd[67512]: gpsd:INFO:
> > > KPPS:/dev/pps1 kernel PPS will be used Mar  9 20:53:59 tic
> > > gpsd[67512]: gpsd:PROG: KPPS:/dev/pps1
> > > gps_fd:-2 not a tty, can not use TIOMCIWAIT Mar 10 04:54:00 tic
> > > gpsd[67512]: gpsd:PROG: KPPS:/dev/pps1 assert
> > > 1489121640.028303412, sequence: 693997,clear   0.000000000,
> > > sequence: 0 - using: assert
> > > Mar 10 04:54:00 tic gpsd[67512]: gpsd:PROG: KPPS:/dev/pps1
> > > Assert cycle: 1489121640028303, duration:       0 @  1489121640.028303412
> > > Mar 10 04:54:01 tic gpsd[67512]: gpsd:PROG: KPPS:/dev/pps1 assert
> > > 1489121641.027803327, sequence: 693998, clear   0.000000000,
> > > sequence: 0 - using: assert
> > > Mar 10 04:54:01 tic gpsd[67512]:gpsd:PROG: KPPS:/dev/pps1
> > > Assert cycle:  999499, duration:       0 @ 1489121641.027803327
> > >
> > >
> > > I am getting log events above that the api is open,  and ntpshmmon
> > > shows the pps events now, but the ntpsec.conf refclock line is not
> > > recognizing the shm pps device.
> > >
> > > # ntpshmmon
> > > ntpshmmon version 1
> > > #      Name address@hidden               Clock
> > > Real                 L Prec
> > > sample NTP0 1489124430.611470658 1489124430.412209171
> > > 1489124430.000000000 0 -20
> > > sample NTP2 1489124430.611553695 1489124428.000033371
> > > 1489124428.000000000 0 -30
> > > sample NTP0 1489124431.412239685 1489124431.411282520
> > > 1489124431.000000000 0 -20
> > > sample NTP2 1489124432.001544155 1489124432.000033265
> > > 1489124432.000000000 0 -30
> > > sample NTP0 1489124432.415040281 1489124432.413955830
> > > 1489124432.000000000 0 -20
> > > sample NTP2 1489124433.002155059 1489124433.000033281
> > > 1489124433.000000000 0 -30
> > > sample NTP0 1489124433.411896022 1489124433.411793694
> > > 1489124433.000000000 0 -20
> > > sample NTP2 1489124434.002308776 1489124434.000033212
> > > 1489124434.000000000 0 -30

So the reason that the pps is being ignored is that the edge detection code is also linux specific (though I haven't traced it all yet), in that it knows how to deal with a linux Rpi with a single edge pps, but this being FreeBSD, it assumes both edges exist, then rejects the results. I have hacked it to force the edge dector to buy in, but before it gets there the invisible flag is set and other logic gives up on it.

Mar 13 21:24:22 tic gpsd[76642]: gpsd:RAW: PPS:/dev/pps0 Assert pps-detect invisible pulse


Looking at the code, my pulse shaper/driver for the MR350p would likely fail anyway because it is 530/470ms, and this appears to want the assert state to be shorter than 90% of half (which likely explains why I have never had any luck getting gpsd to play nice with ntp). It would be easy enough to customize the width detection part of this, but that part doesn't matter if it is rejected elsewhere. There are Rpi specific values referenced for dealing with its assert-only linux behavior, so the assumption that single-edge is Rpi-only would be at fault.

Tony


> > >
> > > # ntpmon
> > >   remote  refid   st t when poll reach   delay offset   jitter
> > > xSHM(0)  .GPS.  0  l  2  64  377  0.0000  33.9512  2.4540
> > >   SHM(1)  .PPS.  0  l  -   4    0  0.0000  0.0000  0.0000
> > > *2001:470:e930:2 .PPS.  1  u   33  64 377 0.9863  -0.3318 0.1757
> > > +express.tndh.ne .GPS.  1  u  39  64 377 1.2442 -0.2851 1.6407
> > > +trail.tndh.net  .GPS.  1 u  36   64  377 1.1138 -0.2766 0.1899
> > > ntpd ntpsec-0.9.6+536 2017-02-22T20:26:50Z
> > >   Last update: 2017-03-09T21:13:30
> > >
> > > # grep ^refclock /etc/ntp.conf
> > > refclock shm unit 0 refid GPS time1 0.4429166667 refclock shm unit 1
> > > refid PPS prefer minpoll 2 maxpoll 2 time1 0.000000337160
> ---
>
> Tony





------------------------------

Subject: Digest Footer

_______________________________________________
gpsd-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/gpsd-users


------------------------------

End of gpsd-users Digest, Vol 63, Issue 12
******************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]