New site for testing

PTP IEEE 1588 Introduction

Base Station Stone 124℃ 0Comments

In a communication network, the normal operation of many services requires network clock synchronization, that is, the time or frequency difference between devices of the entire network which is kept within a reasonable error level. Network clock synchronization includes the following two concepts:

1. Time synchronization: also called phase synchronization, means that the frequency and phase between the signals are consistent, that is, the phase difference between the signals is always zero.

2 Frequency synchronization: also called clock synchronization, which means that the signal maintains a certain strict relationship between frequency and phase. The signals appear at the same average rate at their corresponding effective moments to ensure all the communication networks. The devices all operate at the same rate, ie a constant phase difference between the signals.

Figure 1 Time synchronization and frequency synchronization diagram

As shown in Figure 1, there are two tables, Watch A and Watch B. If the time of the two tables is consistent all the time, this state is time synchronization; if the time of the two tables is inconsistent, but keep a constant The difference (Watch B in the figure is always 6 hours later than WatchA), this state is frequency synchronization.

PTP (Precision Time Protocol) is a time-synchronized protocol that is used only for high-precision time synchronization between devices, but can also be borrowed for frequency synchronization between devices. Compared with the existing time synchronization mechanisms, PTP has the following advantages:

Compared with NTP (Network Time Protocol), PTP can meet the requirements of higher precision time synchronization: NTP can only achieve sub-second time synchronization accuracy, while PTP can reach sub-microsecond level.

Compared to GPS (Global Positioning System), PTP has lower construction and maintenance costs, and because it can get rid of GPS dependence, it also has special significance in national security.

Basic concept of PTP

1.PTP domain

We refer to the network to which the PTP protocol is applied as the PTP domain. There is only one synchronous clock in the PTP domain, and all devices in the domain are synchronized with this clock.

2. PTP port

We refer to the port on the device that runs the PTP protocol as the PTP port. As shown in Figure 2, the roles of PTP ports can be divided into the following three types:

Master Port: The port that publishes the synchronization time, which can exist on BC or OC.

Slave Port: The port that receives the synchronization time, which can exist on BC or OC.

Passive Port: A port that does not receive synchronization time or publish synchronization time. It only exists on BC.

3. Clock node

The nodes in the PTP domain are called clock nodes. The PTP protocol defines the following three types of basic clock nodes:

(1) OC (Ordinary Clock): This clock node has only one PTP port in the same PTP domain to participate in time synchronization, and synchronizes time from the upstream clock node through this port. In addition, when the clock node is used as the clock source, the time can be released to the downstream clock node through only one PTP port, which we also call OC.

(2) BC (Boundary Clock): This clock node has multiple PTP ports in the same PTP domain to participate in time synchronization. It synchronizes time from the upstream clock node through one of the ports and issues the time to the downstream clock node through the remaining ports. In addition, when the clock node is used as the clock source, the time can be issued to the downstream clock node through multiple PTP ports, which we also call BC, such as BC 1 in Figure 2.

(3) TC (Transparent clock): Compared with BC/OC, BC/OC needs to keep time synchronization with other clock nodes, while TC does not keep time synchronization with other clock nodes. The TC has multiple PTP ports, but it only forwards PTP protocol packets between these ports and performs forwarding delay correction on them, instead of synchronizing time through any one port. TC includes the following two types:

 E2ETC (End-to-End Transparent Clock): directly forwards the protocol packets of the non-P2P (Peer-to-Peer) type in the network and participates in the calculation of the delay of the entire link. .

P2PTC (Peer-to-Peer Transparent Clock): Forwards only Sync packets,

The Follow_Up packet and the Announce packet terminate other PTP protocol packets and participate in calculating the delay of each link on the entire link.

As shown in Figure 2, the location of the above three basic clock nodes in the PTP domain.

Figure 2 Basic clock node schematic

In addition to the above three basic clock nodes, there are some hybrid clock nodes, such as TC OCs that combine the characteristics of TC and OC: it has multiple PTP ports in the same PTP domain, one of which is OC type, and the other ports are For the TC type. On the one hand, it forwards PTP protocol packets through the TC type port and corrects the forwarding delay; on the other hand, it synchronizes the time through the OC type port. Similar to the classification of TC, TC OC also includes two types: E2ETC OC and P2PTC OC.

4.Master-slave relationship

The master-slave relationship is relatively speaking. For a pair of clock nodes that are synchronized with each other, the following master-slave relationship exists:
The node that issues the synchronization time is called the master node, and the node that receives the synchronization time is called the slave node.
The clock on the master node is called the master clock, and the clock on the slave node is called the slave clock.
The port that publishes the synchronization time is called the primary port, and the port that receives the synchronization time is called the secondary port.

5.Optimal clock

As shown in Figure 2, all clock nodes in the PTP domain are organized at a certain level. The reference time of the entire domain is the Grandmaster Clock (GM), which is the highest level clock. Through the interaction of PTP protocol packets between clock nodes, the optimal clock time will eventually be synchronized to the entire PTP domain, so it is also called the clock source.
The optimal clock can be statically specified by manual configuration or through the BMC (Best Master Clock) protocol.
Dynamic elections, the process of dynamic elections is as follows:

