After the master-slave hierarchy is established, the frequency and time synchronization process starts. PTP was originally designed to implement only high-precision time synchronization but now also implements frequency synchronization between devices.
One-step clock mode
An event message (Sync or Pdelay_Resp message) carries the timestamp of when the message is sent. In this mode, time information is generated and advertised when the message is sent and received.
Two-step clock mode
An event message (Sync or Pdelay_Resp message) does not carry the timestamp of when the message is sent. Instead, subsequent general messages (Follow_Up and Pdelay_Resp_Follow_Up messages) carry the timestamps of when Sync and PDelay_Resp messages are sent. In this mode, time information is generated and then advertised. Two-step clock mode applies to the devices that cannot add timestamps to event messages.
The master node periodically sends a Sync message to the slave node. This message carries the timestamp of when the master node sends the Sync message. Upon receipt of a Sync message, the slave node generates a timestamp. If the slave node receives two Sync messages, it compares the difference between the two timestamps of when the messages are received with the difference between the two timestamps of when the messages are sent. The slave node uses the comparison result to adjust its frequency.
Assume that clock B is the master clock, clock A is the slave clock, and frequency synchronization needs to be performed between clock A and clock B. If the link delay and resident time are not considered and the frequencies of clock A and clock B are the same, clock A and clock B should have the same accumulated time difference within a specified period. That is, t2N-t20 = t1N-t10. If t2N-t20 is greater than t1N-t10, the frequency of clock A is higher than the frequency of clock B and needs to be reduced. Conversely, if t2N-t20 is smaller than t1N-t10, the frequency of clock A is lower than that of clock B and needs to be increased. t1n is the time when clock B sends the nth Syn message. t2n is the time when clock A receives the nth Sync message.
TOn a PTP synchronization system, the link delay and resident time must be considered in frequency synchronization. The Follow_Up message shown in the preceding figure is a general message sent in two-step clock mode and carries the timestamp of when a Sync message is sent.