Master Project PTP 1588
Master Project PTP 1588
Mudassar Ahmed
[email protected]
MASTER PROJECT
Kiel University of Applied Science
in Kiel
im Mai 2018
Declaration
I hereby declare and confirm that this project is entirely the result of my own original
work. Where other sources of information have been used, they have been indicated
as such and properly acknowledged. I further declare that this or similar work has not
been submitted for credit elsewhere.
Mudassar Ahmed
[email protected]
i
Contents
Declaration i
Abstract iv
1 Introduction 1
1.1 Research Objectives and Goals . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Literature Review 3
2.1 Time Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Time Synchronization Technologies . . . . . . . . . . . . . . . . . . . . . 4
2.3 Overview of IEEE 1588 Precision Time Protocol (PTP) . . . . . . . . . 4
2.3.1 Scope of PTP Standard: . . . . . . . . . . . . . . . . . . . . . . . 5
2.3.2 Protocol Standard Messages . . . . . . . . . . . . . . . . . . . . . 5
2.3.3 Protocol Standard Devices . . . . . . . . . . . . . . . . . . . . . . 6
2.3.4 Message Exchange and Delay Computation . . . . . . . . . . . . 7
2.3.5 Protocol Hierarchy Establishment Mechanism . . . . . . . . . . 9
ii
Contents iii
6 Conclusion 34
6.1 Improvements and Future Work . . . . . . . . . . . . . . . . . . . . . . 34
References 47
Literature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Online sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Abstract
iv
List of Figures
v
List of Figures vi
vii
Chapter 1
Introduction
1
1. Introduction 2
capabilities are enabled by using Linux kernel PHC API and hardware timestamping
socket option. An opensource PTP solution is used to establish the PTP network for
further analysis.
Research Objectives/Questions
• Analysis of precision uncertainty in Hardware and Software based solutions of
PTP.
• What is the maximum attainable accuracy with Hardware and Software based
solutions of PTP?
1.2 Approach
In order to achieve research objectives and to implement IEEE 1588 protocol, linuxPTP
(Opensource PTP implementation) application is used on SoC devices (Beaglebone
Black) in a Linux environment. The protocol hierarchy is established in different test
case scenarios (Hardware assisted and Software based tests ). The log data generated in
a specific scenario is prepared and imported to MATLAB workspace, where comparison
of results in different scenarios are compiled in graphical form. These results are further
analyzed and evaluated to draw the final conclusion.
1.3 Outline
First, the report introduces to the time synchronization and give a overview of PTP
protocol in Chapter 2. The Chapter 3 focuses on the Linux support for PTP in the
context of timestamping mechanism and Clock control mechanism. In Chapter 4, a
brief introduction about tools and technologies used in implementation is presented.
The results of test scenarios are presented and discussed in Chapter 5. The Chapter
6 draws final conclusion on work.
Chapter 2
Literature Review
External Synchronization
In External Synchronization all nodes are synchronized with external time source, that
can be via Internet using NTP or using GPS.
Internal Synchronization
In Internal Synchronization nodes are synchronized with each other via establishing a
master-slave hierarchy base network or with a reference clock. It is not necessary to
synchronize with an external time source.
Hybrid Synchronization
This method is similar to Internal Synchronization but the reference/master clock is
tuned with an external time source.
3
2. Literature Review 4
Spatial Extent Local Bus Local Bus Wide Area Wide Area A few Sub-nets
IEEE 1588
A protocol, which establishes master-slave hierarchy between LAN connected devices,
and enables them to share timing information in order to synchronize their clocks with a
reference time. It is a self-organizing protocol which uses existing infrastructure instead
of dedicated bus to synchronize nodes up-to sub-microsecond level.
NTP:
The main focus of NTP protocol is on the systems, which are spread over a wide network,
the target device is synchronized with a time server over the internet.
GPS:
The GPS systems communicate via satellite, which provides different services including
timing. Regarding time synchronization, GPS is used for autonomous systems which
are remotely located in certain area and receiving timing information via satellite com-
munication.
of time. The protocol is ideal for a condition where the time awarded distributed systems
are networked via multicasting supported local area network. It provides flexibility in
the term of requirements in order to establish a synchronization setup from hardware
assisted PTP systems and PTP supported network components (Switches, Routers).
In an established PTP network, there can be protocol supported (e.g. Ordinary and
Boundary clocks) and also other devices (e.g. Printers and non-PTP Bridges/Routers ),
which may not aware of PTP system. The hierarchy is established using PTP-devices,
which are mainly real-time clocks. In the protocol hierarchy, top-level clock is called
Grandmaster-Clock, which is treated as a reference time in the network and other
clocks can perform a role of slave or master. In order to extend hierarchy and improve
performance, a PTP-device (Boundary Clock) can also be a slave to its master and also
time-source to other slave devices. The Best Master Clock Algorithm (BMCA) ensures
the self-organizing property of protocol, by enabling PTP device to choose a specific
role in the hierarchy, either in any case of failure of a master clock or in obtaining a
master clock role on the base of clock data sets.
Event Messages
Event messages are those messages, which are critical for accuracy in both delay cal-
culation mechanism of PTP. Disturbance during transmission of event messages can
possess a huge impact on overall accuracy of the protocol. (Pdelay_Req, Pdelay_resp,
Sync and Delay_Req).
2. Literature Review 6
General Messages
General messages are ordinary data transmitting or configuration messages, which are
not timestamped but used to transport the timestamping informing and play a vital to
setup protocol. (Pdelay_Resp_Follow_Up, Follow_Up, Delay_Resp, Announce, Man-
agement and Signalling messages).
Boundary Clock
The Boundary clock node has more than one ports to communicate within the network
through multiple communication paths. Boundary device is complete PTP implementa-
tion, each port of Boundary clock act as Ordinary clock. One port of the device can be
a slave to a Grandmaster (GM) and other port can be a master to other PTP devices.
So, in the case of failure of GM, it will act as time source in the network. [2] [6]
Transparent Clock
The Transparent clock was first defined in the second version of IEEE-1588 standard.
There is no master/slave state in Transparent clock, according to the defined protocol,
there is no need for synchronization in Transparent clock with Master/Grandmaster
clock. It has multiple communication ports for transferring PTP messages. During for-
warding messages from input port to output port, it computes delay caused by a device
in transferring process of the PTP event messages. The computed delay is called resi-
dence time, this residence time then added to designated correction field part of partic-
ular timing message. Slave clock adjusts the time using this residence time in order to
2. Literature Review 7
overcome the fluctuation caused by the other network establishing devices (e.g Bridges).
[2] [6] [11] [9]
As shown in Figure 2.2, Sync message is timestamped at t1 and sent to slave, prac-
tically the Sync message is sent at t2m due to unknown network delays. So, another
Follow_Up message containing the timestamp value of t1 is sent to acknowledge the
slave about the exact instance, when the Sync message was timestamped. Similarly,
Delay_Req message is timestamped at t3 and received at the master at t4 instead of
t3m due to delays, the master clock sends a response message, which contains the exact
time when Delay_Req message was received.
(𝑡2 − 𝑡1 ) + (𝑡4 − 𝑡3 )
𝑀 𝑒𝑎𝑛𝑃 𝑎𝑡ℎ𝐷𝑒𝑙𝑎𝑦 = (2.1)
2
connected port to each other, due to this approach every port in the network must
support PTP protocol.
In presence of transparent clock, the delay between master and slave is calculated
by adding specific peer delay to the residence time of Transparent clock. So in the case
of any accidental change in network hierarchy network delay fluctuation can be handled
efficiently. [19] [11] [9]
In PTP-1588-v1 [10], clock properties are advertised using Sync message but in
second version [11], properties are advertised using dedicated Announce message. A
clock, either explicitly configured (clock properties) as the best clock or consider itself
on the bases of BMCA as an eligible master clock, in both cases the clock advertises
its clock properties via sending announce message in the network. In case of failure of
master clock or recognition of another better clock in the network, then the master-state
associated messages (Sync and Announce) stops and another clock takes the role of best
master clock. [16]
Chapter 3
The journey of time synchronization begins with NTP (Network Time Protocol) and
David Mills is known as the father of NTP. Many of Mills purposed method for timekeep-
ing and synchronization of internal and external clocks can be seen in more advanced
and accurate time synchronization protocol like PTP. [15]
The first version of PTP was standardized in 2002, three years later Kendall Correll
introduced a first opensource software-only solution (ptpd) [13] for implementation of
PTP on Linux based systems. The solution became a base for further development in
this domain. Later in 2009, Patrick Ohly introduced hardware timestamping in Linux
kernel [7], Ohly then altered existing version of ptpd and extend his support for hard-
ware supported synchronization [14]. Although hardware timestamping mechanism was
already introduced in Linux kernel but there was no proper solution to control the
hardware clock. So, in 2010, Richard Cochran introduced PTP clock infrastructure in
Linux [7]. Later in 2011, Cochran presented the LinuxPTP tool for hardware and soft-
ware based time synchronization solution using hardware timestamping and PHC API
of Linux kernel [15]. These opensource solutions and Linux kernel support are playing
a vital role in the development and widespread use of this protocol. Many developer
and researchers are using and extending these tools to realize their concepts on different
platforms for intended applications.
11
3. PTP Infrastructure in Linux 12
Application
Timestamp
OS
MAC
PHY
The figure above reflects software timestamping process in contrast with network
layers. As the packets are timestamped at userspace using system time. Practically,
the system time is stored in memory, accessing memory/system time using normal
kernel routines results jitter which varies system to system and furthermore timestamped
packet still need to pass through other layers of the network in order to reach physical
channel of the network, which also causes some amount of error.
Application
OS
MAC Timestamp
PHY
SO_TIMESTAMP :
The kernel option timestamps incoming network traffic by using Linux system time.
Resolution of the timestamp is in microseconds.
SO_TIMESTAMPNS :
This timestamp generation mechanism is similar to previous option but when the times-
tamping information is retrieved using recvmsg() function, regarding information is sent
back via timespec struct in nano second resolution.
SO_TIMESTAMPING :
This kernel socket option supports multiple types of timestamp request including hard-
ware timestamping. The option enables to generate the timestamp on incoming and
outgoing packets.
Following are the available parameters for configuring SO_TIMESTAMPING op-
tion for timestamp generation.
• SOF_TIMESTAMPING_RX_HARDWARE
• SOF_TIMESTAMPING_RX_SOFTWARE
3. PTP Infrastructure in Linux 14
• SOF_TIMESTAMPING_TX_HARDWARE
• SOF_TIMESTAMPING_TX_SOFTWARE
• SOF_TIMESTAMPING_TX_SCHED
• SOF_TIMESTAMPING_TX_ACK
• SOF_TIMESTAMPING_SOFTWARE
• SOF_TIMESTAMPING_SYS_HARDWARE
• SOF_TIMESTAMPING_RAW_HARDWARE
Character Device
The above figure shows the clock infrastructure, where the class drivers covers the
more generalized features and specific clock need to provide the clock driver which covers
the hardware aspects of specific clock. The specific clock has to register their clock driver
with the class driver which will generate the Character device, the Character device will
be accessible to userspace via PHC userspace API.
The main purpose of developing Linux Kernel API was to minimize the effort to
develop the driver for different devices. So, Class drivers do many generalized tasks for
all clock drivers like creation of character device, validation of ioct calls and management
of the timestamped event ordering. The approach which is used to control the PHC is
quite similar as NTP timer model which also reduce effort in development. [7]
The table above shows the clock operations and their comparison with NTP timer
equivalent. As these ioctl names are reflecting their function like GETCAPS is used to
get the PHC capabilities and ADJFREQ ioctl is used to adjust the clock frequency by
ppb parameter. [7]
Chapter 4
In order to implement the PTP protocol on Linux based SoC platform, we chose Linux-
PTP, a most reliable opensource PTP implementation for UNIX like operating systems.
Although there is another solution (PTPd) available which also claims hardware times-
tamping and PHC control based implementation, due lack of compatibility for multiple
hardware, we preferred to use linuxPTP which is compatible for chosen hardware plat-
form (Beaglebone Black) and easily extendable to implement the additional features.
For hardware platform, Beaglebone is chosen due to its support for hardware-based
timestamping for PTP protocol and wide acceptance in the opensource community as
reference implementation platform. For performance analysis of PTP protocol on se-
lected hardware-software combination, stess-ng tool and iperf are used to put some
stress on reference implementation platform in different dimensions (CPU, Network).
Data collected during this process is then cleaned and imported to MATLAB workspace,
where data is represented in bar-charts and graphs.
16
4. Design and Implementation 17
The LinuxPTP project yields multiple executable files in order to establish the whole
two-step synchronization mechanism.
ptp4l:
The ptp4l tool synchronizes (by default) PHC clock with master clock in network. If
the system does not have PHC then it synchronizes the system clock with a master
clock using software timestamping, in this case, there is no need of phy2sys tool. For
configuration, there is a default configuration file is provided, where the default behavior
of the tool can be changed. For customized configuration, a new configuration file can
be made in a standard way, which can be passed to the tool via proper command line
argument.
pmc:
The pmc is the realization of PTP management client as defined in the standard. The
tool is used to get the extra information from the network like identity, pathdelay,
accuracy and other. The commands from pmc are transferred to all the clients but
there are options to give a targeted command in the network.
4. Design and Implementation 18
phy2sys:
The phc2sys tool synchronizes Linux system clock to the PHC. In whole process the the
phc2sys is synchronized with ptp4l, where system clock act as slave and PHC plays a
role of master clock.
ptp4l M
phy2sys
M
S S
Master Clock
Node Linux Based SoC Platform
4.1.2 PTPd
PTPd is the one of first opensource implementation of IEEE-1588 protocol for UNIX
like operating system. The first version of PTPd only supports software timestamping.
Later, PTPd also adopted hardware timestamping and PHC API.
4.1.3 stress-ng
stress-ng is a tool to perform the different stress test on Linux system in a scalable way.
Test includes I/O stress, CPU, and Network load.
4.1.4 iPerf
iPerf is a cross-platform tool, the tool is used for network performance measurements.
In this project, iPref is used to create the UDP stream with specified bandwidth on es-
tablished PTP network for performance analysis of PTP implementation under scalable
network load.
4.1.5 Matlab
Matrix Laboratory (Matlab) is a complete set of tools. Matlab includes IDE (Integrated
Development Environment), programming language and libraries. Matlab is used for
creating models, develop algorithms and for analyzing data. In this project, the Matlab
is used only for data preparation and representation of data.
The capabilities of platform can be extended further with CAPES (capes are broads
extensions with additional features). The main reason for selecting this platform is for
its supports to hardware based timestamping though the MAC layer.
Slave
Master Slave
Clock Router
Slave
In order to establish PTP network for software and hardware based timestamping so-
lutions, there are necessary tools and configuration need to be installed and configured.
There are different ways to install and configure environment for PTP network.
First, it is needed to know the capabilities of the hardware, either the clock nodes
support hardware-assisted time synchronization or not. Timestamping capabilities in
Linux kernel version 3.4 or later can be checked through Kernel ETHTOOL_GET
_TS_INFO ioctl calls. Ethtool is a Linux based tool give the ability to inquire the
timestamping capabilities of the hardware. Following is a snapshot of the of Linux ter-
minal output showing timestamping capabilities of selected SoC platform (Beaglebone),
which is retrieved using Ethtool.
The above figure reflects the hardware timestamping support of Beaglebone. In order
20
5. Test and Measurements 21
There are two ways to get a Linux kernel with enabled above options. First, compile
a customized kernel with desired kernel options. Second, obtain a pre-compiled kernel
for selected hardware with required configuration. Although, obtaining a pre-compiled
kernel is the easiest way to establish a hardware-assisted PTP setup but most of the
time pre-compiled kernel is shipped with many generalized modules and desktop en-
vironments, which may not necessary for intended applications and sometimes these
additional unnecessary components of the kernel and root file systems impose consid-
erable amount of extra stress on the system, which further leads to uncertainty in of
whole synchronization process. On the other hand, compiling the customized kernel
using conventional way is not always a favourite option. So, instead we can use the
Yocto project, for building a customized Linux system image including bootloaders and
root file system. Yocto project is an opensource solution for building customized kernel
for embedded systems. Yocto project uses Beaglebone as a reference platform. In Ap-
pendix B, the procedure to build the Linux kernel and porting pre-compiled kernel in
Beaglebone is briefly described.
800.000
600.000
400.000
Offset from Master clock (ns)
200.000
-200.000
-400.000
-600.000
Slave 1
Slave 2
-800.000 Slave 3
×10 5
1.8
1.5
1.2
0.9
Offset from Master clock (ns)
0.6
0.3
-0.3
-0.6
-0.9
Slave 1
-1.2 Slave 2
Slave 3
-1.5
-1.8
3000 3010 3020 3030 3040 3050 3060 3070 3080 3090 3100
Time (sec)
The figure 5.2 shows the offsets of slave clocks over the span of approximately two
hours, where the drift of slave clocks are up to 2ms and it can also be seen that clocks
are showing uncertain behavior. Overall the offsets are between ± 0.5ms but due to
unknown error, there are sudden changes in offset in all clocks, which may be the result
of a change in speed of the clock. If we take a closer look at the relatively stable part
of test duration, which is highlighted by a rectangular shape in figure 5.2.
The figure 5.3 is drawn on the basis of data taken from stable synchronization
span of the figure 5.2. In this graph, only first 100 samples of data are considered,
in order to visualize the results more clearly. During whole span ( approx 15 min) of
synchronization, the offset remained under 300 microseconds.
700
Slave1
Slave 2
Slave 3
600
500
Number of Samples
400
300
200
100
0
-200.000 -150.000 -100.000 -50.000 0 50.000 100.000 150.000 200.000
Offset from Master Clock (ns)
The figure above shows the precision of clocks, where the number of samples by
specific clock are plotted between the range of -200us to 200us. It can be seen that slave
1 have relatively better precision as compare to other slaves clocks, where the offset
fluctuation can clearly be seen.
chronization network consists of three slaves and one master clock, performing their
roles for approximately 1.3 hours and in the second part of synchronization period, two
slaves are removed from network in order to analyze the behavior of synchronization
process with fewer slaves communicating with the master clock. It can be seen that after
removing slaves form network, results form remaining slaves are relatively stable and
also remained stable for long period of time.
500
400
300
200
Offset from Master Clock (ns)
100
-100
-200
Slave 1
Slave 2
-300 Slave 3
-400
-500
0 5.000 10.000 15.000 20.000 25.000 30.000 35.000 40.000
Time (sec)
The graph 5.6 shows the magnified version of first half of the previous figure where
three slaves are active in PTP network and continuously synchronizing their time with
master clock by every second and the accuracy of slave clocks is between ± 250ns.
5. Test and Measurements 25
500
400
300
200
Offset from Master Clock (ns)
100
-100
-200
-300
Slave 1
-400 Slave 2
Slave 3
-500
1000 1010 1020 1030 1040 1050 1060 1070 1080 1090 1100
Time (sec)
300
250
200
150
Offset from Master Clock (ns)
100
50
-50
-100
-150
-200
Data
-250
Slave 3
-300
8000 8010 8020 8030 8040 8050 8060 8070 8080 8090 8100
Time (sec)
The graph 5.7 reflects second half of the figure 5.5, where only one slave is correcting
their offset with one master clock and other two slaves are removed from the network. It
can be clearly seen that the results are remarkable with fewer slave devices in a network.
The offset is fluctuating between the -50 to 50 ns, which is the highest accuracy achieved
during all kind of test scenarios.
250
Slave 1
Slave 2
Slave 3
200
Number of Sampels
150
100
50
0
-1000 -800 -600 -400 -200 0 200 400 600 800 1000
Offset from Master Clock (ns)
The stability of clock can be noticed from above bar chart, in most of the results the
offset is between ± 400ns, with four PTP devices connected via LAN network. On the
other hand, almost all slave clock have similar precision unlike software timestamping
base PTP network, where all slave clocks have different behavior in whole test case
duration with similar configuration and environment.
100.000
Slave Clock (Sw)
90.000
Slave Clock (Hw)
80.000
70.000
60.000
50.000
Offset from Master clock (ns)
40.000
30.000
20.000
10.000
-10.000
-20.000
-30.000
-40.000
-50.000
-60.000
0 50 100 150 200 250 300 350 400 450 500 550
Time(sec)
1000
Slave 1
800 Slave 2 (50%)
Slave 3 (100%)
600
400
Offset from Master Clock (ns)
200
-200
-400
-600
-800
-1000
0 10 20 30 40 50 60 70 80 90 100
Time (sec)
400
Slave 1
Slave 2 (50%)
350
300
250
Number Sampels
200
150
100
50
0
-1500 -1000 -500 0 500 1000 1500
Offset from Master Clock (ns)
Figure 5.11: Precision of Hardware Assisted Time Synchronization under CPU Load
We have tried to find out possible effects on the precision but there is no consid-
5. Test and Measurements 29
erable change found in the precision of the synchronization. The figure 5.11 shows the
comparison of two slaves, slave 1 is not experiencing any simulated load and slave 2 is
stressed via 50% of CPU utilization. There is little change visible in the precision of
clocks but this observation goes wrongs, when we compare it with 100% load, because
with 100% load scenario there is no change found. So, it is concluded that there is no
change observed in the precision of clock in current type of network hierarchy and envi-
ronment. It is expected, there might be considerable effects in more stable PTP network
hierarchy.
1000
Slave 1
800 Slave 2 (I/O Load)
600
400
Offset from Master Clock (ns)
200
-200
-400
-600
-800
-1000
0 20 40 60 80 100 120 140 160 180 200
Time (sec)
×10 4
18
Slave 1
Slave 2 (1Mb)
16
Slave 3 (5Mb)
Slave 4 (10Mb)
14 Slave 5 (20Mb)
Slave 6 (50Mb)
Offset from Master clock (ns)
12
10
-2
0 5 10 15 20 25 30 35 40 45 50
Time (sec)
The figure 5.13 shows, slaves and their respective master clock expose to network
traffic between the range of 0Mb to 50Mb. It can be seen that, as the amount of the
network traffic grows the offset from the master clock also rises. let assume that the
0-5Mb network load comes under the category of Low network load and 10-50Mb is the
High load. First, we inspect the accuracy and precision in low network traffic and then
High network traffic.
5. Test and Measurements 31
30.000
Slave 1
25.000 Slave 2 (1Mb)
Slave 3 (5 Mb)
20.000
15.000
Offset from Master clock (ns)
10.000
5.000
-5.000
-10.000
-15.000
-20.000
-25.000
-30.000
0 5 10 15 20 25 30 35 40 45 50
Time (sec)
Figure 5.14: Hardware Assisted Time Synchronization under Network Load (Low)
2000
Slave 1 (1 Mb)
Slave 2 (5 Mb)
1800
1600
1400
Number of Sampels
1200
1000
800
600
400
200
0
-30.000 -25.000 -20.000 -15.000 -10.000 -5.000 0 5.000 10.000 15.000 20.000 25.000 30.000
Offset from Master Clock (ns)
Figure 5.15: Precision of Hardware Assisted Time Synchronization under Network Load
(Low)
The figure 5.14 shows the offset calculations of slaves under low network load. During
5. Test and Measurements 32
synchronization period of slave 1, there was no extra network traffic and the accuracy
was around ± 200 ns. On the other hand, while applying simulated network traffic of
1Mb and 5Mb on slave 2 and slave 3 the offset was remarkably advanced up-to ± 5us
and ± 15us respectively.
The precision of both slave clocks is also dissimilar, as it can be seen in figure 5.15
where slave 1 exposed to 1Mb of network traffics, most to the time offset was between the
normal range as compare to slave with network load but there are some measurements
where offset went up to ± 5000 ns. On the other hand, the slave with 5 Mb network
traffic is having very low precision and very uncertain behavior, where the measurement
samples are spread over the range of - 30000 to 30000 ns.
×10 4
18
Slave 4 (10Mb)
16 Slave 5 (20Mb)
Slave 6 (50Mb)
14
Offset from Master clock (ns)
12
10
-2
0 5 10 15 20 25 30 35 40 45 50
Time (sec)
Figure 5.16: Hardware Assisted Time Synchronization under Network Load (High)
In graph 5.16, three slaves are experiencing high network traffic, where the accuracy
is reached similar to software timestamping based solution. The slave 4-5 which are
having 10Mb and 20Mb of network traffic load, the offsets of these clocks reached up to
± 40000ns. On the other hand slave with 50Mb of network traffic have worst accuracy.
5. Test and Measurements 33
1200
Slave 1 (10 Mb)
Slave 2 (20 Mb)
Slave 3 (50 Mb)
1000
800
Number of Sampels
600
400
200
0
-150.000 -120.000 -90.000 -60.000 -30.000 0 30.000 60.000 90.000 120.000 150.000
Offset from Master Clock (ns)
Figure 5.17: Precision of Hardware Assisted Time Synchronization under Network Load
(High)
The graph above confirms that, as the bandwidth consumption’s of UDP stream
increases, the accuracy and precision of the clocks decreases.
Chapter 6
Conclusion
In software-based PTP synchronization network, the average offset of slave clocks re-
mained between ± 0.5ms, but there are some timespans where the offset of clocks
reached to 2ms with multi-slave synchronization model. Beside offset, the precision of
slave clocks was also dissimilar with same configuration and communication medium.
In hardware timestamping based PTP implementations, the long-term results were
very promising, where the accuracy of clock reached to approx 50ns. Overall in short-
term measurements and random test cases, the accuracy of 200ns was frequently achieved.
It is also observed that in a multi-slave synchronization scenario, the slaves showed sim-
ilar behavior in term of accuracy and precision.
The tests with CPU and I/O based load do not show any prominent change in accu-
racy of the clock on hardware-based solution. There are also chances that the changes
remained undetected due to smaller in scale. On the other hand, the test case scenarios
with alien network traffic showed striking results, where the accuracy went to the low-
est standard as compare other test case scenario including software timestamping based
solutions.
Overall, the difference between the hardware and software based timestamping was
significant. In load case scenarios, apparently network traffic based tests showed some
considerable effect. Expected effects from the CPU and I/O based tests, either did not
appear or we remained unable to detect them.
In order to regenerate results for further analysis or to setup a PTP hardware assisted
environment, the data form all tests case scenarios with a brief description is made
available, some of the tests are almost similar with little configuration change. A brief
guide to setup the PTP network is also made available in appendix section.
34
6. Conclusion 35
establishment are unaware of PTP network, and there can be undetected effects on PTP
network. Further study can be done in this area by comparing the results with PTP
supported network component. The results of simulated load based test case scenar-
ios are only from hardware assisted PTP solution, there might be different results in
software-based solution.
Appendix A
Beaglebone Black
Following two figures shows the specifications of Beagleboard family device which is
used as test-bed in the project.
36
A. Appendix: Technical Details 37
In order to establish test environment, there is need for a Linux kernel image with
required configuration for enabling hardware timestamping. Following are the Linux
kernel options need to be enabled for the support of hardware timestamping.
1 CONFIG_PPS
2 CONFIG_NETWORK_PHY_TIMESTAMPING (Only required for Timestamping in PHY )
3 PTP_1588_CLOCK
There are two prominent ways to get the Linux kernel with these options enabled. First,
download pre-compiled kernel, rootfs (Root file system) and bootloaders from a suitable
resource and write these components on a SDcard, then boot device form memory card.
Second, cross-compile a customized kernel and bootloader on a host machine, create a
root file system with required modules and then finally write these components on the
memory card in a standard manner.
Pre-Compiled kernel
The beagleboard community provides extensive support in development from beginner
level to advanced. There are different type of Beaglebone firmware image packages
available on their website (https://beagleboard.org/latest-images) with a detailed guide
to port images in Beaglebone black. In most of the images, the configurations required
for PTP support are already enabled.
38
B. Appendix: Installation Guide 39
Configuration Files
There will be two main files, containing layer and machine configuring bblayers.conf
local.conf. In bblayers.conf file looks like follows, where paths of inter-depended layers
are provided, these dependencies changes according to requirements. In local.conf file
the architecture and build process level configurations are defined.
B. Appendix: Installation Guide 40
After completing of the build process, the build directory will look like following, where
all the compiled and downloaded modules are saved. So, the next build will no take
much time.
1
2 mudassar@HP-250-G4-Notebook-PC:~/bbb$ tree -L 1 build/
3 build/
4 bitbake-cookerdaemon.log
5 cache
6 conf
7 downloads
8 sstate-cache
9 tmp
10
11
Creating Partitions
There are many scripts available to make partitions for BBB device. By using fdisk
utility one can utilize the extra space of memory card and make more partitions other
than necessary. Following snapshot show the process to make required partitions.
Formatting Partitions
Mounting Partitions
1 mkdir /mnt/sdd1
2 mkdir /mnt/sdd2
3 mount /dev/sdd1 /mnt/sdd1
4 mount /dev/sdd2 /mnt/sd2
1 cp MLO-beaglebone /mnt/sdd1/MLO
2 cp u-boot-beaglebone.img /mnt/sdd1/u-boot.img
Unmounting Partitions
1 umount /mnt/sdd1
2 umount /mnt/sdd2
Appendix C
There were multiple test conducted during this study but not all of them are discussed
and presented in the report.However, the data from all tests are made available after
preparing in form of MATLAB workspace file. One can regenerate the graphs and also
further investigate other tests which are not the part of this report. The table C1, C2
and C3 shows test and the abstract level configuration during test.
pure_Sw_offset_101 1 Software
pure_Sw_offset_106 1 Software
pure_Hw_offset_101 1 HW
pure_Hw_offset_106 1 HW
44
C. Appendix: Additional Tests and Measurements 45
Test ID PTP Demon Config Stress Test Config Load distribution Remarks
HwT1.4 8
Test ID PTP Demon Config Stress Test Config Load distribution Remarks
SwT1.1 1 raw
SwT1.3 1 filter
SwT1.4 8 filter
SwT1.5 8 raw
SwT1.18 8 filter CPU 100 Slave Only Can not able to set frequency
SwT1.19 8 filter CPU Manual-cpu Slave Only Can not able to set frequesncy
Literature
[1] D. W. Allan et al. “Precision oscillators: Dependence of frequency on temperature,
humidity and pressure”. IEEE Frequency Control Symposium (1992) (cit. on p. 3).
[2] AN-1838 IEEE 1588 Boundary Clock and Transparent Clock Implementation Us-
ing the DP83640. Tech. rep. SNLA104A. Edwards, CA: Texas Instruments Incor-
porated, Apr. 2013. url: http://www.ti.com/lit/an/snla104a/snla104a.pdf (cit. on
pp. 6, 7).
[3] Markus Seehofer. Andreas Dreher Dirk Mohl. Precision Clock Synchronization –
IEEE 1588 (White Paper Rev 1.2). Version 1.2. url: http://www.hirschmann.co
m (cit. on pp. 5, 9).
[4] Markus Seehofer. Andreas Dreher Dirk Mohl. Precision Clock Synchronization –
IEEE 1588 (White Paper Rev 2.0). Version 2.0. url: http://www.hirschmann.co
m (cit. on p. 3).
[5] Suchit Lapcha Changrong Li and Mingkai Hu. IEEE 1588 for Telecom and Net-
working Applications. Tech. rep. FTF-NET-F0102. NXP Freescale Technology Fo-
rum(FTF), June 2012. url: https://www.nxp.com/files-static/training_pdf/FTF
/2012/americas/WBNR_FTF12_NET_F0102.pdf (cit. on p. 4).
[6] Cisco Nexus 3000 Series NX-OS System Management Configuration Guide, Re-
lease 5.0(3)U3(1). Tech. rep. OL-26558-01. Cisco Systems Networking hardware
company. url: https://www.cisco.com/c/en/us/td/docs/switches/datacenter/ne
xus3000/sw/system_mgmt/503_U3_1/b_Cisco_n3k_System_Mgmt_Config_5
03_U3_1/b_Cisco_n3k_System_Mgmt_Config_503_U3_1_chapter_0101.pdf
(cit. on pp. 6, 7).
[7] Richard Cochran and Cristian Marinescu. “Design and Implementation of a PTP
Clock Infrastructure for the Linux Kernel”. International IEEE Symposium on,
Sep. 27–Oct 1 (2010), pp. 116–121 (cit. on pp. 11, 12, 14, 15).
[8] John Eidson. Tutorial on IEEE 1588. Tech. rep. Agilent Technologies, Inc, Oct.
2005. url: https://www.nist.gov/sites/default/files/documents/el/isd/ieee/tutorial
-basic.pdf (cit. on p. 4).
47
References 48
[9] Geoffrey M. Garner. IEEE 1588 Version 2. Tech. rep. 2008 International IEEE
Symposium on Precision Clock Synchronization for Measurement, Control and
Communication, Sept. 2008. url: http://passthrough.fw-notify.net/download/57
0185/http://www.ieee802.org/1/files/public/docs2008/as-garner-1588v2-summary
-0908.pdf (cit. on pp. 6, 7, 9).
[10] IEEE Std 1588 -2002. IEEE Standard for a Precision Clock Synchronization Pro-
tocol for Networked Measurement and Control Systems. url: https://standards.i
eee.org/findstds/standard/1588-2002.html (cit. on pp. 4, 6, 10).
[11] IEEE Std 1588-2008 (Revision of IEEE Std 1588-2002). IEEE Standard for a Pre-
cision Clock Synchronization Protocol for Networked Measurement and Control
Systems. July 24, 2008. url: https://standards.ieee.org/findstds/standard/1588-2
008.html (cit. on pp. 4, 7, 9, 10).
[12] Mike Gilson Jean-Loup Ferrant. Synchronous Ethernet and IEEE 1588 in Tele-
coms. Next Generation Synchronization Networks. 1st ed. London: ISTE Ltd, 2013
(cit. on p. 3).
[13] Nick Barendt Kendall Correll and Michael Branicky. “Design Considerations for
Software Only Implementations of the IEEE 1588 Precision Time Protocol”. IEEE
1588 Conference, Zurich, October 2005 1 (2005) (cit. on p. 11).
[14] Kevin B. Stanton Patrick Ohly David N. Lombard. “Hardware Assisted Precision
Time Protocol.Design and case study.” in Proceedings of LCI International Con-
ference on High-Performance Clustered Computing.2008 1 (2008) (cit. on pp. 8,
11, 14, 16).
[15] Cristian Marinescu Richard Cochran and Christian Riesch. “Synchronizing the
Linux System Time to a PTP Hardware Clock.” Precision Clock Synchronization
for Measurement Control and Communication (ISPCS), 2011 International IEEE
Symposium on 12-16 Sept. 2011 1 (2011) (cit. on pp. 11, 16, 17).
[16] Steve T. Watt. “Understanding and Applying Precision Time Protocol”. Power
and Energy Automation Conference, March 2014 (2014), pp. 2–3 (cit. on p. 10).
Online sources
[17] IEE 1588. url: https://www.nist.gov/el/intelligent-systems-division-73500/introdu
ction-ieee-1588 (cit. on p. 4).
[18] Linux Kernel Documentation: Timestamping Control Interfaces. url: https://ww
w.kernel.org/doc/Documentation/networking/timestamping.txt (cit. on pp. 13, 14).
[19] Time-Stamping and Time Synchronization. url: https://docs.napatech.com/read
er/897VV1LF3lshs6Q23PkgzQ/5TKHcCpFK5gUCnKBkD7shQ (cit. on p. 9).
[20] Yocto Project Documentaion. url: https://https://www.yoctoproject.org/docs/
(cit. on p. 38).