一、报文格式
+0------3--------7--------11--------15--------------------------------31
|TranSpec|MsgType|Reserved1| VerPTP | MsgLength |
+----------------|------------------|---------------------------------|
| DomainNumber | Reserved2 | FlagField |
+---------------------------------------------------------------------|
| CorrectionField |
| |
+---------------------------------------------------------------------|
| Reserved3 |
+---------------------------------------------------------------------|
| SourcePortIdentity |
| |
| +---------------------------------|
| | SequenceID |
+----------------|------------------|---------------------------------|
| ControlField | LogMsgInterval | |
+---------------------------------------------------------------------|
| PreciseOriginTimestamp |
| |
| | |
字段 | 长度 | 含义 |
---|---|---|
TranSpec | 4 bits | 传送相关。 0–表示PTP消息由1588协议使用 1–表示PTP消息由802.1as协议使用 |
MsgType | 4 bits | 0x00: Sync 0x01: Delay_Req |
Reserved1 | 4 bits | 保留字段。 |
VerPTP | 4 bits | 表示1588协议的版本。 |
MsgLength | 2 bytes | PTP消息的长度,即PTP消息的全部字节数目。 计入字节始于报头的第一个字节,同时包含并收尾于任何尾标的最后一个字节,或是无尾标成员时收尾于消息的最后一个字节。 |
DomainNumber | 1 byte | 域编号,表示发送该消息时钟所属的域 |
Reserved2 | 1 byte | 保留字段。 |
FlagField | 2 bytes | 标志域。 |
CorrectionField | CorrectionField | 修正域,各报文都有,主要用在Sync报文中,用于补偿网络中的传输时延,E2E的频率同步。 |
Reserved3 | 4 bytes | 保留字段。 |
SourcePortIdentity | 10 bytes | 源端口标识符,发送该消息时钟的ID和端口号。 |
SequenceID | 2 bytes | 序列号ID,表示消息的序列号,以及关联消息的对应关系。 |
ControlField | 1 byte | 控制域,由消息类型决定。 |
LogMsgInterval | 1 byte | 录入消息周期,PTP消息的发送时间间隔 |
PreciseOriginTimestamp | 10 bytes | 精确源时间标签。 PTP提供传输时间戳的机制,这个时间戳包括事件消息产生的时刻和相应的修正域,通过这个机制保证接收方接收到的是最精确的时间戳。 在实际应用中时间戳分布在:originTimestamp或者preciseOriginstamp和correctionField中,由具体的执行决定。。 |
二、报文示例
(1) 基于UDP的Follow_Up消息
Frame 1: 90 bytes on wire (720 bits), 90 bytes captured (720 bits)
Ethernet II, Src: 0a:2a:0a:31:0a:13 (0a:2a:0a:31:0a:13), Dst: HuaweiTe_98:f2:6e (00:25:9e:98:f2:6e)
Internet Protocol Version 4, Src: 10.1.1.1 (10.1.1.1), Dst: 224.0.1.129 (224.0.1.129)
User Datagram Protocol, Src Port: ptp-event (319), Dst Port: ptp-general (320)
Precision Time Protocol (IEEE1588)0000 .... = transportSpecific: 0x00...0 .... = V1 Compatibility: False.... 1000 = messageId: Follow_Up Message (0x08).... 0010 = versionPTP: 2messageLength: 44subdomainNumber: 0flags: 0x022c0... .... .... .... = PTP_SECURITY: False.0.. .... .... .... = PTP profile Specific 2: False..0. .... .... .... = PTP profile Specific 1: False.... .0.. .... .... = PTP_UNICAST: False.... ..1. .... .... = PTP_TWO_STEP: True.... ...0 .... .... = PTP_ALTERNATE_MASTER: False.... .... ..1. .... = FREQUENCY_TRACEABLE: True.... .... ...0 .... = TIME_TRACEABLE: False.... .... .... 1... = PTP_TIMESCALE: True.... .... .... .1.. = PTP_UTC_REASONABLE: True.... .... .... ..0. = PTP_LI_59: False.... .... .... ...0 = PTP_LI_61: Falsecorrection: 0.000000 nanosecondscorrection: Ns: 0 nanosecondsSubNs: 0.000000 nanosecondsClockIdentity: 0x00259e1000000001SourcePortID: 1280sequenceId: 5246control: Follow_Up Message (2)logMessagePeriod: -10
preciseOriginTimestamp (seconds): 947131161preciseOriginTimestamp (nanoseconds): 698886823
(2) 基于以太的Follow_Up消息
Frame 1: 64 bytes on wire (512 bits), 64 bytes captured (512 bits)
Ethernet II, Src: HuaweiTe_83:7b:0d (00:25:9e:83:7b:0d), Dst: HuaweiTe_46:8f:7e (00:25:9e:83:7b:0d)Destination: HuaweiTe_46:8f:7e (00:25:9e:83:7b:0d)Source: HuaweiTe_83:7b:0d (00:25:9e:83:7b:0d)Type: PTPv2 OVER eTHERNET (IEEE1588) (0x88f7)
Precision Time Protocol (IEEE1588)0000 .... = transportSpecific: 0x00...0 .... = 802.1as conform: False.... 1000 = messageId: Follow_Up Message (0x08).... 0010 = versionPTP: 2messageLength: 44subdomainNumber: 0flags: 0x022c0... .... .... .... = PTP_SECURITY: False.0.. .... .... .... = PTP profile Specific 2: False..0. .... .... .... = PTP profile Specific 1: False.... .0.. .... .... = PTP_UNICAST: True.... ..1. .... .... = PTP_TWO_STEP: True.... ...0 .... .... = PTP_ALTERNATE_MASTER: False.... .... ..1. .... = FREQUENCY_TRACEABLE: True.... .... ...0 .... = TIME_TRACEABLE: False.... .... .... 1... = PTP_TIMESCALE: True.... .... .... .1.. = PTP_UTC_REASONABLE: False.... .... .... ..0. = PTP_LI_59: False.... .... .... ...0 = PTP_LI_61: Falsecorrection: 0.000000 nanosecondscorrection: Ns: 0 nanosecondsSubNs: 0.000000 nanosecondsClockIdentity: 0x00aa12fffe431112SourcePortID: 1024sequenceId: 12243control: Follow_Up Message (2)
preciseOriginTimestamp (seconds): 946878901preciseOriginTimestamp (nanoseconds): 214732091
三、参考标准
标准 | 描述 |
---|---|
IEEE 1588 V2 | 面向网络测控系统的精密时钟同步协议 |
IEEE P1588™ D2.2 | 网络测控系统精密时钟同步协议标准草案 |