(1) The information such as the optimal clock priority, time level, and time precision carried in the Announce packets exchanged between the clock nodes finally selects a node as the optimal clock of the PTP domain, and at the same time, each The master-slave relationship between the nodes and the master-slave ports on each node are also determined. Through this process, a spanning tree with no loops, full connectivity, and rooted at the optimal clock is established in the entire PTP domain.

(2) After that, the master node periodically sends the Announce message to the slave node. If the slave node does not receive the Announce message sent by the master node within a certain period of time, the master node is considered to be invalid, and the optimal clock is re-executed choice.

PTP synchronization principle

The basic principle of PTP synchronization is as follows: The primary and secondary clocks exchange packets synchronously and record the time of sending and receiving packets. The time difference between the primary and secondary clocks is calculated by calculating the time difference between the primary and secondary clocks. (that is, the transmission delays are the same in both directions), then half of the total round trip delay is a one-way delay. This one-way delay is the clock deviation between the master and slave clocks, and the slave clock is adjusted according to the deviation. At local time, it can synchronize with the main clock.

The PTP protocol defines two propagation delay measurement mechanisms: the request response (Requset_Response) mechanism and the peer delay (Peer Delay) mechanism, and both mechanisms are referred to as network pairs.

1.Request response mechanism

Figure 3 request response mechanism implementation process

The request response mode is used for end-to-end delay measurement. As shown in Figure 3, the implementation process is as follows:
(1) The master clock sends a Sync message to the slave clock and records the transmission time t1. After receiving the message from the clock, the reception time t2 is recorded.
(2) After the master clock sends the Sync packet, it sends a Follow_Up packet carrying t1.
(3) The slave sends a Delay_Req message to the master clock to initiate the calculation of the reverse transmission delay and records the transmission time t3;
After receiving the packet, the master clock records the reception time t4.
4) After receiving the Delay_Req packet, the master clock replies with a Delay_Resp packet carrying t4.
At this time, the slave clock has four timestamps t1 to t4, so that the total round trip delay between the master and slave clocks can be calculated as [(t2 – t1) + (t4 – t3)], since the network is Symmetric, so the one-way delay between the master and slave clocks is [(t2 – t1) + (t4 – t3)] / 2. Therefore, the clock deviation of the slave clock from the master clock is: Offset = (t2 – t1) – [(t2 – t1) + (t4 – t3)] / 2 = [(t2 – t1) – (t4 – t3) ] /2
In addition, depending on whether a Follow_Up message needs to be sent, the request response mechanism is divided into two-step mode and two-step mode:
In single-step mode, the transmission timestamp t1 of the Sync message is carried by the Sync message itself, and the Follow_Up message is not sent.
In the two-step mode, the transmission timestamp t1 of the Sync packet is carried by the Follow_Up message.

2.End delay mechanism

Figure 4 End delay mechanism implementation process

Compared with the request response mechanism, the end delay mechanism not only deducts the forwarding delay, but also deducts the delay of the upstream link.
As shown in Figure 4, the implementation process is as follows:
(1) The master clock sends a Sync message to the slave clock and records the transmission time t1. After receiving the message from the clock, the reception time t2 is recorded.
(2) After the master clock sends the Sync packet, it sends a Follow_Up packet carrying t1.
(3) The slave sends a Pdelay_Req message to the master clock to initiate the calculation of the reverse transmission delay and records the transmission time t3;
After receiving the packet, the master clock records the reception time t4.
(4) After receiving the Pdelay_Req packet, the master clock replies with a Pdelay_Resp packet carrying t4 and records the transmission.
Between t5; after receiving the message from the clock, the reception time t6 is recorded.
(5) After the primary clock replies to the Pdelay_Resp message, it immediately sends a Pdelay_Resp_Follow_Up carrying t5. Message.


At this point, the slave clock has six timestamps t1~t6, which can calculate the total round-trip delay between the master and slave clocks as [(t4 – t3) +(t6 – t5)], since the network is symmetrical, the one-way delay between the master and slave clocks is [(t4 – t3) + (t6 – t5)] / 2. Therefore, from
The clock skew of the clock relative to the main clock is: Offset = (t2 – t1) – [(t4 – t3) + (t6 – t5)] / 2.

In addition, according to whether it is necessary to send a Follow_Up message, the end delay mechanism is also divided into two-step mode and two-step mode:

In the single-step mode, the timestamp t1 of the Sync message is carried by the Sync message itself, and the Follow_Up message is not sent.
The difference between t5 and t4 is carried by the Pdelay_Resp packet, and the Pdelay_Resp_Follow_Up packet is not sent.
In the two-step mode, the transmission timestamp t1 of the Sync message is carried by the Follow_Up message, and t4 and t5 are respectively
Pdelay_Resp packets and Pdelay_Resp_Follow_Up packets are carried.

If reprint, pls notify from:Stone Liu Blog » PTP IEEE 1588 Introduction

Like (1)or Share (0)

Do My Comments
Cancel Comments

Emoticon

Hi,Fill Your Name and Email Address!

  • name(must)
  • Email Address (must)
  • Website