GPSDがタイムリーに動作しないのはなぜですか?

GPSDがタイムリーに動作しないのはなぜですか?

chronyを使用してPPSとGPSDを同期しようとしていますが、「#?」を受信する前にGPSがないのはなぜですか?私のchrony.confファイルは

# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usable directives.

# Include configuration files found in /etc/chrony/conf.d.
confdir /etc/chrony/conf.d

# Use Debian vendor zone.
#pool 2.debian.pool.ntp.org iburst

#refclock PPS /dev/pps1 lock NMEA trust prefer
refclock SHM 0 offset 0.395 delay 0.2 refid GPS trust

#refclock SOCK /run/chrony.ttyS4.sock
refclock SOCK /run/chrony.pps1.sock refid PPS precision 1e-7 trust prefer

# Use time sources from DHCP.
sourcedir /run/chrony-dhcp

# Use NTP sources found in /etc/chrony/sources.d.
sourcedir /etc/chrony/sources.d

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Save NTS keys and cookies.
ntsdumpdir /var/lib/chrony

# Uncomment the following line to turn logging on.
#log tracking measurements statistics

# Log files location.
logdir /var/log/chrony

# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3

# Get TAI-UTC offset and leap seconds from the system tz database.
# This directive must be commented out when using time sources serving
# leap-smeared time.
leapsectz right/UTC

最初はこれでした。

root@BeagleBone:~# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#- GPS                           0   4    17    20   -223ms[ -223ms] +/-  103ms
#* PPS                           0   4    17    18  +4406ns[-1926ns] +/-  905ns

ところが10~20秒経過すると以下のようになります。

root@BeagleBone:~# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#x GPS                           0   4   377    12   -235ms[ -235ms] +/-  102ms
#x PPS                           0   4   377    12    -31us[  -31us] +/- 1464ns

gpsmonを実行すると、次のようになります。 ここに画像の説明を入力してください。

私は次のバージョンを使用しています -

Chrony 4.0
gpsd 3.22

どんな助けでも大変感謝します!

ベストアンサー1

debian-11.6-minimal-armhf-2022-12-20今リンクからダウンロードしたものを使用しています。

https://rcn-ee.com/rootfs/eewiki/minfs/

/etc/default/gpsdこれで、パスでgpsdの設定が完了しました。

# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES="/dev/ttymxc3 /dev/pps2"

# Other options you want to pass to gpsd
GPSD_OPTIONS="-n"

# Automatically hot add/remove USB GPS devices via gpsdctl
USBAUTO="false"

#New_Addition
GPSD_SOCKET="/var/run/gpsd.sock"
BAUDRATE="38400"

/bin/stty -F $(DEVICE) $(BAUDRATE)
/bin/setserial $(DEVICE) low_latency

起動ファイルは次のとおりです。

#!/bin/bash

echo "<----------------------- Startup File---------------------------->"

killall -9 gpsd chronyd
chronyd -f /etc/chrony/chrony.conf
sleep 2
gpsd -n /dev/ttymxc3
sleep 2
systemctl start gpsd

ethtool --set-eee eth0 eee off
ptp4l -H -f /usr/local/etc/ptp4l.conf &
#phc2sys -a -r -E ntpshm -m -M 0 &
#phc2sys -s eth0 -O -35
echo "<--------------------Out From Start File--------------------->"

exit 0

PTPプロファイルを作成しました。/usr/local/etc/ptp4l.conf

[global]
# only syslog every 1024 seconds
summary_interval 10

# send to chronyd/ntpd using SHM 0
clock_servo ntpshm
ntpshm_segment 0

[eth0]

最終的なchrony.confファイルは次のとおりです。

#server 0.pool.ntp.org
#server 1.pool.ntp.org
#server 2.pool.ntp.org

#initstepslew 30 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org

# SHM0 from gpsd is the NMEA data at 4800bps, so is not very accurate
refclock SHM 0 delay 0.8 refid NMEA trust prefer

# SHM1 from gpsd (if present) is from the kernel PPS_LDISC
# module.  It includes PPS and will be accurate to a few ns
#refclock SHM 2 offset 0.0 delay 0.1 refid NMEA+

# SOCK protocol also includes PPS data and 
# it also provides time within a few ns
refclock SOCK /var/run/chrony.pps2.sock delay 0.0 refid SOCK trust prefer

refclock SHM 2 refid PTP precision 1e-7 trust prefer

#refclock SHM 0 delay 0.9 refid GPS trust prefer

# PPS is from the /dev/pps0 device.  Note that
# chronyd creates the /var/run/chrony.ttyS1.sock device, but
# gpsd creates the /dev/pps0 device
# openrc rules start gpsd /after/ chronyd, so /dev/pps0 
#   is not created until after chronyd is started
#   If you want to use pps0, either edit the openrc rules
#   or add this source after gpsd is started

#refclock PPS /dev/pps1 refid PPS trust prefer


# If you see something in ns... its good.
#          1 second =
#       1000 ms =
#    1000000 us =
# 1000000000 ns
rtcsync
logchange 0.5
local stratum 10

logdir /var/log/chrony

keyfile /etc/chrony/chrony.keys
commandkey 10

dumpdir /var/log/chrony
driftfile /var/log/chrony/chrony.drift

allow all

今、すべてが大丈夫です。

おすすめ記事