Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to debug 1588 single-step timestamp message under Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how to debug 1588 single-step timestamp message under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In the past few days, I have been implementing the IEEE 1588 single-step timestamp driver for a network controller, and it has been completed after several debugging. By the way, share the debugging method, of course, if you want to play 1588 single-step timestamp, you must first have a hardware platform that supports this function. If you don't know about the single step timestamp of 1588 messages, you can check out my previous article, "IEEE 1588 Sync message single step timestamps".

Platforms and tools

The platform I use will not be disclosed. The test uses two boards and the network port is directly connected. The software used includes

Linux: this is the OS of my board, including the driver I want to verify. Tcpdump: package grabbing tool, located on the file system of the board. Linuxptp: open source PTP software, located on the board's file system. The software on the Wireshark,Windows computer is used to view the package capture files. Debug method two board net ports are directly connected to start Linux. Configure the IP address to ensure that the two network ports can ping. A board to receive, run tcpdump grab package, can be viewed directly, can also be saved as a pcap file in Wireshark to open and view. Another board to send, run ptp4l to do master, send a single-step Sync message. Sender command

Use L2 Ethernet protocol, run ptp4l to do master, and send a single-step timestamp Sync message

# ptp4l-I eth0-m-twoStepFlag=0-2

Ptp4l [613.615]: selected / dev/ptp0 as PTP clock

Ptp4l [613.652]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE

Ptp4l [613.653]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE

Ptp4l [619.801]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES

Ptp4l [619.802]: selected local clock 00e00c.fffe.001600 as best master

Ptp4l [619.802]: port 1: assuming the grand master role

Use UDP/IPv4 protocol, run ptp4l to do master, and send a single-step timestamp Sync message

# ptp4l-I eth0-m-twoStepFlag=0

Ptp4l [636.150]: selected / dev/ptp0 as PTP clock

Ptp4l [636.152]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE

Ptp4l [636.153]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE

Ptp4l [643.497]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES

Ptp4l [643.497]: selected local clock 00e00c.fffe.001600 as best master

Ptp4l [643.497]: port 1: assuming the grand master role

Recipient commands and results

Use tcpdump to view the complete data of the received message directly

# tcpdump-I eth0-xx

You can see that the values of the correctionField and originTimestamp fields of the L2 Ethernet message and the UDP/IPv4 message and the PTP message are parsed directly.

L2 Ethernet:

UDP/IPv4:

Concluding remarks

The hardware timestamp sent by the Sync message should be originTimestamp and correctionField. According to the 1588 standard, the time stamp difference between the originTimestamp and the actual sending hardware cannot exceed 1s, so for specific hardware, if the originTimestamp is filled in by the software before sending the message, it must be sent immediately after it is filled in, so that the correctionField cannot exceed 1s. The current hardware verification is this kind of implementation, so it should be reasonable to have more correctionField in 2us. If the hardware supports writing back the timestamp while doing the single-step timestamp, you can compare the write-back timestamp with the single-step timestamp (originTimestamp + correctionField). If it is equal, it means there is nothing wrong with the hardware.

This is the end of the content of "how to debug the 1588 single-step timestamp message under Linux". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report