MPSoC的MAC支持1588。在Linux Kernel的配置項(xiàng)中使能CONFIG_MACB_USE_HWSTAMP,并在Linux rootfs添加Linux ptp/ethtool,就可以運(yùn)行1588的軟件命令ptp4l。
PetaLinux下,配置Linux rootfs命令是petalinux-config -c rootfs。1588在Linux用戶態(tài)的應(yīng)用程序軟件包是Linuxptp,可執(zhí)行文件是ptp4l。

1. 在zcu106之間運(yùn)行1588
下面的命令,在zcu106之間運(yùn)行1588。運(yùn)行順序是先在第一塊單板(master)啟動1588 master;再在第二塊單板(slave)上啟動1588 slave;接下來在第一塊單板(master)終止1588 master,模擬1588 master故障;最后再在第一塊單板(master)啟動1588 master。
1.1. master
1588 master的命令是ptp4l -i eth0 -m。運(yùn)行記錄如下:
root@zcu106_vcu_trd:~# # master root@zcu106_vcu_trd:~# uname -a Linux zcu106_vcu_trd 5.4.0-xilinx-v2020.2 #1 SMP Wed Feb 24 10:06:51 UTC 2021 aarch64 GNU/Linux root@zcu106_vcu_trd:~# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:0A:35:04:D2:38 inet addr:10.164.16.102 Bcast:10.164.16.255 Mask:255.255.255.0 inet6 addr: fe80::20a:35ff:fe04:d238/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:381 errors:0 dropped:0 overruns:0 frame:0 TX packets:438 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:37123 (36.2 KiB) TX bytes:49863 (48.6 KiB) Interrupt:31 root@zcu106_vcu_trd:~# ptp4l -i eth0 -m ptp4l[577.050]: selected /dev/ptp0 as PTP clock ptp4l[577.051]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[577.051]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[583.599]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[583.599]: selected local clock 000a35.fffe.04d238 as best master ptp4l[583.600]: assuming the grand master role ^C root@zcu106_vcu_trd:~# ptp4l -i eth0 -m ptp4l[637.574]: selected /dev/ptp0 as PTP clock ptp4l[637.575]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[637.575]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[644.708]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[644.708]: selected local clock 000a35.fffe.04d238 as best master ptp4l[644.708]: assuming the grand master role ^Croot@zcu106_vcu_trd:~#
上面的1588 master,先啟動,再停止,再啟動。
1.2. slave
1588 slave的命令是ptp4l -i eth0 -s -m。運(yùn)行記錄如下:
root@zcu106_vcu_trd:~# # slave
root@zcu106_vcu_trd:~# uname -a
Linux zcu106_vcu_trd 5.4.0-xilinx-v2020.2 #1 SMP Wed Feb 24 10:06:51 UTC 2021 aarch64 GNU/Linux
root@zcu106_vcu_trd:~# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 06:51:E5:C2:71:88
inet addr:10.164.16.8 Bcast:10.164.16.255 Mask:255.255.255.0
inet6 addr: fe80::451:e5ff:fec2:7188/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:880 errors:0 dropped:26 overruns:0 frame:0
TX packets:484 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:62884 (61.4 KiB) TX bytes:51650 (50.4 KiB)
Interrupt:31
root@zcu106_vcu_trd:~# ptp4l -i eth0 -s -m
ptp4l[577.398]: selected /dev/ptp0 as PTP clock
ptp4l[577.399]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[577.399]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[577.755]: port 1: new foreign master 000a35.fffe.04d238-1
ptp4l[581.755]: selected best master clock 000a35.fffe.04d238
ptp4l[581.755]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[583.754]: master offset -701 s0 freq +4079 path delay 2992
ptp4l[584.754]: master offset -957 s2 freq +3823 path delay 3037
ptp4l[584.754]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[585.754]: master offset -727 s2 freq +3096 path delay 3037
ptp4l[586.754]: master offset 430 s2 freq +4035 path delay 3035
ptp4l[587.754]: master offset 437 s2 freq +4171 path delay 3034
ptp4l[588.754]: master offset 351 s2 freq +4216 path delay 3035
ptp4l[589.754]: master offset 222 s2 freq +4192 path delay 3035
ptp4l[590.754]: master offset -108 s2 freq +3929 path delay 3047
ptp4l[605.754]: master offset 229 s2 freq +4239 path delay 3019
ptp4l[606.754]: master offset 18 s2 freq +4096 path delay 3035
ptp4l[607.754]: master offset -156 s2 freq +3928 path delay 3035
ptp4l[615.730]: port 1: SLAVE to LISTENING on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[615.731]: selected local clock 0651e5.fffe.c27188 as best master
ptp4l[621.758]: selected local clock 0651e5.fffe.c27188 as best master
ptp4l[629.169]: selected local clock 0651e5.fffe.c27188 as best master
ptp4l[635.881]: selected local clock 0651e5.fffe.c27188 as best master
ptp4l[638.863]: selected best master clock 000a35.fffe.04d238
ptp4l[638.863]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[640.862]: master offset 4627 s2 freq +8664 path delay 2932
ptp4l[640.862]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[641.862]: master offset -22 s2 freq +5403 path delay 2978
ptp4l[642.862]: master offset -2147 s2 freq +3271 path delay 3580
ptp4l[643.862]: master offset -868 s2 freq +3906 path delay 3279
ptp4l[644.862]: master offset -644 s2 freq +3870 path delay 3019
ptp4l[645.862]: master offset -402 s2 freq +3919 path delay 2978
ptp4l[646.863]: master offset -103 s2 freq +4097 path delay 2978
ptp4l[647.863]: master offset -157 s2 freq +4012 path delay 3001
ptp4l[648.863]: master offset -350 s2 freq +3772 path delay 3042
ptp4l[649.863]: master offset 126 s2 freq +4143 path delay 3021
ptp4l[650.863]: master offset 40 s2 freq +4095 path delay 3021
在1588 slave的打印中可以看到,slave先選擇外部時(shí)鐘master 000a35.fffe.04d238。當(dāng)外部master退出后,再選擇了本地時(shí)鐘,0651e5.fffe.c27188。當(dāng)外部master正常后,又選擇了外部時(shí)鐘master 000a35.fffe.04d238。
時(shí)鐘的標(biāo)識,是網(wǎng)卡的MAC地址。
master offset表示主從端時(shí)間差,單位是ns。s0,s1,s2 : 表示1588的不同狀態(tài),s0表示未鎖定,s1表示正在同步,s2表示鎖定。
2. PC機(jī)上運(yùn)行1588
也可以在PC機(jī)上運(yùn)行1588。首先在master和slave的PC機(jī)安裝1588的Linux用戶態(tài)應(yīng)用程序,Linuxptp。
hankf@XSZGS4:~$ sudo apt install linuxptp Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libfwup1 libllvm9 linux-hwe-5.4-headers-5.4.0-51 linux-hwe-5.4-headers-5.4.0-52 linux-hwe-5.4-headers-5.4.0-53 linux-hwe-5.4-headers-5.4.0-56 linux-hwe-5.4-headers-5.4.0-58 linux-hwe-5.4-headers-5.4.0-59 linux-hwe-5.4-headers-5.4.0-60 linux-hwe-5.4-headers-5.4.0-62 linux-hwe-5.4-headers-5.4.0-65 linux-hwe-5.4-headers-5.4.0-66 linux-hwe-5.4-headers-5.4.0-67 Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: linuxptp 0 upgraded, 1 newly installed, 0 to remove and 18 not upgraded. Need to get 112 kB of archives. After this operation, 418 kB of additional disk space will be used. Get:1 http://hk.archive.ubuntu.com/ubuntu bionic/universe amd64 linuxptp amd64 1.8-1 [112 kB] Fetched 112 kB in 3s (33.0 kB/s) Selecting previously unselected package linuxptp. (Reading database ... 477696 files and directories currently installed.) Preparing to unpack .../linuxptp_1.8-1_amd64.deb ... Unpacking linuxptp (1.8-1) ... Setting up linuxptp (1.8-1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
2.1. master
然后運(yùn)行1588 master。
hankf@XSZGS4:~$ sudo ptp4l -i ens12f2 -m [sudo] password for hankf: ptp4l[4247020.499]: selected /dev/ptp4 as PTP clock ptp4l[4247020.500]: driver changed our HWTSTAMP options ptp4l[4247020.500]: tx_type 1 not 1 ptp4l[4247020.500]: rx_filter 1 not 12 ptp4l[4247020.500]: port 1: INITIALIZING to LISTENING on INITIALIZE ptp4l[4247020.500]: port 0: INITIALIZING to LISTENING on INITIALIZE ptp4l[4247020.501]: port 1: link up ptp4l[4247028.079]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[4247028.079]: selected best master clock 6c92bf.fffe.ccc500 ptp4l[4247028.079]: assuming the grand master role ^C hankf@XSZGS4:~$
2.2. Slave
運(yùn)行1588 Slave。
xilinx@xszgs2:~$ ifconfig eno3
eno3: flags=4163 mtu 1500
inet 10.164.177.202 netmask 255.255.255.0 broadcast 10.164.177.255
inet6 fe80::f56c:dc30:fa49:b101 prefixlen 64 scopeid 0x20
ether d0:94:66:55:0d:e9 txqueuelen 1000 (Ethernet)
RX packets 39897217 bytes 48144750947 (48.1 GB)
RX errors 107 dropped 6 overruns 107 frame 0
TX packets 14982002 bytes 4367094180 (4.3 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 42 memory 0x9e800000-9effffff
xilinx@xszgs2:~$ ptp4l -i eno3 -s -m
ptp4l[3650610.080]: selected /dev/ptp2 as PTP clock
ptp4l[3650610.081]: Failed to open /dev/ptp2: Permission denied
failed to create a clock
xilinx@xszgs2:~$ sudo ptp4l -i eno3 -s -m
ptp4l[3650613.052]: selected /dev/ptp2 as PTP clock
ptp4l[3650613.071]: port 1: INITIALIZING to LISTENING on INITIALIZE
ptp4l[3650613.071]: port 0: INITIALIZING to LISTENING on INITIALIZE
ptp4l[3650613.072]: port 1: link up
ptp4l[3650614.597]: port 1: new foreign master 6c92bf.fffe.ccc500-1
ptp4l[3650618.597]: selected best master clock 6c92bf.fffe.ccc500
ptp4l[3650618.597]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[3650620.597]: master offset -496821638515 s0 freq +0 path delay 25928
ptp4l[3650621.597]: master offset -496821663985 s1 freq -25469 path delay 22934
ptp4l[3650622.597]: master offset -3011 s2 freq -28480 path delay 22934
ptp4l[3650622.599]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[3650623.596]: master offset 6729 s2 freq -19643 path delay 13071
ptp4l[3650624.596]: master offset -2000 s2 freq -26353 path delay 13071
ptp4l[3650625.596]: master offset -4376 s2 freq -29329 path delay 13297
ptp4l[3650626.596]: master offset -3468 s2 freq -29734 path delay 13071
ptp4l[3650627.596]: master offset -2191 s2 freq -29498 path delay 13071
ptp4l[3650628.596]: master offset -994 s2 freq -28958 path delay 12936
ptp4l[3650629.596]: master offset -435 s2 freq -28697 path delay 12874
ptp4l[3650630.596]: master offset -380 s2 freq -28773 path delay 12874
ptp4l[3650631.596]: master offset -176 s2 freq -28683 path delay 12874
ptp4l[3650632.596]: master offset 161 s2 freq -28398 path delay 12874
在1588 slave的打印中可以看到,PC機(jī)上slave報(bào)告的master offset和path delay,都遠(yuǎn)遠(yuǎn)大于在zcu106之間運(yùn)行1588的數(shù)據(jù)。
-
Linux
+關(guān)注
關(guān)注
88文章
11622瀏覽量
217824 -
GEM
+關(guān)注
關(guān)注
0文章
9瀏覽量
6854 -
MPSoC
+關(guān)注
關(guān)注
0文章
202瀏覽量
25051
發(fā)布評論請先 登錄
ieee 1588
IEEE 1588助力下一代測試測量系統(tǒng)設(shè)計(jì)
如何利用ZYNQ MPSoC玩DOOM?
請問Zynq Ultrascale + MPSOC本身是否存在問題?
IEEE1588協(xié)議及測試技術(shù),總結(jié)的太到位了
金南瓜SECS/GEM:PLC與MES工具分享
SECS/GEM標(biāo)準(zhǔn)模型分析及應(yīng)用
IEEE1588及其測試方法簡介[圖]
IEEE 1588協(xié)議在構(gòu)建測試與測量系統(tǒng)中的好處及重要性
MPSoC Linux工程寒設(shè)計(jì) DMA測試軟件編譯結(jié)果
如何在zcu106之間運(yùn)行1588?
ASSET快速測試和編程工具簡化MPSoC系統(tǒng)的生產(chǎn)
一文讀懂 | SECS/GEM 通信基礎(chǔ)及 GEM 控制狀態(tài)模型

測試MPSoC GEM的1588功能
評論