Standards/Ethernet PTP/frames

From UIT
(Difference between revisions)
Jump to: navigation, search
(Sync message)
(the Ethernet header)
 
(28 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<accesscontrol>Administrators,,wikieda</accesscontrol>
 
 
{{TOC right}}
 
{{TOC right}}
  
== General ==
+
== Types and Format ==
PTP messages are divided into two types
+
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.
* event messages<br/>a timestamp is generated at transmission and reception<br/>UDP destination port 319
+
In general PTP messages are divided into four types
** Sync
+
; event messages
** Delay_Req
+
: generate and transport timestamps needed for the synchronisation
* general messages<br/>UDP destination port 320
+
: UDP destination port 319
** Follow_Up
+
:* Sync
** Delay_Resp
+
:* Delay_Req
All messages contain a PTP header, a PTP body and a PTP suffix.
+
 +
; 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'.
 
Reserved fields shall be transmitted as '0'.
 
The IPv4 mulitcast group address is 224.0.1.129 (E0 00 01 81).  
 
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 uses Ethertype 0x88F7 and an [[Standards/Ethernet#Multicast|Ethernet multicast]] destination address of 01-1B-19-00-00-00.
  
 
=== PTP Header ===
 
=== PTP Header ===
Line 51: Line 63:
  
 
=== PTP Suffix ===
 
=== PTP Suffix ===
Event messages have a zero length suffix, as the suffix might change the transmission delay.
+
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 (type, length, value) entities.
+
General messages may have a suffix containing [https://en.wikipedia.org/wiki/Type-length-value TLV] entities.
  
 
== Sync message ==
 
== Sync message ==
  
An example Sync IPV4 message is:
+
An example Sync UDP over IPV4 message is:
  01 00 5E 00 01 81 E4 AF A1 30 00 00 08 00 45 00
+
  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
 
  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
 
  01 81 01 3F 01 3F 00 84 C0 7B 00 02 00 2C 00 00
Line 64: Line 76:
 
  tt tt tt tt tt tt
 
  tt tt tt tt tt tt
  
It is made out of
+
It is made out of the following parts.
* the Ethernet header:
+
 
  <span style="background-color:red;color:white;border-radius:3px">01 00 5E 00 01 81</span> <span style="background-color:green;color:white;border-radius:3px">E4 AF A1 30 00 00</span> <span style="background-color:blue;color:white;border-radius:3px">08 00</span>
+
=== the Ethernet header ===
+
  <span style="background-color:red;color:white;border-radius:3px">01 00 5E 00 01 81</span> <span style="background-color:green;color:white;border-radius:3px">E4 AF A1 36 00 10</span> <span style="background-color:blue;color:white;border-radius:3px">08 00</span>
  <span style="color:red;font-weight:bold">Destination</span>: IPv4 multicast: 224.0.1.129
+
  <span style="color:red;font-weight:bold">Destination</span>:over [[Standards/Ethernet#Multicast|UDP/IPv4 multicast]]: 01 00 5E 00 01 81, over L2 multicast: 01 1B 19 00 00 00
  <span style="color:green;font-weight:bold">Source</span>: OUI & Internal Project & HES-SO Valais Wallis & Laboratory Number & Internal Product Number
+
  <span style="color:green;font-weight:bold">Source</span>: [[Standards/Ethernet/MAC_addresses#HES-SO_MAC_adresses|HES-SO MAC address]]: E4 AF A1 36 00 10, National Semiconductor OUI & random number: 08 00 17 38 00 01
  <span style="color:blue;font-weight:bold">Type</span>: IP
+
  <span style="color:blue;font-weight:bold">Type</span>: IP = 0x0800, PTP over L2 = 0x88F7
* the [http://en.wikipedia.org/wiki/IPv4_header#Header IP header]:
+
 
 +
=== the [http://en.wikipedia.org/wiki/IPv4_header#Header IP header] ===
 
                                           <span style="background-color:LawnGreen;color:white;border-radius:3px">4</span><span style="background-color:LimeGreen;color:white;border-radius:3px">5</span> <span style="background-color:LightGreen;color:white;font-weight:border-radius:3px">00</span>
 
                                           <span style="background-color:LawnGreen;color:white;border-radius:3px">4</span><span style="background-color:LimeGreen;color:white;border-radius:3px">5</span> <span style="background-color:LightGreen;color:white;font-weight:border-radius:3px">00</span>
 
  <span style="background-color:MediumSeaGreen;color:white;border-radius:3px">00 48</span> <span style="background-color:ForestGreen;color:white;border-radius:3px">00 5D</span> <span style="background-color:YellowGreen;color:white;border-radius:3px">40 00</span> <span style="background-color:OliveDrab;color:white;border-radius:3px">01</span> <span style="background-color:DarkOliveGreen;color:white;border-radius:3px">11</span> <span style="background-color:DarkSeaGreen;color:white;border-radius:3px">29 68</span> <span style="background-color:Olive;color:white;border-radius:3px">C0 A8 01 01</span> <span style="background-color:DarkGreen;color:white;border-radius:3px">E0 00
 
  <span style="background-color:MediumSeaGreen;color:white;border-radius:3px">00 48</span> <span style="background-color:ForestGreen;color:white;border-radius:3px">00 5D</span> <span style="background-color:YellowGreen;color:white;border-radius:3px">40 00</span> <span style="background-color:OliveDrab;color:white;border-radius:3px">01</span> <span style="background-color:DarkOliveGreen;color:white;border-radius:3px">11</span> <span style="background-color:DarkSeaGreen;color:white;border-radius:3px">29 68</span> <span style="background-color:Olive;color:white;border-radius:3px">C0 A8 01 01</span> <span style="background-color:DarkGreen;color:white;border-radius:3px">E0 00
Line 88: Line 101:
 
  <span style="color:DarkGreen;font-weight:bold">Destination</span>: IPv4 multicast: 224.0.1.129
 
  <span style="color:DarkGreen;font-weight:bold">Destination</span>: IPv4 multicast: 224.0.1.129
  
* the [http://en.wikipedia.org/wiki/User_Datagram_Protocol#Packet_structure UDP header]:
+
=== the [http://en.wikipedia.org/wiki/User_Datagram_Protocol#Packet_structure UDP header] ===
 
       <span style="background-color:BurlyWood;color:white;border-radius:3px">'''01 3F</span> <span style="background-color:Peru;color:white;border-radius:3px">01 3F'''</span> <span style="background-color:Chocolate;color:white;border-radius:3px">00 34</span> <span style="background-color:Sienna;color:white;border-radius:3px">'''00 00'''</span>
 
       <span style="background-color:BurlyWood;color:white;border-radius:3px">'''01 3F</span> <span style="background-color:Peru;color:white;border-radius:3px">01 3F'''</span> <span style="background-color:Chocolate;color:white;border-radius:3px">00 34</span> <span style="background-color:Sienna;color:white;border-radius:3px">'''00 00'''</span>
 
   
 
   
Line 95: Line 108:
 
  <span style="color:Chocolate;font-weight:bold">Length</span>: 52
 
  <span style="color:Chocolate;font-weight:bold">Length</span>: 52
 
  <span style="color:Sienna;font-weight:bold">Checksum</span>: None: 0x0000
 
  <span style="color:Sienna;font-weight:bold">Checksum</span>: None: 0x0000
* the PTP header: oneStep multicast
+
 
                               <span style="background-color:CadetBlue;color:white;border-radius:3px">'''0</span><span style="background-color:LightSteelBlue;color:white;border-radius:3px">0'''</span> <span style="background-color:SteelBlue;color:white;border-radius:3px">02</span> <span style="background-color:LightBlue;color:white;border-radius:3px">'''00 2C'''</span> <span style="background-color:SkyBlue;color:white;border-radius:3px">00</span> 00
+
=== the PTP header ===
  <span style="background-color:DodgerBlue;color:white;border-radius:3px">00 '''00'''</span> <span style="background-color:CornflowerBlue;color:white;border-radius:3px">00 00 00 00 00 00 00 00</span> 00 00 00 00 <span style="background-color:MidnightBlue;color:white;border-radius:3px">EA AF  
+
                               <span style="background-color:CadetBlue;color:white;border-radius:3px">'''0</span><span style="background-color:LightSteelBlue;color:white;border-radius:3px">0'''</span> 0<span style="background-color:SteelBlue;color:white;border-radius:3px">2</span> <span style="background-color:LightBlue;color:white;border-radius:3px">'''00 2C'''</span> <span style="background-color:SkyBlue;color:white;border-radius:3px">00</span> 00
  A1 uu uu uu uu uu 00 01</span> <span style="background-color:RoyalBlue;color:white;border-radius:3px">ss ss</span> <span style="background-color:Aqua;color:white;border-radius:3px">'''00'''</span> <span style="background-color:MediumTurquoise;color:white;border-radius:3px">00</span>
+
  <span style="background-color:DodgerBlue;color:white;border-radius:3px">00 '''00'''</span> <span style="background-color:CornflowerBlue;color:white;border-radius:3px">00 00 00 00 00 00 00 00</span> 00 00 00 00 <span style="background-color:MidnightBlue;color:white;border-radius:3px">E4 AF  
 +
  A1 30 00 00 00 00 00 01</span> <span style="background-color:RoyalBlue;color:white;border-radius:3px">ss ss</span> <span style="background-color:Aqua;color:white;border-radius:3px">'''00'''</span> <span style="background-color:MediumTurquoise;color:white;border-radius:3px">00</span>
 
   
 
   
 
  <span style="color:CadetBlue;font-weight:bold">transportSpecific</span>: ?? (mine: 0x00, wireshark: 0x01)
 
  <span style="color:CadetBlue;font-weight:bold">transportSpecific</span>: ?? (mine: 0x00, wireshark: 0x01)
 
  <span style="color:LightSteelBlue;font-weight:bold">messageType</span>: sync = 0x00
 
  <span style="color:LightSteelBlue;font-weight:bold">messageType</span>: sync = 0x00
 
  <span style="color:SteelBlue;font-weight:bold">versionPTP</span>: v2 = 0x02
 
  <span style="color:SteelBlue;font-weight:bold">versionPTP</span>: v2 = 0x02
  <span style="color:LightBlue;font-weight:bold">messageLength</span>: 44
+
  <span style="color:LightBlue;font-weight:bold">messageLength</span>: 44 = 0x2c
 
  <span style="color:SkyBlue;font-weight:bold">domainNumber</span>: default = 0x00
 
  <span style="color:SkyBlue;font-weight:bold">domainNumber</span>: default = 0x00
  <span style="color:DodgerBlue;font-weight:bold">flagField</span>: default = 0x00
+
  <span style="color:DodgerBlue;font-weight:bold">flagField</span>: oneStep, multicast
 
  <span style="color:CornflowerBlue;font-weight:bold">correctionField</span>: default = 0x0000000000000000
 
  <span style="color:CornflowerBlue;font-weight:bold">correctionField</span>: default = 0x0000000000000000
  <span style="color:MidnightBlue;font-weight:bold">sourcePortID</span>: OUI & UUID (u) & portNumber (default = 0x01)
+
  <span style="color:MidnightBlue;font-weight:bold">sourcePortID</span>: [[Standards/Ethernet/MAC_addresses#HES-SO_MAC_adresses|OUI]](E4 AF A1) & UUID (30 00 00 00 00) & portNumber (default = 0x0001)
 
  <span style="color:RoyalBlue;font-weight:bold">sequenceID</span>: increment
 
  <span style="color:RoyalBlue;font-weight:bold">sequenceID</span>: increment
 
  <span style="color:Aqua;font-weight:bold">controlField</span>: sync = 0x00
 
  <span style="color:Aqua;font-weight:bold">controlField</span>: sync = 0x00
 
  <span style="color:MediumTurquoise;font-weight:bold">logMessageInterval</span>: 0x00
 
  <span style="color:MediumTurquoise;font-weight:bold">logMessageInterval</span>: 0x00
  
* the PTP body
+
=== the PTP body ===
                                     <span style="background-color:Tomato;color:white;border-radius:3px">ss ss ss ss  
+
                                     <span style="background-color:DarkOrange;color:white;border-radius:3px">ss ss</span> <span style="background-color:Tomato;color:white;border-radius:3px">ss ss  
 
  ss ss nn nn nn nn</span>
 
  ss ss nn nn nn nn</span>
 
   
 
   
  <span style="color:Tomato;font-weight:bold">originTimestamp</span>: seconds (s) & nanoseconds (n)
+
<span style="color:DarkOrange;font-weight:bold">originTimestamp</span>: seconds MSBs; NOT handled by [[Standards/Ethernet_PTP/DP83640|Phyter]] (rollover all 136 years)
 +
  <span style="color:Tomato;font-weight:bold">originTimestamp</span>: seconds LSBs (s) & nanoseconds (n); modified by [[Standards/Ethernet_PTP/DP83640|Phyter]] in 1STEP mode; must be set to 0
  
 
== Follow_Up message ==
 
== Follow_Up message ==
Line 160: Line 175:
 
>>
 
>>
 
</p>
 
</p>
 +
 +
[[Category:Standards]] [[Category:Ethernet]] [[Category:PTP]]

Latest revision as of 21:44, 23 May 2016

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