Time synchronization—Introduction to TSN protocol 802.1AS
The previous topic TSN development history and current status of the protocol family introduced the origin of TSN technology. The latest topic TSN protocol introduction helps everyone understand the TSN protocol family from four aspects: timing and synchronization, delay, reliability, and resource management. Which sub-protocols, and the roles and functions of these sub-protocols. I believe everyone already has an overall concept of TSN technology.
Time synchronization is undoubtedly very important as the basis of many TSN protocols. Today I will give you an in-depth understanding of how 802.1AS achieves time synchronization in the TSN protocol suite.
Basic introduction to the protocol
The 802.1AS Generalized Precision Time Protocol will enable precise time measurement in fields such as automobiles and industrial automation control. This chapter will start with the basic concepts and measurement methods, then introduce the time synchronization process, and finally introduce the new features of 802.1AS and the automotive field profile.
802.1AS concept
Basic composition
In 802.1AS, time synchronization is divided according to "domain" and includes multiple PTP nodes. Among these PTP nodes, there is only one global master node (GrandMaster PTP Instance), which is responsible for providing clock information to all other slave nodes.
PTP nodes are divided into two categories: PTP End Instance (PTP end node) and PTP Relay Instance (PTP switching node) . in:
-
PTP End Instance either acts as GrandMaster or receives time synchronization information from GrandMaster
-
PTP Relay Instance receives time synchronization information from a certain interface, corrects the time synchronization information, and forwards it to other interfaces.
Selection of GrandMaster
Message type
802.1AS includes two types (Message class) General message and Event message. The difference between the two is that when sending or receiving an Event message, the corresponding timestamp will be recorded, but General message will not. General messages include Announce, Signaling, Follow_Up, and Pdelay_Resp_Follow_Up, and Event messages include Sync, Pdelay_Req, and Pdelay_Resp.
802.1AS measurement process
In order to synchronize the local clock of the slave node with the GrandMaster clock, three factors need to be considered:
-
clock frequency error
-
link delay
-
dwell time
Clock frequency error means that the local clock frequency of the PTP slave node is likely to be different from the GrandMaster's main clock frequency, and there are also errors between PTP slave nodes, which results in different time measurement bases, thereby introducing errors.
Link delay (MeanLinkDelay) refers to the time required for the communication link between two PTP nodes to propagate in one direction, also known as the link average propagation time (Mean Propagation Delay).
Residence time refers to the time it takes for the PTP Relay Instance to forward the received message, that is, the time the message stays in the Relay.
Clock frequency error measurement
In order to eliminate this error, 802.1AS uses a cumulative calculation method of the ratio of adjacent node clock frequencies (NeighborRateRatio) to convert the local timebase (Local Clock Timebase) into (GrandMaster Timebase).
For example, the clock frequency of GrandMaster is 1MHz, while the clock frequency of the adjacent PTP slave node (A) has a deviation of 1.3MHz. For node A, NeighborRateRatio is equal to 1.3. When the local clock of node A takes 2.6 seconds, use NeighborRateRatio to convert it to the GrandMaster time base, and then the master clock takes 2 seconds. For node B adjacent to A, assuming its clock frequency is 0.9MHz, the accumulated NeighborRateRatio is equal to 0.9 (1.3/1.0×0.9/1.3). When the local clock of node B takes 3s, the main clock takes 2.7s.
Link delay measurement
In 802.1AS, the link delay is measured using the P2P measurement mechanism (Peer-to-Peer delay Mechanism). Assuming that the round-trip delay of the link is consistent (the link is symmetrical), by measuring four precise timestamps, the calculation result for a section of the link is link delay (MeanLinkDelay).
-
For a link, there are two PTP nodes. Among them, the Peer delay initiator (initiator) will actively send out a Pdelay_Req message, and the node that receives the Pdelay_Req message is called a Peer delay responder (responder).
-
The actual sending timestamp t1 of the Pdelay_Req message will be recorded on the initiator side, and the actual receiving timestamp t2 of the message will be recorded on the responder side.
-
After receiving the Pdelay_Req, the responder will reply with a Pdelay_Resp message to the initiator. This message will contain the information t2.
-
The Pdelay_Resp sending timestamp t3 will be recorded on the responder side, and the receiving timestamp t4 will be recorded on the initiator side.
-
The responder will send a Pdelay_Resp_Follow_Up message to the initiator after Pdelay_Resp to contain information t3
-
At this point, there are four precise timestamps t1, t2, t3, and t4 on the initiator side. By calculating t2-t1 and t4-t3, we can get the two-direction (i->r, r->i) propagation of this link. time (tir, tri), and then average it, you can get the link delay (MeanLinkDelay)
-
The nodes of both parties performing P2P measurements will alternately serve as initiators, so that both parties can obtain the link delay (MeanLinkDelay).
Dwell time measurement
The residence time is introduced by PTP Relay Instance, which refers to the time that the message stays in the Relay. It is relatively simple to eliminate its impact, which is to record this dwell time in the correction field in the forwarded Follow_Up message. When other PTP nodes receive the message, they can calculate the correct time offset.
Time synchronization implementation process
After the GrandMaster is established through manual configuration or BMCA in 802.1AS, the GrandMaster periodically sends Sync and Follow_Up messages to provide the master clock reference; before realizing node synchronization, each PTP node negotiates through Signaling messages to calculate the NeighborRateRatio interval, calculate the MeanLinkDelay interval and other information ; Finally, each PTP slave node uses the existing NeighborRateRatio, MeanLinkDelay and the received Sync and Follow_Up messages, and uses the correctionField information in the Follow_Up message to correct it, to get the current time of the master clock, thereby completing time synchronization.
New features in 2020 version
In the new version of 802.1AS-2020, several important new features have been added, such as: multi-domain redundancy, support for "one-step method", etc. Let’s take a brief look at these features.
Multi-domain redundancy
This picture shows the multi-domain redundancy characteristics very well, which is mainly divided into two ways:
-
The same GM (global master node) divides multiple domains and generates a synchronization tree (i.e., synchronization path) for each domain to achieve redundancy.
-
Multiple GMs, each GM maintains a domain to generate a synchronization tree. Multiple GMs are divided into primary and secondary. The secondary GM is synchronized with the primary GM. This method is also called hot-standby.
"One step method"
The so-called "one-step method" (also called "on-the-fly") means that while sending the message, the sending timestamp close to the physical layer is added to the message and sent directly, so that the required information is Putting it in a frame of message is more efficient, but requires additional hardware support. For the receiving node, the ability to parse the "one-step" message is also required.
Automotive field profile
802.1AS can achieve precise time measurement in the automotive field, industrial automation control and other fields. The profile for the automotive field has not yet been officially released. This content will be reflected in 802.1dg. At that time, we will provide an in-depth interpretation of it.
The above is the entire introduction to the 802.1AS protocol. More interpretations of the TSN protocol will be provided in the future, so stay tuned.
WeChat ID: Polelink_Info