[time-nuts] GPSDO+PC as a NTP server

Adam Kumiszcza akumiszcza at gmail.com
Wed Oct 30 22:07:19 UTC 2019


My ntp.conf was very similar:

server 127.127.20.0 mode 17 minpoll 4 maxpoll 4 prefer
fudge 127.127.20.0 flag1 1 flag3 1 time2 0.15698

Are you sure flag1 comes after server, not fudge? It gives me syntax error
in /var/log/messages. Time2 calculated experimentally by the awk script.

# ntpq -c kerninfo
associd=0 status=042d leap_none, sync_uhf_radio, 2 events, kern,
pll offset:            2.54041
pll frequency:         -65.3446
maximum error:         7.453
estimated error:       0.2
kernel status:         pll ppsfreq ppstime nano
pll time constant:     4
precision:             0.001
frequency tolerance:   495.911
pps frequency:         -65.153
pps stability:         0
pps jitter:            0.000
calibration interval   4
calibration cycles:    0
jitter exceeded:       0
stability exceeded:    0
calibration errors:    0

As you can see, pps data looks broken. No calibration.

"cu -l /dev/gps0 -s 9600" gives me proper NMEA

I could not find ppstest for FreeBSD (pps-tools), but I compiled ppsapitest
(https://github.com/freebsd/freebsd/tree/master/tools/test/ppsapi).

 # kenv hint.uart.0.flags="0x10"
 # ./ppsapitest -v /dev/cuau0
Supported modebits: CAPTUREASSERT CAPTURECLEAR OFFSETASSERT OFFSETCLEAR
CANWAIT TSPEC
^C
root at gpsdo:~/ppsapitest # sysctl dev.uart.0.pps_mode=0x01
dev.uart.0.pps_mode: 0 -> 1
root at gpsdo:~/ppsapitest # ./ppsapitest -v /dev/cuau0
Supported modebits: CAPTUREASSERT CAPTURECLEAR OFFSETASSERT OFFSETCLEAR
CANWAIT TSPEC
1572471715 .999207702 8 1572471715 .050547992 8
1572471715 .999207702 8 1572471716 .050923133 9
1572471716 .998764118 9 1572471716 .050923133 9
1572471716 .998764118 9 1572471717 .051208066 10
1572471717 .999071162 10 1572471717 .051208066 10

# ntpq -p
     remote           refid      st t when poll reach   delay   offset
 jitter
==============================================================================
oGPS_NMEA(0)     .GPS.            0 l    1   16  377    0.000    0.001
0.010
*192.168.0.200   80.50.231.226    2 u   12   64    7    0.064    1.272
0.010
 pool.ntp.org    .POOL.          16 p    -   64    0    0.000    0.000
0.000
 ntp2.tktelekom. 80.50.231.226    2 u   10   64    7   34.972    5.244
0.614
 ntp.wide-net.pl 194.146.251.101  2 u    6   64    7   85.966   -2.331
0.223
 ntp2.pl         194.146.251.101  2 u    8   64    7   23.816    1.304
0.997
 162.159.200.123 10.73.8.83       3 u    8   64    7   42.993   -7.413
1.570
 162.159.200.1   10.73.8.83       3 u    4   64    7   43.889   -6.966
0.912
 SunSITE.icm.edu 210.100.177.101  2 u    4   64    7   34.776    4.662
7.338
 46.175.224.7.ma 193.106.216.30   3 u    1   64    7   49.671   -0.098
1.377
 ip-159-253-242- 194.146.251.100  2 u    6   64    3   38.582    6.277
1.151
 old.histeria.pl 212.160.106.226  2 u    4   64    3   30.292    1.609
1.325
 afrodyta.comple 210.100.177.101  2 u    -   64    3   33.259    2.214
1.533

# ntpq -c kerninfo
associd=0 status=041d leap_none, sync_uhf_radio, 1 event, kern,
pll offset:            0.009016
pll frequency:         -63.8877
maximum error:         941.687
estimated error:       0.003
kernel status:         pll ppsfreq ppstime ppssignal nano
pll time constant:     4
precision:             0.001
frequency tolerance:   495.911
pps frequency:         -63.8877
pps stability:         0.342499
pps jitter:            0.001
calibration interval   32
calibration cycles:    17
jitter exceeded:       1
stability exceeded:    0
calibration errors:    2

As you can see, pps data appeared and I have my "o" in front of GPS_NMEA!
:) I did not change ntp.conf, time2 offset is now ignored, I guess.
Offset and jitter from ntpq -crv after less than an hour now is even lower
than my Raspberry Pi with better gps chip and running non stop, but I need
more testing, of course.

