nvidia xavier nx平台上精确时间协议(PTP)调试记录3
1. 前言
承接上篇
https://www.ebaina.com/articles/140000012552
2. agx平台正常工作如下
将此文件保存为/boot/pps.dts
/dts-v1/;
/plugin/;
/ {
overlay-name = "Jetson PPS";
compatible = "nvidia,p3509-0000+p3668-0001";
fragment {
target-path = "/";
__overlay__ {
pps: pps_gpio {
compatible = "pps-gpio";
gpios = <&tegra_main_gpio 148 1>;
assert-falling-edge;
status = "okay";
};
};
};
};
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
将gpio更改为GPIO09,这是40引脚头上的第7引脚,因为GPS帽我已经将PPS信号硬线到那个引脚。
将dts编译成dtb
cd /boot
$ sudo dtc -I dts -O dtb -@ -o pps.dtbo pps.dts
- 1
- 2
从库存dtb和pps.dtbo创建一个自定义dtb
sudo fdtoverlay -i tegra194-p3668-all-p3509-0000.dtb -o tegra194-p3668-all-p3509-0000-user-custom.dtb tegra194-p3668-all-p3509-0000-hdr40.dtbo pps.dtbo
- 1
现在编辑/boot/extlinux/extlinux.conf,
并将以下行添加到菜单项中…
LINUX ...
INITRD ...
FDT /boot/tegra194-p3668-all-p3509-0000-user-custom.dtb
APPEND ...
- 1
- 2
- 3
- 4
现在重新启动。
当系统恢复运行时,应该有一个/dev/pps0设备。
将PPS源代码连接到pin 7并安装了PPS -tools包,
应该能够运行
$ sudo ppstest /dev/pps0
trying PPS source "pps0"
found PPS source "pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1592529430.097600543, sequence: 2333 - clear 0.000000000, sequence: 0
source 0 - assert 1592529431.097604009, sequence: 2334 - clear 0.000000000, sequence: 0
source 0 - assert 1592529432.097600339, sequence: 2335 - clear 0.000000000, sequence: 0
source 0 - assert 1592529433.097601277, sequence: 2336 - clear 0.000000000, sequence: 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
下一步取决于希望如何同步内核时间,
以便ptpd可以发送内核时间
我用ntpd取两个源
第一个是可靠的上游ntp服务器
第二个是通用的nmea源,它接受来自gps单元的nmea句子和pps信号
一旦内核被同步,ptpd就可以被设置为主服务器
3.将sdcard安装到另一个设备上
/media/boot$ ls
dtb tegra186-quill-p3310-1000-c03-00-base-hdr40.dtbo
extlinux tegra186-quill-p3310-1000-c03-00-dsi-hdmi-dp.dtb
grub tegra186-quill-p3489-0888-a00-00-base.dtb
Image tegra186-quill-p3489-1000-a00-00-ucm1.dtb
Image.sig tegra186-quill-p3489-1000-a00-00-ucm2.dtb
initrd tegra194-p2888-0001-p2822-0000-adafruit-sph0645lm4h.dtbo
initrd.img tegra194-p2888-0001-p2822-0000.dtb
initrd.img-4.9.140-tegra tegra194-p2888-0001-p2822-0000-fe-pi-audio-z-v2.dtbo
pps.dtbo tegra194-p2888-0001-p2822-0000-hdr40.dtbo
pps.dts tegra194-p2888-0001-p2822-0000-maxn.dtb
tegra186-quill-p3310-1000-a00-00-base.dtb tegra194-p3668-all-p3509-0000-adafruit-sph0645lm4h.dtbo
tegra186-quill-p3310-1000-as-0888.dtb tegra194-p3668-all-p3509-0000.dtb
tegra186-quill-p3310-1000-c03-00-base-adafruit-sph0645lm4h.dtbo tegra194-p3668-all-p3509-0000-fe-pi-audio-z-v2.dtbo
tegra186-quill-p3310-1000-c03-00-base.dtb tegra194-p3668-all-p3509-0000-hdr40.dtbo
tegra186-quill-p3310-1000-c03-00-base-fe-pi-audio-z-v2.dtbo tegra194-p3668-all-p3509-0000-user-custom.dtb
xavier@agx:/media/boot$ cat extlinux/extlinux.conf
TIMEOUT 30
DEFAULT primary
MENU TITLE L4T boot options
LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/tegra194-p3668-all-p3509-0000-user-custom.dtb
APPEND ${cbootargs} quiet
# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
# sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot
# LABEL backup
# MENU LABEL backup kernel
# LINUX /boot/Image.backup
# INITRD /boot/initrd
# APPEND ${cbootargs}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
检查文件系统和日志不会提供任何提示。
cat pps.dts
/dts-v1/;
/plugin/;
/ {
overlay-name = "Jetson PPS";
compatible = "nvidia,p3509-0000+p3668-0001";
fragment {
target-path = "/";
__overlay__ {
pps: pps_gpio {
compatible = "pps-gpio";
gpios = <&tegra_main_gpio 148 1>;
assert-falling-edge;
status = "okay";
};
};
};
};
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
4. 按照上述步骤运行
sudo /opt/nvidia/jetson-io/config-by-hardware.py -l
Configurations for the following hardware modules are available:
1. Adafruit SPH0645LM4H
2. FE-PI Audio Z V2
3. Jetson PPS
**
**
- 1
- 2
- 3
- 4
- 5
- 6
- 7
sudo /opt/nvidia/jetson-io/config-by-hardware.py -n "Jetson PPS"
Configuration saved to /boot/tegra194-p3668-all-p3509-0000-jetson-pps.dtb.
then Reboot.
Then
- 1
- 2
- 3
- 4
ls /dev/pp
ppp pps0
- 1
- 2
$ sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)
time_pps_fetch() error -1 (Connection timed out).
- 1
- 2
- 3
- 4
- 5
- 6
是否需要把时间脉冲线连接到7号引脚上?
否则将不会启动
5. 如何将pps0输出转发到linuxptp
从硬件的角度来看,是否需要从PPS源连接一根线?
引脚N7?PPS来源的两根电线?
引脚N7和其他一些引脚?
肯定是需要物理连接的
我所做的是将GPS的PPS输出连接到脚7
GPS的TXD连接到脚10
GPS的RXD连接到脚8
这允许ntpd从gps获取NMEA语句来设置日期和时间,而PPS则同步秒数。
以下udev规则将创建正确的/dev符号链接
KERNEL=="ttyTHS0", SYMLINK+="gps0"
KERNEL=="pps0", MODE="0660", SYMLINK+="gpspps0"```c
KERNEL=="ttyTHS0", SYMLINK+="gps0"
KERNEL=="pps0", MODE="0660", SYMLINK+="gpspps0"
- 1
- 2
- 3
- 4
conf中的这些条目将告诉ntpd同时使用NMEA语句和PPS…
server 127.127.20.0 mode 80 minpoll 3 burst iburst prefer
fudge 127.127.20.0 stratum 1 flag1 1 flag2 0 flag3 1 flag4 0 time1 0.0 time2 0.095 refid GPP0
- 1
- 2
需要对time2值进行一点调整(参见ntp文档)
ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
0.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
1.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
2.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
3.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
ntp.ubuntu.com .POOL. 16 p - 64 0 0.000 0.000 0.000
GPS_NMEA(0) .GPP0. 1 l - 8 0 0.000 0.000 0.000
+time.nullrouten 132.163.97.1 2 u 11 64 1 78.194 0.584 1.964
+159.203.82.102 225.254.30.190 4 u 12 64 1 13.616 0.098 1.958
#time.gac.edu 127.67.113.92 2 u 12 64 1 44.552 -1.930 1.933
+atl0.jane.mattn 159.203.158.197 3 u 11 64 1 27.501 0.242 2.295
+mirror1.sjc02.s 216.218.254.202 2 u 9 64 1 82.024 2.156 3.990
+50-205-244-109- 50.205.244.28 2 u 10 64 1 30.418 2.101 2.553
+undef.us 198.82.247.51 3 u 8 64 1 41.361 1.437 2.649
+dev.smatwebdesi 204.9.54.119 2 u 10 64 1 46.248 1.869 2.544
+srcf-ntp.stanfo 171.64.7.105 2 u 8 64 1 80.683 0.557 2.083
alphyn.canonica 132.163.97.1 2 u 16 64 1 4.576 -2.268 0.000
+cmpublishers.co 209.51.161.238 2 u 10 64 1 27.733 0.665 3.785
#li290-38.member 199.102.46.72 2 u 7 64 1 46.609 -3.801 3.020
+LAX.CALTICK.NET 72.29.161.5 2 u 7 64 1 70.200 2.860 2.647
+199.102.46.79 ( .GPS. 1 u 6 64 1 34.969 0.075 1.991
*ntp2.wiktel.com .GPS. 1 u 7 64 1 46.731 1.271 2.434
golem.canonical 145.238.203.14 2 u 16 64 1 77.500 -1.331 0.000
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
似乎不起作用
dev/gps0和/dev/gpspps0是否存在,是否分别链接到/dev/ttyTHS0和/dev/pps0 ?
是否能看到来自/dev/ttyTHS0的NMEA句子吗?
ppstest /dev/pps0是否显示事件?
ls /dev/gps
gps0 gpspps0
cat /dev/ttyTHS0
- 1
- 2
- 3
- 4
stty < /dev/ttyTHS0
speed 115200 baud; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>; start = <undef>; stop = <undef>; susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>; discard = <undef>;
ignbrk -brkint -imaxbel
-opost -onlcr
-isig -iexten -echo -echoe -echok -echoctl -echoke
- 1
- 2
- 3
- 4
- 5
- 6
6.ntp软件问题
Ubuntu 18的ntpd版本有一个问题。
可能需要获取最新的ntp源并编译自己的ntp源。
- 分享
- 举报

-
浏览量:9599次2021-05-25 17:31:40
-
浏览量:7239次2021-05-20 16:37:42
-
浏览量:8117次2021-05-25 15:32:16
-
浏览量:9436次2021-05-19 17:32:00
-
浏览量:7596次2021-05-11 17:51:48
-
浏览量:8784次2021-05-14 14:43:43
-
浏览量:9596次2021-04-27 17:56:41
-
浏览量:9765次2021-05-26 14:17:15
-
浏览量:7999次2021-06-09 14:49:23
-
2021-05-06 16:03:00
-
浏览量:11079次2021-05-06 16:22:01
-
浏览量:9616次2021-07-21 16:55:40
-
浏览量:6627次2021-04-21 17:42:58
-
浏览量:5341次2021-05-10 17:48:42
-
浏览量:7216次2021-05-11 17:04:57
-
浏览量:5308次2021-07-09 15:23:33
-
2021-04-23 15:54:21
-
浏览量:7371次2021-07-31 15:26:23
-
浏览量:8092次2021-06-04 16:25:58
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
free-jdx






举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明