Standards/Ethernet PTP/frames

From UIT
Jump to: navigation, search

Contents

Types and Format

Below only the four most important messages are explained in detail. These are the messages that are mandatory to get the clock offset and the link delay. In general PTP messages are divided into four types

event messages
generate and transport timestamps needed for the synchronisation
UDP destination port 319
  • Sync
  • Delay_Req
general messages
used to measure the link delay between two clocks
UDP destination port 320
  • Follow_Up
  • Delay_Resp
announce message
build up the synchronization hierarchy
signaling messages
all other purposes

All messages contain a header, a body and a suffix. Reserved fields shall be transmitted as '0'. The IPv4 mulitcast group address is 224.0.1.129 (E0 00 01 81). PTP uses Ethertype 0x88F7 and an Ethernet multicast destination address of 01-1B-19-00-00-00.

PTP Header

All PTP messages share a common PTP header.

PTP header
Bits Length
[octets]
Offset
[octets]
7 6 5 4 3 2 1 0
transportSpecific = 0000 messageType
Sync = 0
Delay_Req = 1
Follow_Up = 8
Delay_Resp = 9
1 0
reserved versionPTP = 2 1 1
messageLength
including header, body, suffix
2 2
domainNumber
same on communicating devices
default = 0
1 4
reserved 1 5
flagField
bit1 = twoStepFlag
bit2 = unicastFlag
others = 0
2 6
correctionField
correction for fractional nanoseconds, path delay, ...
8 8
reserved 4 16
sourcePortIdentity
octet0...2 = OUI
octet3...7 = UUID
octet8...9 = PTP node port number: default = 1
10 20
sequenceId
for Follow_Up: same as Sync
for Delay_Resp: same as Delay_Req
for others: one greater than in the previous message of the same type sent to the same destination address
2 30
controlField
Sync = 0
Delay_Req = 1
Follow_Up = 2
Delay_Resp = 3
1 32
logMessageInterval
Sync, Follow_Up: mulitcast = log2(mean interval between multicast messages)
Sync, Follow_Up: unicast = 0x7F
Delay_Resp: multicast = log2(mininal Delay_Req interval)
Delay_Resp: unicast = 0x7F
others = 0x7F
1 33

PTP Suffix

Event messages have a zero length suffix, to avoid that the suffix might change the transmission delay. General messages may have a suffix containing TLV entities.

Sync message

An example Sync UDP over IPV4 message is:

01 00 5E 00 01 81 E4 AF A1 36 00 10 08 00 45 00
00 98 00 5D 40 00 01 11 29 68 C0 A8 01 01 E0 00
01 81 01 3F 01 3F 00 84 C0 7B 00 02 00 2C 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 E4 AF 
A1 uu uu uu uu uu 00 01 ss ss 00 ii tt tt tt tt 
tt tt tt tt tt tt

It is made out of the following parts.

the Ethernet header

01 00 5E 00 01 81 E4 AF A1 36 00 10 08 00
Destination:over UDP/IPv4 multicast: 01 00 5E 00 01 81, over L2 multicast: 01 1B 19 00 00 00
Source: HES-SO MAC address: E4 AF A1 36 00 10, National Semiconductor OUI & random number: 08 00 17 38 00 01
Type: IP = 0x0800, PTP over L2 = 0x88F7

the IP header

                                          45 00
00 48 00 5D 40 00 01 11 29 68 C0 A8 01 01 E0 00
01 81

Version: 4
Internet Header Length: 20 Bytes
Differentiated Services Code Point: default: 0x00
Total Length: 72 
Identificaton: 0x00
Flags & Fragment Offset: Don't fragment
Time to Live (TTL): 1 second (minimum)
Protocol: UDP (17)
Checksum: 
Source: 192.168.1.1
Destination: IPv4 multicast: 224.0.1.129

the UDP header

      01 3F 01 3F 00 34 00 00

Source port: 319
Destination port: 319
Length: 52
Checksum: None: 0x0000

the PTP header

                              00 02 00 2C 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 E4 AF 
A1 30 00 00 00 00 00 01 ss ss 00 00

transportSpecific: ?? (mine: 0x00, wireshark: 0x01)
messageType: sync = 0x00
versionPTP: v2 = 0x02
messageLength: 44 = 0x2c
domainNumber: default = 0x00
flagField: oneStep, multicast
correctionField: default = 0x0000000000000000
sourcePortID: OUI(E4 AF A1) & UUID (30 00 00 00 00) & portNumber (default = 0x0001)
sequenceID: increment
controlField: sync = 0x00
logMessageInterval: 0x00

the PTP body

                                    ss ss ss ss 
ss ss nn nn nn nn

originTimestamp: seconds MSBs; NOT handled by Phyter (rollover all 136 years) 
originTimestamp: seconds LSBs (s) & nanoseconds (n); modified by Phyter in 1STEP mode; must be set to 0

Follow_Up message

As we are using the one-step mechanism in the current implementation, this message type is not explained in detail.

Delay_Req message

      01 3F 01 3F 00 84 C0 7B
  • the PTP header: unicast
                              01 02 00 2C 00 00
00 04 00 00 00 00 00 00 00 00 00 00 00 00 E4 AF
A1 uu uu uu uu uu 00 01 ss ss 01 ii

u = UUID, s = sequenceID, i = logMessageInterval

  • the PTP body
                                    tt tt tt tt 
tt tt tt tt tt tt

t = originTimestamp

Delay_Resp message

      01 40 01 40 00 84 ?? ??
  • the PTP header: unicast
                              09 02 00 36 00 00
00 04 00 00 00 00 00 00 00 00 00 00 00 00 EA AF
A1 uu uu uu uu uu 00 01 ss ss 03 ii

u = UUID, s = sequenceID, i = logMessageInterval

  • the PTP body
                                    tt tt tt tt 
tt tt tt tt tt tt pp pp pp pp pp pp pp pp pp pp

t = receiveTimestamp, p = requestingPortIdentity (sourcePortIdentity from corresponding Delay_Req message)

References

  1. "IEEE Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems," IEEE Std 1588-2008 (Revision of IEEE Std 1588-2002) , vol., no., pp.c1-269, July 24 2008
    doi: 10.1109/IEEESTD.2008.4579760
    URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4579760&isnumber=4579759
  2. Wikipedia article
  3. MAC address Wikipedia article
  4. IPv4 Wikipedia article, Header
  5. UDP Wikipedia article, Packet Structure

Navigation
<< Phyter | ^ PTP ^ | >>

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox