如何解决ptp4l 主偏移、频率和路径延迟的高值
我有以下测试平台
大师
TQMLS1028A-IND
它只有硬件时间戳 操作系统,
ID="poky"
NAME="Poky (Yocto Project Reference Distro)"
VERSION="3.0.4 (zeus)"
VERSION_ID="3.0.4"
PRETTY_NAME="Poky (Yocto Project Reference Distro) 3.0.4 (zeus)"
它有 ptp4l 2.0 版
奴隶
电脑 它只有软件时间戳 操作系统:
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
我正在为主人使用这个命令
taskset -c 1 chrt 99 ptp4l -i eno1 -mq
此命令用于从站
sudo taskset -c 1 chrt 99 ptp4l -S -i enp3s0f1 -mq -s
它给了我非常高的主偏移、频率和路径延迟值,它在 MASTER_CLOCK_SELECTED 上进入状态 s2 SLAVE,但只有几秒钟。它给出了以下错误
ptp4l[7632.725]: master offset 1611850007215613701 s2 freq +100000000 path delay 17013783
ptp4l[7633.625]: master offset 1611850007110097044 s2 freq +100000000 path delay 22519248
ptp4l[7634.525]: clockcheck: clock jumped forward or running faster than expected!
ptp4l[7634.525]: master offset 1611850010370484934 s0 freq +100000000 path delay 22519248
ptp4l[7634.525]: port 1: SLAVE to UNCALIBRATED on SYNCHRONIZATION_FAULT
ptp4l[7635.425]: master offset 1611850010270476347 s0 freq +100000000 path delay 22519248
ptp4l[7636.325]: master offset 1611850010167504974 s0 freq +100000000 path delay 25493617
git的linuxptp仓库里有一定的配置文件,我试过用gPTP.cfg文件来配置ptpt4l,用命令 给大师
taskset -c 1 chrt 99 ptp4l -f gPTP.cfg -i eno1 -mq
为了奴隶
sudo taskset -c 1 chrt 99 ptp4l -S -f gPTP.cfg -i enp3s0f1 -mq -s
但最糟糕的是SLAVE根本不尝试同步
ptp4l[8748.087]: selected local clock b82a72.fffe.9ac430 as best master
ptp4l[8751.360]: selected local clock b82a72.fffe.9ac430 as best master
ptp4l[8754.814]: selected local clock b82a72.fffe.9ac430 as best master
我不确定问题是因为它们的时间戳不同,还是我必须提供任何配置文件或参数。
你能帮忙解决这个问题吗?
提前致谢
解决方法
此问题已通过以下方式解决
- 关闭两个系统中的 NTP 服务
timedatectl set-ntp false
sudo systemctl stop systemd-timedated.service
sudo systemctl stop systemd-timesyncd
- 使用以下命令同步网卡中的时间,eno1为接口。小心这一点,因为 NIC 的时间可能与系统时钟不同,并且可能会产生问题。考虑到 eno1 是您进行同步的界面
phc2sys -c eno1 -O 0 -w -m -s CLOCK_REALTIME
- 打开 phc2sys,使其系统时钟与接口的 ptp 时钟同步
phc2sys -s eno1 -m -w
- 在 master 中打开 ptp4l
ptp4l -i eno1 -mq -2
- 开启slave端的ptp4l
ptp4l -S -i enp3s0f1 -mq -s -2
ptp4l中的选项-2(IEEE 802.3或以太网),可以改为-4(UDP IPV4)或-6(UDP IPV6)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。