Thank you again for your help!  dev.uart.0.pps_mode=0x01 did wonders.

Adam Kumiszcza


On Wed, Oct 30, 2019 at 9:01 PM Fiorenzo Cattaneo <fio at cattaneo.us> wrote:

> Hmm that is odd. I haven't seen the sio man page, I refer and use the
> directions in uart man page
>
>
> https://www.freebsd.org/cgi/man.cgi?query=uart&sektion=4&manpath=freebsd-release-ports
>
> And set this sysctl variable in /boot/loader.conf (note that the uart man
> page is also wrong, you can only set pps_mode for specific devices and not
> for all devices):
>
> dev.uart.0.pps_mode=0x10
>
> To test it without having to reboot, use sysctl command.
>
> Maybe the sio feature has been added recently, IDK, I still use FreeBSD
> kernel 11.1. What I know for sure is that the sysctl is actually
> implemented in the code -- see uart_core.c source.
>
>
> For ntp.conf, I only use the NMEA refclock #20. I always had trouble with
> the PPS  refclock #22.
>
> https://www.eecis.udel.edu/~mills/ntp/html/drivers/driver20.html
>
> The entry is something like this:
>
> Server 127.127.20.0 mode 17 flag1 1
>
> Mode 17 tells ntpd to process RMC only and use 9600 bps. Default is 4800
> bps. If you want to process all supported sentences at 9600 bps, use mode
> 16.
> Flag1  tells ntpd to use PPS. Default is no PPS.
> I also set max poll to 4.
>
> If you are still having trouble, you can troubleshoot like this:
> * set boot verbose mode in loader.conf, it will print the actual UART pps
> configuration.
> * use cu first to double check that you are using the correct line at the
> correct speed, for instance:
>        cu -l /dev/gps0 -s 9600
> If you see NMEA sentences correctly, then you know you have the correct
> device at 9600bps
> * download, build and run ppstest program to make sure PPS is setup
> correctly.
>
> If you see NMEA sentences, but you don't see PPS, there are two
> possibilities (1) PPS capture is still set to the default DCD (2) PPS
> output from GPS receiver is disabled. The latter should not be the case
> with the GPSDO.
>
>
> good luck!
>
>
>
>
>
>
>
>
> -- Fio Cattaneo
>
> Universal AC, can Entropy be reversed? -- "THERE IS AS YET
> INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
>
> On Oct 30, 2019, at 02:02, Adam Kumiszcza <akumiszcza at gmail.com> wrote:
>
> 
> HI again!
>
> On Wed, Oct 23, 2019 at 9:37 PM Fiorenzo Cattaneo <fio at cattaneo.us> wrote:
>
>> > 2. I would like to get both NMEA and PPS signal from it on the NTP
>> server.
>> > Currently PPS is on pin 8 (CTS) but according to
>> > http://doc.ntp.org/4.1.1/driver22.htm and
>> > https://www.satsignal.eu/ntp/NTP-on-Windows-serial-port.html it should
>> > rather be on pin 1 (DCD).
>>
>> [...]
>
>> (3) use FreeBSD instead, which supports runtime configuration of
>> either DCD or CTS for PPS
>>
>> I use the latter, as I am big fan of FreeBSD
>>
>
> I'm trying to make it work on FreeBSD.
>
> I put hint.uart.0.flags="0x10000" in /boot/device.hints as per
> https://www.freebsd.org/cgi/man.cgi?query=sio&sektion=4 (0x10000   PPS
> timestamping on CTS instead of DCD).
> I recompiled the kernel with PPS support.
> My devfs.conf has the following:
> link cuau0 gps0
> link cuau0 refclock-0
> link cuau0 pps0
>
> But I still don't seem to get PPS (no "o" in ntpq -np). Which driver do
> you use? 127.127.22.0 or 127.127.20.0 or both? I'm only able to use 22.0,
> which is GPS_NMEA, but on some webpages it's the only one mentioned after
> discussing PPS.
>
> Thanks in advance,
> Adam Kumiszcza
>
>



More information about the Time-nuts_lists.febo.com mailing list