# GPSd and NTP



## pmaechler (Oct 16, 2020)

Hello BSD Users

Since a few years I'm running several NTP servers but all of them reference some systems on the net. Now I'd like to be more precise and install a GPS receiver...

My problem ist, that the time from gpsd is not synced with my ntp server
(I may note, that I'm not a GPS expert at all )

What I did so far:

loaded the PPS Kernel Module
connected the GPS receiver (Garmin 18x LVC) to the serial port (COM1)
enabled dbus, gpsd and ntp in rc.conf
For testing i start gpsd with:
`gpsd -D 5 -N -n -s 4800 -F /var/run/gpsd.sock /dev/cuau0`


Then i get a lot of output on the console...

```
gpsd:PROG: control socket opened at /var/run/gpsd.sock
gpsd:INFO: launching (Version 3.20)
gpsd:IO: opening IPv4 socket
gpsd:IO: opening IPv6 socket
gpsd:INFO: listening on port 2947
gpsd:PROG: NTP: shmat(65536,0,0) succeeded, segment 0
gpsd:PROG: NTP: shmat(65537,0,0) succeeded, segment 1
gpsd:PROG: NTP: shmat(65538,0,0) succeeded, segment 2
gpsd:PROG: NTP: shmat(65539,0,0) succeeded, segment 3
gpsd:PROG: NTP: shmat(65540,0,0) succeeded, segment 4
gpsd:PROG: NTP: shmat(65541,0,0) succeeded, segment 5
gpsd:PROG: NTP: shmat(65542,0,0) succeeded, segment 6
gpsd:PROG: NTP: shmat(65543,0,0) succeeded, segment 7
gpsd:PROG: successfully connected to the DBUS system bus
gpsd:PROG: shmget(0x47505344, 24024, 0666) for SHM export succeeded
gpsd:PROG: shmat() for SHM export succeeded, segment 65544
gpsd:INFO: stashing device /dev/cuau0 at slot 0
gpsd:PROG: no /etc/gpsd/device-hook present, skipped running ACTIVATE hook
gpsd:INFO: SER: opening GPS data source type 2 at '/dev/cuau0'
gpsd:INFO: SER: speed 4800, 8N1
gpsd:IO: SER: => GPS: $PASHQ,RID*28\x0d\x0a
gpsd:IO: SER: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: SER: => GPS: @F2.2=1*64\x0d\x0a
gpsd:IO: => GPS: @F2.2=1*64\x0d\x0a
gpsd:PROG: GREIS: Writing command '%dm%dm', checksum: 51
gpsd:IO: SER: => GPS: %dm%dm@51\x0d\x0a
gpsd:PROG: GREIS: Writing command '%vendor%print,/par/rcv/vendor', checksum: 0A
gpsd:IO: SER: => GPS: %vendor%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: writing oncore control type Cj
gpsd:IO: SER: => GPS: @@Cj)\x0d\x0a%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: Probing "Garmin USB binary" driver...
gpsd:PROG: Probe not found "Garmin USB binary" driver...
gpsd:PROG: Probing "GeoStar" driver...
gpsd:PROG: Sent GeoStar packet id 0xc1
gpsd:IO: SER: => GPS: 5053474700c100010000000050924746
gpsd:PROG: Probe not found "GeoStar" driver...
gpsd:PROG: Probing "Trimble TSIP" driver...
gpsd:INFO: SER: speed 4800, 8O1
gpsd:IO: SER: => GPS: $PASHQ,RID*28\x0d\x0a
gpsd:IO: SER: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: SER: => GPS: @F2.2=1*64\x0d\x0a
gpsd:IO: => GPS: @F2.2=1*64\x0d\x0a
gpsd:PROG: GREIS: Writing command '%dm%dm', checksum: 51
gpsd:IO: SER: => GPS: %dm%dm@51\x0d\x0a
gpsd:PROG: GREIS: Writing command '%vendor%print,/par/rcv/vendor', checksum: 0A
gpsd:IO: SER: => GPS: %vendor%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: writing oncore control type Cj
gpsd:IO: SER: => GPS: @@Cj)\x0d\x0a%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:INFO: SER: speed 4800, 8N1
gpsd:IO: SER: => GPS: $PASHQ,RID*28\x0d\x0a
gpsd:IO: SER: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: SER: => GPS: @F2.2=1*64\x0d\x0a
gpsd:IO: => GPS: @F2.2=1*64\x0d\x0a
gpsd:PROG: GREIS: Writing command '%dm%dm', checksum: 51
gpsd:IO: SER: => GPS: %dm%dm@51\x0d\x0a
gpsd:PROG: GREIS: Writing command '%vendor%print,/par/rcv/vendor', checksum: 0A
gpsd:IO: SER: => GPS: %vendor%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: writing oncore control type Cj
gpsd:IO: SER: => GPS: @@Cj)\x0d\x0a%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: Probe not found "Trimble TSIP" driver...
gpsd:PROG: Probing "iSync" driver...
gpsd:INFO: SER: speed 4800, 8N1
gpsd:IO: SER: => GPS: $PASHQ,RID*28\x0d\x0a
gpsd:IO: SER: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: SER: => GPS: @F2.2=1*64\x0d\x0a
gpsd:IO: => GPS: @F2.2=1*64\x0d\x0a
gpsd:PROG: GREIS: Writing command '%dm%dm', checksum: 51
gpsd:IO: SER: => GPS: %dm%dm@51\x0d\x0a
gpsd:PROG: GREIS: Writing command '%vendor%print,/par/rcv/vendor', checksum: 0A
gpsd:IO: SER: => GPS: %vendor%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: writing oncore control type Cj
gpsd:IO: SER: => GPS: @@Cj)\x0d\x0a%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:IO: SER: => GPS: @@@@\x0d\x0aMAW0C0B\x0d\x0a
gpsd:INFO: SER: speed 4800, 8N1
gpsd:IO: SER: => GPS: $PASHQ,RID*28\x0d\x0a
gpsd:IO: SER: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: => GPS: @F0.3=1*67\x0d\x0a
gpsd:IO: SER: => GPS: @F2.2=1*64\x0d\x0a
gpsd:IO: => GPS: @F2.2=1*64\x0d\x0a
gpsd:PROG: GREIS: Writing command '%dm%dm', checksum: 51
gpsd:IO: SER: => GPS: %dm%dm@51\x0d\x0a
gpsd:PROG: GREIS: Writing command '%vendor%print,/par/rcv/vendor', checksum: 0A
gpsd:IO: SER: => GPS: %vendor%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: writing oncore control type Cj
gpsd:IO: SER: => GPS: @@Cj)\x0d\x0a%print,/par/rcv/vendor@0A\x0d\x0a
gpsd:PROG: Probe not found "iSync" driver...
gpsd:PROG: no probe matched...
gpsd:INFO: gpsd_activate(2): activated GPS (fd 7)
gpsd:PROG: PPS:/dev/cuau0 chrony socket /var/run/chrony.cuau0.sock doesn't exist
gpsd:INFO: KPPS:/dev/cuau0 RFC2783 path:/dev/cuau0, fd is 7
gpsd:INFO: KPPS:/dev/cuau0 pps_caps 0x1133
gpsd:INFO: KPPS:/dev/cuau0 have PPS_CANWAIT
gpsd:INFO: KPPS:/dev/cuau0 kernel PPS will be used
gpsd:PROG: PPS:/dev/cuau0 thread launched
gpsd:INFO: PPS:/dev/cuau0 ntpshm_link_activate: 1
gpsd:INFO: device /dev/cuau0 activated
gpsd:INFO: running with effective group ID 0
gpsd:INFO: running with effective user ID 65534
gpsd:INFO: startup at 2020-10-16T08:36:01.000Z (1602837361)
gpsd:PROG: KPPS:/dev/cuau0 assert  1602837362.000046501, sequence: 2700, clear   1602837361.100046964, sequence: 2700 - using: assert
gpsd:PROG: KPPS:/dev/cuau0 Assert cycle: 1602837362000046, duration: 899999 @  1602837362.000046501
gpsd:PROG: PPS:/dev/cuau0 Assert cycle: 1602837362000046, duration: 899999 @  1602837362.000046501
gpsd:PROG: PPS:/dev/cuau0 Assert ignored missing last_fixtime
gpsd:PROG: KPPS:/dev/cuau0 assert  1602837362.000046501, sequence: 2700, clear   1602837362.100047316, sequence: 2701 - using: clear
gpsd:PROG: KPPS:/dev/cuau0 Clear cycle: 1000000, duration: 100000 @  1602837362.100047316
gpsd:PROG: PPS:/dev/cuau0 Clear cycle: 1000000, duration: 100000 @  1602837362.100047316
gpsd:PROG: PPS:/dev/cuau0 Clear ignored missing last_fixtime
gpsd:PROG: switching to match packet type 1: $GPRMC,083602,A,4723.6913,N,00838.1451,E,000.0,031.1,161020,001.8,E,D*12\x0d\x0a
gpsd:PROG: switch_driver(NMEA0183) called...
gpsd:PROG: selecting NMEA0183 driver...
gpsd:INFO: /dev/cuau0 identified as type NMEA0183, 1 sec @ 4800bps
gpsd:PROG: => Probing for Garmin NMEA
gpsd:IO: SER: => GPS: $PGRMCE*0E\x0d\x0a
gpsd:IO: <= GPS: $GPRMC,083602,A,4723.6913,N,00838.1451,E,000.0,031.1,161020,001.8,E,D*12
gpsd:PROG: GPRMC starts a reporting cycle. lasttag 0
gpsd:PROG: NTP: ntpshm_put(/dev/cuau0,-20)  1602837362.000000000 @  1602837362.577243779
gpsd:PROG: => Probing for SiRF
gpsd:IO: SER: => GPS: $PSRF100,0,4800,8,1,0*0F\x0d\x0a
gpsd:IO: <= GPS: $GPGGA,083602,4723.6913,N,00838.1451,E,2,10,0.9,427.4,M,46.8,M,,*44
gpsd:PROG: => Probing for FV-18
gpsd:IO: SER: => GPS: $PFEC,GPint*58\x0d\x0a
gpsd:IO: <= GPS: $GPGSA,A,3,01,03,08,11,17,21,22,27,28,32,,,1.2,0.9,0.7*3E
gpsd:PROG: xxGSA sets mode 3
gpsd:PROG: xxGSA: mask 0x100000000c00
gpsd:PROG: => Probing for Trimble Copernicus
gpsd:IO: SER: => GPS: $PTNLSNM,0139,01*5C\x0d\x0a
gpsd:IO: <= GPS: $GPGSV,3,1,11,01,71,315,31,03,41,240,33,08,39,175,28,11,76,155,30*71
gpsd:PROG: xPGSV: part 1 of 3, last_gsv_talker '0'  last_gsv_sigid 0
gpsd:PROG: xPGSV: new part 1, last_gsv_talker '0', zeroing
gpsd:PROG: xxGSV: Partial satellite data (1 of 3).
gpsd:PROG: KPPS:/dev/cuau0 assert  1602837363.000044680, sequence: 2701, clear   1602837362.100047316, sequence: 2701 - using: assert
gpsd:PROG: KPPS:/dev/cuau0 Assert cycle: 999998, duration: 899997 @  1602837363.000044680
gpsd:PROG: PPS:/dev/cuau0 Assert cycle: 999998, duration: 899997 @  1602837363.000044680
gpsd:INFO: PPS:/dev/cuau0 Assert hooks called clock:  1602837363.000044680 real:  1602837363.000000000: no fix
gpsd:PROG: PPS:/dev/cuau0 Assert no fix @  1602837363.000044680 offset -0.000044680
gpsd:PROG: KPPS:/dev/cuau0 assert  1602837363.000044680, sequence: 2701, clear   1602837363.100045190, sequence: 2702 - using: clear
gpsd:PROG: KPPS:/dev/cuau0 Clear cycle: 999997, duration: 100000 @  1602837363.100045190
gpsd:PROG: PPS:/dev/cuau0 Clear cycle: 999997, duration: 100000 @  1602837363.100045190
gpsd:PROG: PPS:/dev/cuau0 Clear ignored 1Hz trailing edge
gpsd:PROG: => Probing for Evermore
gpsd:IO: SER: => GPS: 1002128e7f0101000101010000000000000000131003
gpsd:IO: <= GPS: $GPGSV,3,2,11,17,09,321,35,21,58,100,46,22,66,245,24,27,09,158,26*7D
gpsd:PROG: xPGSV: part 2 of 3, last_gsv_talker '0x50'  last_gsv_sigid 0
gpsd:PROG: xxGSV: Partial satellite data (2 of 3).
gpsd:PROG: => Probing for GPSClock
gpsd:IO: SER: => GPS: $PFEC,GPsrq*5B\x0d\x0a
gpsd:IO: <= GPS: $GPGSV,3,3,11,28,22,293,31,32,39,064,51,10,05,058,00*4D
gpsd:PROG: xPGSV: part 3 of 3, last_gsv_talker '0x50'  last_gsv_sigid 0
gpsd:INFO: PRN=  1 az=315.0 ael71.0 (-0.230211, 0.230211, 0.945519)
gpsd:INFO: PRN=  3 az=240.0 ael41.0 (-0.653598, -0.377355, 0.656059)
gpsd:INFO: PRN=  8 az=175.0 ael39.0 (0.067733, -0.774189, 0.629320)
gpsd:INFO: PRN= 11 az=155.0 ael76.0 (0.102241, -0.219256, 0.970296)
gpsd:INFO: PRN= 17 az=321.0 ael9.0 (-0.621572, 0.767578, 0.156434)
gpsd:INFO: PRN= 21 az=100.0 ael58.0 (0.521869, -0.092020, 0.848048)
gpsd:INFO: PRN= 22 az=245.0 ael66.0 (-0.368629, -0.171894, 0.913545)
gpsd:INFO: PRN= 27 az=158.0 ael9.0 (0.369995, -0.915769, 0.156434)
gpsd:INFO: PRN= 28 az=293.0 ael22.0 (-0.853477, 0.362280, 0.374607)
gpsd:INFO: PRN= 32 az=64.0 ael39.0 (0.698494, 0.340678, 0.629320)
gpsd:INFO: Sats used (10):
gpsd:PROG: => Probing for Ashtech
```

This tells me, that the receiver is connected to 10 satellites, so i have a valid signal (I guess)
What I find strange is 
	
	



```
gpsd:PROG: xxGSV: Partial satellite data (2 of 3).
```
 but these values change


If I telnet to port 2947 and execute the `?WATCH={"enable":true,"json":true}` command, I get

```
Escape character is '^]'.
{"class":"VERSION","release":"3.20","rev":"3.20","proto_major":3,"proto_minor":14}
?WATCH={"enable":true,"json":true}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/cuau0","driver":"Garmin NMEA","activated":"2020-10-16T08:42:25.098Z","flags":1,"native":0,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
{"class":"SKY","device":"/dev/cuau0","xdop":0.67,"ydop":0.67,"vdop":0.70,"tdop":0.76,"hdop":0.90,"gdop":1.63,"pdop":1.20,"satellites":[{"PRN":1,"el":74.0,"az":320.0,"ss":35.0,"used":true,"gnssid":0,"svid":1},{"PRN":3,"el":44.0,"az":242.0,"ss":31.0,"used":true,"gnssid":0,"svid":3},{"PRN":8,"el":36.0,"az":175.0,"ss":34.0,"used":true,"gnssid":0,"svid":8},{"PRN":10,"el":3.0,"az":60.0,"ss":42.0,"used":false,"gnssid":0,"svid":10},{"PRN":11,"el":72.0,"az":153.0,"ss":34.0,"used":true,"gnssid":0,"svid":11},{"PRN":17,"el":11.0,"az":321.0,"ss":26.0,"used":true,"gnssid":0,"svid":17},{"PRN":21,"el":56.0,"az":103.0,"ss":46.0,"used":true,"gnssid":0,"svid":21},{"PRN":22,"el":69.0,"az":249.0,"ss":30.0,"used":true,"gnssid":0,"svid":22},{"PRN":27,"el":7.0,"az":158.0,"ss":17.0,"used":true,"gnssid":0,"svid":27},{"PRN":28,"el":21.0,"az":290.0,"ss":17.0,"used":true,"gnssid":0,"svid":28},{"PRN":32,"el":38.0,"az":61.0,"ss":50.0,"used":true,"gnssid":0,"svid":32},{"PRN":4,"el":1.0,"az":191.0,"ss":0.0,"used":false,"gnssid":0,"svid":4}]}
{"class":"TPV","device":"/dev/cuau0","status":2,"mode":3,"time":"2020-10-16T08:42:26.000Z","ept":0.005,"lat":47.394970000,"lon":8.635458333,"altHAE":490.200,"altMSL":443.400,"alt":443.400,"epx":2.523,"epy":2.514,"epv":4.025,"track":285.9000,"magtrack":287.7000,"magvar":1.8,"speed":0.000,"climb":0.100,"eps":8.68,"epc":29.73,"geoidSep":46.800,"eph":4.275,"sep":5.700}
{"class":"PPS","device":"/dev/cuau0","real_sec":1602837747,"real_nsec":0,"clock_sec":1602837747,"clock_nsec":74234,"precision":-20}
{"class":"SKY","device":"/dev/cuau0","xdop":0.67,"ydop":0.67,"vdop":0.70,"tdop":0.76,"hdop":0.90,"gdop":1.63,"pdop":1.20,"satellites":[{"PRN":1,"el":74.0,"az":320.0,"ss":35.0,"used":true,"gnssid":0,"svid":1},{"PRN":3,"el":44.0,"az":242.0,"ss":32.0,"used":true,"gnssid":0,"svid":3},{"PRN":8,"el":36.0,"az":175.0,"ss":34.0,"used":true,"gnssid":0,"svid":8},{"PRN":10,"el":3.0,"az":60.0,"ss":42.0,"used":false,"gnssid":0,"svid":10},{"PRN":11,"el":72.0,"az":153.0,"ss":33.0,"used":true,"gnssid":0,"svid":11},{"PRN":17,"el":11.0,"az":321.0,"ss":28.0,"used":true,"gnssid":0,"svid":17},{"PRN":21,"el":56.0,"az":103.0,"ss":46.0,"used":true,"gnssid":0,"svid":21},{"PRN":22,"el":69.0,"az":249.0,"ss":30.0,"used":true,"gnssid":0,"svid":22},{"PRN":27,"el":7.0,"az":158.0,"ss":15.0,"used":true,"gnssid":0,"svid":27},{"PRN":28,"el":21.0,"az":290.0,"ss":17.0,"used":true,"gnssid":0,"svid":28},{"PRN":32,"el":38.0,"az":61.0,"ss":50.0,"used":true,"gnssid":0,"svid":32},{"PRN":4,"el":1.0,"az":191.0,"ss":0.0,"used":false,"gnssid":0,"svid":4}]}
{"class":"TPV","device":"/dev/cuau0","status":2,"mode":3,"time":"2020-10-16T08:42:28.000Z","ept":0.005,"lat":47.394980000,"lon":8.635455000,"altHAE":490.400,"altMSL":443.600,"alt":443.600,"epx":2.523,"epy":2.514,"epv":4.025,"track":285.9000,"magtrack":287.7000,"magvar":1.8,"speed":0.000,"climb":0.100,"eps":8.68,"epc":29.52,"geoidSep":46.800,"eph":4.275,"sep":5.700}
{"class":"PPS","device":"/dev/cuau0","real_sec":1602837749,"real_nsec":0,"clock_sec":1602837749,"clock_nsec":73316,"precision":-20}
{"class":"SKY","device":"/dev/cuau0","xdop":0.67,"ydop":0.67,"vdop":0.70,"tdop":0.76,"hdop":0.90,"gdop":1.63,"pdop":1.20,"satellites":[{"PRN":1,"el":74.0,"az":320.0,"ss":35.0,"used":true,"gnssid":0,"svid":1},{"PRN":3,"el":44.0,"az":242.0,"ss":33.0,"used":true,"gnssid":0,"svid":3},{"PRN":8,"el":36.0,"az":175.0,"ss":35.0,"used":true,"gnssid":0,"svid":8},{"PRN":10,"el":3.0,"az":60.0,"ss":42.0,"used":false,"gnssid":0,"svid":10},{"PRN":11,"el":72.0,"az":153.0,"ss":32.0,"used":true,"gnssid":0,"svid":11},{"PRN":17,"el":11.0,"az":321.0,"ss":28.0,"used":true,"gnssid":0,"svid":17},{"PRN":21,"el":56.0,"az":103.0,"ss":46.0,"used":true,"gnssid":0,"svid":21},{"PRN":22,"el":69.0,"az":249.0,"ss":30.0,"used":true,"gnssid":0,"svid":22},{"PRN":27,"el":7.0,"az":158.0,"ss":15.0,"used":true,"gnssid":0,"svid":27},{"PRN":28,"el":21.0,"az":290.0,"ss":17.0,"used":true,"gnssid":0,"svid":28},{"PRN":32,"el":38.0,"az":61.0,"ss":50.0,"used":true,"gnssid":0,"svid":32},{"PRN":4,"el":1.0,"az":191.0,"ss":0.0,"used":false,"gnssid":0,"svid":4}]}
{"class":"TPV","device":"/dev/cuau0","status":2,"mode":3,"time":"2020-10-16T08:42:30.000Z","ept":0.005,"lat":47.394993333,"lon":8.635448333,"altHAE":490.500,"altMSL":443.700,"alt":443.700,"epx":2.523,"epy":2.514,"epv":4.025,"track":285.9000,"magtrack":287.7000,"magvar":1.8,"speed":0.000,"climb":0.050,"eps":8.68,"epc":29.32,"geoidSep":46.800,"eph":4.275,"sep":5.700}
{"class":"PPS","device":"/dev/cuau0","real_sec":1602837751,"real_nsec":0,"clock_sec":1602837751,"clock_nsec":74772,"precision":-20}
{"class":"SKY","device":"/dev/cuau0","xdop":0.67,"ydop":0.67,"vdop":0.70,"tdop":0.76,"hdop":0.90,"gdop":1.63,"pdop":1.20,"satellites":[{"PRN":1,"el":74.0,"az":320.0,"ss":35.0,"used":true,"gnssid":0,"svid":1},{"PRN":3,"el":44.0,"az":242.0,"ss":34.0,"used":true,"gnssid":0,"svid":3},{"PRN":8,"el":36.0,"az":175.0,"ss":35.0,"used":true,"gnssid":0,"svid":8},{"PRN":10,"el":3.0,"az":60.0,"ss":42.0,"used":false,"gnssid":0,"svid":10},{"PRN":11,"el":72.0,"az":153.0,"ss":31.0,"used":true,"gnssid":0,"svid":11},{"PRN":17,"el":11.0,"az":321.0,"ss":28.0,"used":true,"gnssid":0,"svid":17},{"PRN":21,"el":56.0,"az":103.0,"ss":46.0,"used":true,"gnssid":0,"svid":21},{"PRN":22,"el":69.0,"az":249.0,"ss":30.0,"used":true,"gnssid":0,"svid":22},{"PRN":27,"el":7.0,"az":158.0,"ss":15.0,"used":true,"gnssid":0,"svid":27},{"PRN":28,"el":21.0,"az":290.0,"ss":17.0,"used":true,"gnssid":0,"svid":28},{"PRN":32,"el":38.0,"az":61.0,"ss":50.0,"used":true,"gnssid":0,"svid":32},{"PRN":4,"el":1.0,"az":191.0,"ss":0.0,"used":false,"gnssid":0,"svid":4}]}
{"class":"TPV","device":"/dev/cuau0","status":2,"mode":3,"time":"2020-10-16T08:42:32.000Z","ept":0.005,"lat":47.395003333,"lon":8.635451667,"altHAE":490.700,"altMSL":443.900,"alt":443.900,"epx":2.523,"epy":2.514,"epv":4.025,"track":285.9000,"magtrack":287.7000,"magvar":1.8,"speed":0.000,"climb":0.100,"eps":8.68,"epc":29.21,"geoidSep":46.800,"eph":4.275,"sep":5.700}
{"class":"PPS","device":"/dev/cuau0","real_sec":1602837753,"real_nsec":0,"clock_sec":1602837753,"clock_nsec":73084,"precision":-20}
{"class":"SKY","device":"/dev/cuau0","xdop":0.67,"ydop":0.67,"vdop":0.70,"tdop":0.76,"hdop":0.90,"gdop":1.63,"pdop":1.20,"satellites":[{"PRN":1,"el":74.0,"az":320.0,"ss":35.0,"used":true,"gnssid":0,"svid":1},{"PRN":3,"el":44.0,"az":242.0,"ss":34.0,"used":true,"gnssid":0,"svid":3},{"PRN":8,"el":36.0,"az":175.0,"ss":35.0,"used":true,"gnssid":0,"svid":8},{"PRN":10,"el":3.0,"az":60.0,"ss":42.0,"used":false,"gnssid":0,"svid":10},{"PRN":11,"el":72.0,"az":153.0,"ss":30.0,"used":true,"gnssid":0,"svid":11},{"PRN":17,"el":11.0,"az":321.0,"ss":29.0,"used":true,"gnssid":0,"svid":17},{"PRN":21,"el":56.0,"az":103.0,"ss":45.0,"used":true,"gnssid":0,"svid":21},{"PRN":22,"el":69.0,"az":249.0,"ss":30.0,"used":true,"gnssid":0,"svid":22},{"PRN":27,"el":7.0,"az":158.0,"ss":15.0,"used":true,"gnssid":0,"svid":27},{"PRN":28,"el":21.0,"az":290.0,"ss":13.0,"used":true,"gnssid":0,"svid":28},{"PRN":32,"el":38.0,"az":61.0,"ss":50.0,"used":true,"gnssid":0,"svid":32},{"PRN":4,"el":1.0,"az":191.0,"ss":0.0,"used":false,"gnssid":0,"svid":4}]}
{"class":"TPV","device":"/dev/cuau0","status":2,"mode":3,"time":"2020-10-16T08:42:34.000Z","ept":0.005,"lat":47.395015000,"lon":8.635443333,"altHAE":490.800,"altMSL":444.000,"alt":444.000,"epx":2.523,"epy":2.514,"epv":4.025,"track":285.9000,"magtrack":287.7000,"magvar":1.8,"speed":0.000,"climb":0.050,"eps":8.09,"epc":28.80,"geoidSep":46.800,"eph":4.275,"sep":5.700}
{"class":"PPS","device":"/dev/cuau0","real_sec":1602837755,"real_nsec":0,"clock_sec":1602837755,"clock_nsec":74438,"precision":-20}
{"class":"SKY","device":"/dev/cuau0","xdop":0.67,"ydop":0.67,"vdop":0.70,"tdop":0.76,"hdop":0.90,"gdop":1.63,"pdop":1.20,"satellites":[{"PRN":1,"el":74.0,"az":320.0,"ss":35.0,"used":true,"gnssid":0,"svid":1},{"PRN":3,"el":44.0,"az":242.0,"ss":34.0,"used":true,"gnssid":0,"svid":3},{"PRN":8,"el":36.0,"az":175.0,"ss":35.0,"used":true,"gnssid":0,"svid":8},{"PRN":10,"el":3.0,"az":60.0,"ss":42.0,"used":false,"gnssid":0,"svid":10},{"PRN":11,"el":72.0,"az":153.0,"ss":30.0,"used":true,"gnssid":0,"svid":11},{"PRN":17,"el":11.0,"az":321.0,"ss":29.0,"used":true,"gnssid":0,"svid":17},{"PRN":21,"el":56.0,"az":103.0,"ss":45.0,"used":true,"gnssid":0,"svid":21},{"PRN":22,"el":69.0,"az":249.0,"ss":30.0,"used":true,"gnssid":0,"svid":22},{"PRN":27,"el":7.0,"az":158.0,"ss":13.0,"used":true,"gnssid":0,"svid":27},{"PRN":28,"el":21.0,"az":290.0,"ss":14.0,"used":true,"gnssid":0,"svid":28},{"PRN":32,"el":38.0,"az":61.0,"ss":50.0,"used":true,"gnssid":0,"svid":32}]}
```

Why is the precision at -20 
	
	



```
{"class":"PPS","device":"/dev/cuau0","real_sec":1602837747,"real_nsec":0,"clock_sec":1602837747,"clock_nsec":74234,"precision":-20}
```



I'm sure that I'll have to fixe the PPS precision -20 stuff before going further into ntp configuration
But maybe one can help me out here as well

```
#
# The GPS receiver on COM1 at 4800 baud
#
#  mode 1 = use $GPRMC statements
#  time1 = trimming offset
#  flag3 = enable Kernel PPS discipline
server 127.127.20.0 mode 1 prefer
fudge  127.127.20.0 time1 0.000 refid PPS
```

what should i put in here? I got this values from www.satsignal.eu


Any help is appreciated

TIA
Philippe


----------



## serjsk8 (May 3, 2022)

Hello,
This is an old post, but no one answered.
I have the same problem.
I bought a cheap Chinese clone U-blox neo-6m.
And I tried just like you to synchronize time through it.
I was only able to achieve the desired result using gpsd and shared memory.


```
#NMEA Driver
server 127.127.20.0
fudge 127.127.20.0 refid GPS

#GPSD Shared Memory Driver
server 127.127.28.0 prefer
fudge 127.127.28.0 refid GPS
```

As you can see in the screenshot, my system is not syncing via NMEA Driver.

Maybe you can try to use GPSD Shared Memory Driver?
Driver 28


----------



## cy@ (May 4, 2022)

ntpd in base does not support receivers. It's primarily designed to be used as a stratum 2 or higher server, or a client (the last stratum in the tree). If you wish to use a stratum 0 device, like a GPS, you will need to install net/ntp. Make config and select the driver for your particular stratum 0 device (GPS). Then make install.


----------



## serjsk8 (May 4, 2022)

Thank you for reply,
I don't understand you.
What is the difference between ntpd installed in the system and port net/ntp?
By default, the package is built with GPS support:
- "NMEA=on: Enable NMEA GPS receiver"
- "SHM=on: Enable SHM clock attached thru shared memory" and etc


----------



## Erichans (May 4, 2022)

I'm no expert on GPS receivers but, this might be helpful: 
The Raspberry Pi as a Stratum-1 NTP Server

You could also have a look at an alternative: the Precision Time Protocol; net/ptpd2


----------



## SirDice (May 4, 2022)

serjsk8 said:


> What is the difference between ntpd installed in the system and port net/ntp?


The version that's imported on the base OS is somewhat stripped. The port allows you to set all the various options the upstream source supports. Similar to sendmail(8) from the base and mail/sendmail.


----------



## serjsk8 (May 4, 2022)

Yes, I know SirDice,
But I don't think that's the problem, and it's not in my case. 
All the options that I need are already in the Package.
For some reason I think that I can not use the NMEA GPS driver, this is a hardware GPS problem, not software.
GPSD shared memory work for me.
And this advice I gave to pmaechler
Try to use GPSD shared memory


----------



## cy@ (May 15, 2022)

serjsk8 said:


> Thank you for reply,
> I don't understand you.
> What is the difference between ntpd installed in the system and port net/ntp?
> By default, the package is built with GPS support:
> ...


ntpd in base is lean. It does not include any drivers. The port allows you to select and install drivers. Not all drivers work and not all drivers work with each other. Some drivers are mutually exclusive with other drivers. The port and base include some basic drivers which will not cause anyone any problems.


----------

