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

이제 모든 것이 괜찮습니다.

관련 정보