Article count:1511 Read by:4580472

Account Entry

Time synchronization—Introduction to TSN protocol 802.1AS

Latest update time:2021-03-12
    Reads:


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


In addition to manual settings, GrandMaster selection can be automatically selected by comparing the attributes of each PTP node. This strategy is BMCA (Best Master Clock Algorithm).

During the establishment of BMCA, each PTP node first puts its own clock attributes (such as clock source) and interface information into the Announce message and sends it to all nodes in the gPTP domain. Then the PTP node compares itself with the received clock attributes. The PTP node with high priority automatically becomes the 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.


The Announce message contains clock-related information, and during transmission, the Id of each PTP node along the path will be recorded and added to the path trace TLV; the Signaling message contains information supported by the PTP node, such as whether it supports "one-step method" and allowed Announce messages. Interval, etc.; Sync messages are sent by GrandMaster and contain master clock information. Other nodes calculate the difference between the local clock and the master clock to achieve synchronization; Follow_Up and Pdelay_Resp_Follow_Up are messages that provide supplementary timestamps in the "two-step method". The former It is used in conjunction with Sync, which is used in conjunction with Pdelay_Resp; finally, Pdelay_Req and Pdelay_Resp together form the basis of the P2P measurement mechanism, which will be explained in detail in subsequent chapters.



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).

Using the P2P measurement mechanism, you can get the link delay of each segment in the gPTP domain. During the actual synchronization process, the PTP Relay Instance will record the cumulative link delay starting from GrandMaster in the correctionField in the Follow_Up message, and then forward it. ;At the same time, the correction of the asymmetric error (manually set parameter correction after passing the measurement) is also placed in the correctionField.


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.

In the figure, the end station in the upper left corner serves as the primary GM. It divides two domains and generates a synchronization tree (i.e., synchronization path, respectively, blue and light blue) for each domain. The end station in the lower right corner serves as the secondary GM. The GM is synchronized with the main GM. In addition, it is divided into two domains and generates synchronization trees (red and light red) for each domain. In this way, there are four domains and four synchronization trees in total, ensuring redundancy.


"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.

"Two-step method" Sync message
"One-step method" Sync message

In contrast, the "two-step method" only records the sending timestamp when the Sync or Pdelay_Resp message is sent, and then encapsulates this information in the Follow_Up or Pdelay_Resp_Follow_Up message and sends it, thus eliminating the need for additional hardware. Get precise timestamps with support.


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.




Note: Some of the above pictures come from
IEE 802.1AS-2020, ZhAw - IEEE 1588 Standard for a Precision Clock Synchr onization Protocol and Synchronous Ethernet, TSN Systems

About Beihui:

As a professional team that early explored the TSN field, Beihui Information is able to provide solutions for AVB/TSN network architecture, including application scenario design, requirement specification development, communication system design, and demonstration and verification system development; and provides system-level testing for AVB/TSN networks. Solutions include system test specification development, system test execution and demonstration; provide protocol family for AVB/TSN nodes.


WeChat ID: Polelink_Info

Beihui Information|Focus on electronic control, new energy, and MES technology
Click, click, like and watch are all here!


Latest articles about

 
EEWorld WeChat Subscription

 
EEWorld WeChat Service Number

 
AutoDevelopers

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building,Block B, 18 Zhongguancun Street, Haidian District,Beijing, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号