Professional Documents
Culture Documents
Syn1588 User Guide
Syn1588 User Guide
0 Legals
Copyright © 2006-2011 Oregano Systems – Design & Consulting GesmbH
ALL RIGHTS RESERVED.
Oregano Systems does not assume any liability arising out of the application or use of any
product described or shown herein nor does it convey any license under its patents,
copyrights, or any rights of others.
Licenses or any other rights such as, but not limited to, patents, utility models, trademarks or
tradenames, are neither granted nor conveyed by this document, nor does this document
constitute any obligation of the disclosing party to grant or convey such rights to the receiving
party.
Oregano Systems reserves the right to make changes, at any time without notice, in order to
improve reliability, function or design. Oregano Systems will not assume responsibility for the
use of any circuitry described herein.
All trademarks used in this document are the property of their respective owners.
page 2
®
syn1588 User Guide
0.1 Versions
Version 0.1, May 13th 2009
• Document created
Version 0.2, May 20th 2009
• Document extended.
Version 0.3, June 10th 2009
• Document extended.
Version 0.4, August 4th 2009
• Document extended.
Version 0.5, August 14th 2009
• Added syn1588app utility description. Added frequency option to Linux driver.
Version 1.0, August 18th 2009
• Moved data from API AN to this UG. Added description for synchronizing the system
clock (currently Linux only)..
Version 1.1, December 22nd 2009
• Chapter about the syn1588® PTP Management Tool extended.
Version 1.2, January 14th 2010
• Added info about new release of syn1588® in Q1/2010.
• Section about the FreeBSD driver included.
Version 1.3, January 14th 2010
• Re-formatted
Version 1.4 July 15th 2010
• Re-formatting
• Chapter 7 updated
Version 1.5 September 22nd 2010
• Expanded syn1588® VIP Chapter
Version 1.6 October 28th 2010
• Expanded syn1588® LiveCD Chapter
• Introduction of chapter about the syn1588® PTP Stack protocol version 1
• Update of procedures to synchronize the system clock
Version 1.7 May 28th 2011
• Update of PTP Stack features
• Several enhancements
page 3
®
syn1588 User Guide
Contents
0 Legals.............................................................................................................................. 2
0.1 Versions .................................................................................................................... 3
0.2 List of Figures ........................................................................................................... 9
0.3 List of Tables........................................................................................................... 10
1 syn1588® Product Overview .......................................................................................... 12
1.1 syn1588® Network Interface Cards.......................................................................... 12
1.2 syn1588® Gbit Switch .............................................................................................. 13
1.3 syn1588® Clock IP Cores ........................................................................................ 15
1.4 syn1588®VIP ........................................................................................................... 17
1.4.1 A Fully Integrated Single Chip IEEE1588 Solution ............................................ 17
1.5 syn1588® Software .................................................................................................. 19
2 syn1588® Application Scenarios .................................................................................... 21
2.1.1 syn1588® in SoC Designs ................................................................................. 21
2.1.2 syn1588® in µC/µP Board Designs ................................................................... 22
2.1.3 syn1588® in Ethernet Network Component Designs ......................................... 23
2.1.4 syn1588® in Automation Systems ..................................................................... 24
2.1.5 syn1588® in Measurement Systems ................................................................. 25
2.1.6 syn1588® in Communication Systems .............................................................. 25
2.1.7 syn1588® in Many Other Systems..................................................................... 27
3 syn1588® PCI NIC ......................................................................................................... 29
3.1 Features.................................................................................................................. 30
3.2 Functional Description............................................................................................. 31
3.3 Technical Specifications .......................................................................................... 32
3.4 Installing the syn1588® PCI NIC Hardware.............................................................. 33
3.5 Testing the syn1588® PCI NIC with the syn1588® Live CDROM ............................. 33
3.6 Installing the syn1588® PCI NIC Software ............................................................... 33
3.6.1 Linux OS ........................................................................................................... 34
3.6.2 Windows OS ..................................................................................................... 34
3.7 Register Map........................................................................................................... 35
3.7.1 Register Description ......................................................................................... 37
3.7.1.1 Version Register (SYN1588_VER) ............................................................. 37
3.7.1.2 Receive Timestamp FIFO Data Register (TSFIFO0_RX) ........................... 37
3.7.1.3 Transmit Timestamp FIFO Data Register (TSFIFO0_TX) ........................... 38
3.7.1.4 Transmit Timestamp FIFO Data Register (TSFIFO1_RX) .......................... 38
3.7.1.5 Transmit Timestamp FIFO Data Register (TSFIFO1_TX) ........................... 38
3.7.1.6 Timestamp FIFO Status Register (TSFIFO0_STATUS).............................. 39
3.7.1.7 Timestamp FIFO Status Register (TSFIFO1_STATUS).............................. 39
3.7.1.8 Interrupt Source Register (IRSRC) ............................................................. 40
3.7.1.9 Interrupt Enable Register (IREN) ................................................................ 41
3.7.1.10 Time Control Register (TIMECTRL)............................................................ 41
3.7.1.11 Event Control Register (EVENTCTRL) ....................................................... 42
3.7.1.12 Shadow Pure-Step Register (SHDWSTEPPU_L) ....................................... 43
3.7.1.13 Shadow Pure-Step Register (SHDWSTEPPU_H) ...................................... 43
3.7.1.14 Shadow Time Register (SHDWTIME_L) ..................................................... 43
3.7.1.15 Shadow Time Register (SHDWTIME_M) .................................................... 43
3.7.1.16 Shadow Time Register (SHDWTIME_H) .................................................... 43
3.7.1.17 Time Register (TIME_L) ............................................................................. 44
3.7.1.18 Time Register (TIME_M) ............................................................................ 44
3.7.1.19 Time Register (TIME_H) ............................................................................. 44
page 4
®
syn1588 User Guide
page 5
®
syn1588 User Guide
page 6
®
syn1588 User Guide
page 7
®
syn1588 User Guide
page 8
®
syn1588 User Guide
page 9
®
syn1588 User Guide
page 10
®
syn1588 User Guide
page 11
®
syn1588 User Guide
®
Figure 1: syn1588 PCIe NIC
Both syn1588® NICs support all features of a standard Ethernet network card, one via a 32-
bit PCI, the other via a single lane PCI Express interface. Additionally, the syn1588® NICs
are equipped with dedicated hardware supporting IEEE1588 functions like highly accurate
timestamping and high-precision high resolution clocks. Optionally both cards may be
equipped with an OCXO resulting in an extended frequency stability thus making them suited
for operating as a IEEE1588 Master Clock. For further information see Chapter 3 and
Chapter 4 of this user guide respectively.
page 12
®
syn1588 User Guide
®
Figure 2: syn1588 PCI NIC
page 13
®
syn1588 User Guide
®
Figure 4: syn1588 Gbit Switch
page 14
®
syn1588 User Guide
mii0_txd_to_phy_o<7:0>
mii0_txd_from_mac_i<7:0>
mii0_txer_i
mii0_txdv_i
mii0_txclk_i
mii0_rxd_to_mac_o<7:0>
mii0_rxd_from_phy_i<7:0>
mii0_rxer_i
mii0_rxdv_i
mii0_rxclk_i
SYN1588Clock_MX
mii_txd_to_phy_o<7:0>
mii1_txd_to_phy_o<7:0> Core
mii_txd_from_mac_i<7:0> ahb_s_irq_o
mii1_txd_from_mac_i<7:0> ahb_s_irq_o
ahb_s_sel_i
mii_txer_i ahb_s_sel_i
mii1_txer_i mii_txd<3:0>
ahb_s_addr_i<8:2>
mii_txdv_i ahb_s_addr_i<8:2>
ahb_s_wdata_i<31:0> mii1_txdv_i mii_txdv mosi
ahb_s_wdata_i<31:0>
mii_txclk_i ahb_s_rdata_o<31:0> mii_txclk miso
SYN1588Clock_M mii1_txclk_i ahb_s_rdata_o<31:0> SYN1588Clock_S
ahb_s_trans_i<1:0>
mii_rxd_to_mac_o<7:0> Core mii1_rxd_to_mac_o<7:0>
ahb_s_trans_i<1:0> mii_rxd<3:0> Core sck
ahb_s_write_i
mii_rxd_from_phy_i<7:0> ahb_s_write_i
ahb_s_size_i<2:0> mii1_rxd_from_phy_i<7:0> mii_rxdv ss_n
ahb_s_size_i<2:0>
mii_rxer_i ahb_s_burst_i<2:0> mii_rxclk
mii1_rxer_i ahb_s_burst_i<2:0>
ahb_s_ready_i
mii_rxdv_i ahb_s_ready_i
mii1_rxdv_i
ahb_s_ready_o
ahb_s_ready_o
mii_rxclk_i
onepps_o
trigger_o
period_o
ahb_s_resp_o<1:0> mii1_rxclk_i
event_i
ahb_s_resp_o<1:0>
reset_i
clk_i
clockid_i<63:0>
gmii_modesel_i
gmii1_modesel_i
clockid_i<63:0>
trigger_o<1:0>
period_o<1:0>
trigger_o<1:0>
period_o<1:0>
event_i<1:0>
event_i<1:0>
onepps_o
onepps_o
pwm_o
reset_i
pwm_o
reset_i
clk_i
clk_i
®
syn1588
Basic Parameters Clock_S Clock_M Clock_MX Clock_L
bus interface SPI AHB AHB AHB
external/internal interrupts 0/- 1/12 1/12 1/16..27
trigger outputs 1 2 2 1..4
period timer outputs 1 2 2 1..4
separate one PPS output X X X -
MII event inputs 1 1 2 1..2
event inputs 1 2 2 1..4
core time registers 1 1 1 1..4
negative time values supported / handled -/- -/X -/X -/X
IP core parameter readout - - - X
clock core width 104 104 104 104
timer / event precision 64/64 64/64 64/64 64/96
Timestamping Engine Clock_S Clock_M Clock_MX Clock_L
page 15
®
syn1588 User Guide
®
syn1588
on-the-fly timestamping support - - - -
packet FIFOs 2 2 2 1
separated RX & TX / device FIFOs X/- X/- X/- X/X
packet FIFO width [bit] 32 32 32 64
packet FIFO depth [Entries] / [Packets] 256 256/85 256/85 64+/6+
packet FIFO stores ID X X X X
packet FIFO full/empty flag X/X X/X X/X X/X
packet FIFO stores accuracies - - - X
timestamp clear / readout time [clock cycles] 24/24 24/24 24/24 20/30
timestamp storage can be disabled - - - X
®
syn1588
Distributed System Support Clock_S Clock_M Clock_MX Clock_L
apply time (set registers on time) - - - X
amortisation / precision [ns] - - - X/1
stable frequency output support - - - X
programmable interrupt time - X X X
accuracy counters 0 0 0 0..2
event loopback (trigger, period timer), high - - - X
precision readout
free running period timer (no CPU load) X X X X
period timer startable manual / trigger / IRQ time X/1/- X/2/X X/2/X X/2/X
Ethernet bridging support - - - X
function blocking readout (clock overflow pending) - - - X
Hard Real-Time support Clock_S Clock_M Clock_MX Clock_L
Lost IRQ readout - - - X
IRSRC auto. Clear - - - X
Consistent event time readout check - - - X
Legend:
X ..... supported
+ ..... partly supported
- ....... not yet supported
The Oregano Systems PCI Ethernet NIC is a typical application for the syn1588®Clock IP
cores. It combines the syn1588®Clock_M IP core with a PCI controller and an Ethernet MAC
in a single FPGA device suited for cost sensitive industrial applications. It enables conven-
tional PCs to support highly accurate clock synchronisation following IEEE1588 allowing
accuracies of less than 100 ns to be achieved. Please see the product related website at
http://www.oregano.at/ for further details regarding any of the IP cores mentioned above.
page 16
®
syn1588 User Guide
1.4 syn1588®VIP
The syn1588®VIP fully integrated single chip IEEE1588 solution contains everything that is
needed for a complete IEEE1588 implementation with hardware time stamping. Figure 6
shows a block diagram of the major blocks of the syn1588®VIP IP-Core.
The syn1588®VIP design is based on three major blocks. A 10/100/1000 Mbit Ethernet MAC,
an IEEE1588 based hardware clock unit and a simple offload engine which is an 8 bit
MC8051 CPU.
The task of the Ethernet MAC is to send Ethernet packets generated by the CPU and receive
Ethernet packets and forward them to the CPU. There is also a packet filter implemented into
the Ethernet MAC. This packet filter takes care that the CPU only receives IEEE1588 related
packets and does not need to spend precious CPU cycles on processing non IEEE1588
related packets. Optionally all non IEEE1588 related packets can be forwarded to an optional
more powerful main CPU for processing.
The clock unit is a high accuracy IEEE1588 based hardware clock. The main responsibility of
the clock unit is to keep the high accuracy system time and provide timestamps.
The Ethernet MAC in combination with the clock unit is capable of IEEE1588 hardware time
stamping, which leads to high accuracy time stamps for incoming and outgoing network
packets.
The network packets from the Ethernet MAC and the high accuracy timestamps from the
clock unit are processed by the offload engine which is a 8bit MC8051 CPU. With the
hardware time stamping of the MAC and the high accuracy timestamps of the clock unit
IEEE1588 clock synchronization in the nanosecond range can be achieved.
page 17
®
syn1588 User Guide
The syn1588®VIP IP Core includes all clock related processing encapsulated within the
intellectual property core and provides a system with a high accuracy synchronized clock
without having it to run any dedicated code. The design is ideally suited for embedded
systems or system-on-chip designs not willing to contaminate the application software with
clock synchronization or protocol code or simply seeking a simple and cost effective solution.
Figure 6 shows a block diagram of the syn1588® VIP IP-Core.
Since the syn1588®VIP IP Core is a standalone system it is also offered as a single chip
solution. Figure 7 shows a symbolic Lattice FPGA which contains the syn1588® VIP design.
®
Figure 7: syn1588 VIP Single Chip
To ease test and evaluation of our syn1588®VIP single chip solution we also provide an
evaluation board, which can be seen in Figure 8. The PCB design data of this evaluation
board is available for our syn1588® customers free of charge upon request.
®
Figure 8: The syn1588 VIP Evaluation Board
page 18
®
syn1588 User Guide
page 19
®
syn1588 User Guide
page 20
®
syn1588 User Guide
SoC designs targeted for various application domains support Ethernet communication by
having one or more Ethernet media access controllers and even the Ethernet physical layer
already on-chip. Adding the Oregano Systems syn1588 Clock cores to such a
communication system is very simple. The standardized media independent interface (MII)
between the Ethernet MAC and the PHY is split and the syn1588 Clock core is inserted. To
allow access to the core’s registers, the syn1588Clock cores implement a 32-bit AHB slave
interface together with one interrupt line. Since both interfaces, the MII and the AHB, are
standardized and well established, seamless integration of both the Oregano Systems
syn1588Clock_L and syn1588Clock_M core is achieved with minimal design effort.
To be able to access trigger and timer outputs as well as the event timestamp inputs of the
core, those I/Os have to be routed to the outside of the SoC (see Figure for a principal
overview).
page 21
®
syn1588 User Guide
UARTs
CPU
DMA
AHB system bus
MII MII
Ethernet SYN1588 Ether
PCI net
MAC Clock PHY
Trigger +
Event I/Os
The registers of the syn1588Clock are accessible via an SPI interface, thus reducing the
board complexity traces to a minimum. The core is passively connected to the MII interface
and monitors the inbound and outbound traffic for clock synchronization packets. To make
use of the trigger and timer outputs as well as the event timestamp inputs of the core, these
I/Os will have to be made available on board-level according to the needs of the specific
application.
page 22
®
syn1588 User Guide
Memory
Trigger +
µC/µP with internal SPI SYN1588 Event I/Os
Ethernet MAC Clock
Figure 10: Principal µC/µP board block diagram containing syn1588Clock functionality.
page 23
®
syn1588 User Guide
MII
MII MII Ether
Ether Ethernet
SYN1588 Ethernet net
net PHY MAC
PHY Clock MAC
a b
Figure 11: a) Principal solution for an integrated network controller chip. b) Principal solution
for a network interface card with controller and PHY separated.
In the recent past industrial automation systems are increasingly using Ethernet networks
also on the field level, thus often replacing proprietary bus systems with high bandwidth,
cheap and standardized network technology. In order to guarantee message delivery
(collisions) and quality of service (network delay) most solutions rely on a Time Division
Multiple Access (TDMA) strategy for exchanging information via the Ethernet network. This,
however, requires all participants to have a common notion of time and it is this same
IEEE1588 compatible clock synchronization mechanism that is being used in related product
development and standardization efforts. All Oregano Systems syn1588 cores perfectly
support this application area, as they provide, for example, a simple means to build a
distributed PLL. The core may be configured via software to output a pulse of given length at
a given frequency. Finally every node has to be configured e.g. using its address with a
unique offset with respect to the local clock of the core (see Figure 12).
Besides making a TDMA based network possible syn1588® clock synchronization has to
offer far more benefits to industrial automation applications. Things like sequence of events
or measurements, scheduled trigger outputs, time-stamped data logs, synchronized
actuation, or transition from mechanical line shafts to distributed motion control are only a
few to mention.
page 24
®
syn1588 User Guide
®
Figure 12: Distributed PLL using syn1588 Technology
For the entire system to be able to profit from a common notion of time, dedicated support in
the sensor as well as actuator interface hardware as explained in Sections 2.1.1, 2.1.2, 2.1.3,
and 2.1.4 respectively is necessary (see Figure 13). This is especially true for clock
synchronization below the microsecond range.
Measurement systems per nature rely on triggers, synchronization of events, or relating data
samples with respect to time to calculate e.g. offsets. In the recent past measurement
equipment has been quickly stepping towards using Ethernet technology to interconnect
instruments such as oscilloscopes, network analyzers, timing analyzers, pattern generators,
frequency generators, or even DMM the like. It is very clear that these systems strongly
benefit from a precisely synchronized common notion of time. All Oregano Systems
syn1588® cores perfectly support this application area (see Figure 14).
Traditionally communication systems have been using precision oscillators and hierarchical
clock distribution in by means of dedicated hardware, which often was distributed in space.
By the use of synchronized clocks such system can benefit significantly.
page 25
®
syn1588 User Guide
Ethernet Switch
Figure 13: Principal system setup for an application of clock synchronization in industrial
automation.
By establishing a common notion of time with precisions below the microsecond range a
distributed sample clock can be realized, which allows to sample e.g. voice data with 8 kHz
or 16 KHz completely synchronous in the entire system by means of setting up a distributed
PLL running at, for example, the respective sampling frequency or a multiple of it. Local
codec devices or even analog PLLs may be locked on this frequency.
Ethernet Switch
Figure 14: Example setup for measurement equipment supporting clock synchronization.
This, however, requires all participants to have a common notion of time. The IEEE1588
compatible clock synchronization mechanism that is being used in related product
development and standardization efforts fulfils these requirements. As a consequence all
Oregano Systems syn1588® cores perfectly support this application area (see Figure 15).
page 26
®
syn1588 User Guide
Ethernet Switch
Figure 15: Example setup for a communication network, which uses synchronized clocks.
For the entire system to be able to profit from the common notion of time, dedicated support
in the measurement equipment’s network interface hardware as explained in Sections 2.1.1,
2.1.2, and 2.1.3 respectively is necessary. This is especially true for clock synchronization
below the microsecond range.
The previous sections have arbitrarily highlighted some possible and already existing
application areas of clock synchronization and Oregano Systems syn1588® technology.
Many more systems and possible applications could profit or even be realized for the first
time with this technology. Do not hesitate to contact Oregano Systems for questions or any
further information concerning clock synchronization.
page 27
®
syn1588 User Guide
page 28
®
syn1588 User Guide
®
Figure 16: syn1588 PCI NIC
As the hardware assisted time stamping mechanism has been designed using a generic
architecture, the syn1588® network card supports both version 2002 and version 2008 of the
IEEE1588 standard. Oregano Systems offers the Precision Time Protocol (PTP) Stack
supporting either version 2002 or version 2008 of the IEEE1588 standard.
page 29
®
syn1588 User Guide
3.1 Features
• 10/100 Mbit/s Ethernet network interface card compliant to IEEE802.3-2000
• Fully compliant to IEEE1588-2002 (also referred to as IEEE1588 version 1.0)
• Fully compliant to IEEE1588-2008 (also referred to as IEEE1588 version 2.0)
• IEEE1588 hardware timestamping supported
• Two-step as well as one-step timestamping supported
• Clock accuracy up to 50 ns
• Linux driver available (binary and source included with the NIC)
• Windows driver available (binary included with the NIC)
• syn1588® PTP Stack available for Linux and Windows (binary included with the NIC)
• Supports all IEEE1588 version 2008 enhancements
o Transparent clocks
o Management messages
o Unicast messages
• 32 bit PCI card (full height)
• supporting both 5 V as well as 3V3 PCI slots compliant to PCI 2.3
• Four programmable I/O signals routed to SMA jacks (3V3 LVCMOS)
• Two independent and programmable timestamping units available for receive and
transmit, enabling parallel timestamping of user specified packets
• Operating temperature range 0 – 50°C
Optional features:
• 80-pin module connector enabling project/user specific extensions
• Connectivity to an external GPS receiver via a 1pps input as well as the serial port of the
host PC
page 30
®
syn1588 User Guide
The syn1588® PCI NIC module may be equipped with various types of local oscillators
allowing the quality of the synchronization and thus the system performance to be tailored to
the accuracy requirements. Those oscillator options are available upon request.
Figure 18 shows the detailed block diagram of the syn1588® NIC FPGA design. The device
contains a PCI controller core to which both a media access controller (MAC) core and the
syn1588®Clock_M clock synchronization core are attached over an internal 32-bit AHB bus
interface.
The MAC controller is supplied with a 25 MHz clock and is directly wired to the physical layer
IC. It handles both Ethernet data traffic and configuration and control of the physical layer IC
via the serial MDC (media device control) interface.
The syn1588®Clock_M IP core operates as a stand-alone entity and is accessible via a
separate memory map. However, it shares the PCI controller with the MAC.
page 31
®
syn1588 User Guide
FPGA
Ethernet Core
TX control TX Phy control
signals MAC signals
TX Ethernet
TX Data MAC TX Data
Flow control
PCI Host Signals MAC Control RJ45
Bus Interface Module Jack
(Register, Ethernet
Bus RX control RX Phy control PHY
AHB bus signals
map signals
interface,
PCI - DMS RX Ethernet
Core RX Data MAC RX Data
support)
Management
MII Data
Management
Management
signals
Modul
25 MHz
® SMA
Syn1588 Clock M - Core
25 MHz or 100MHz
high percision OCXO SMA
SMA
SMA
® ®
Figure 18 Block diagram of the complete syn1588 NIC design syn1588 PCI NIC
page 32
®
syn1588 User Guide
3.5 Testing the syn1588® PCI NIC with the syn1588® Live CDROM
The syn1588® Live CDROM simplifies using the syn1588® PCI NIC. No software installation
task is required. One just boots the PC using the syn1588® Live CDROM. The syn1588® Live
CDROM boots a pre-configured Linux.
For further details on using the syn1588® Live CDROM please refer to Chapter 10.
page 33
®
syn1588 User Guide
3.6.1 Linux OS
3.6.2 Windows OS
page 34
®
syn1588 User Guide
page 35
®
syn1588 User Guide
page 36
®
syn1588 User Guide
A detailed description of the contents of every register is given below. Keep in mind that no
checks of the validity of the data written to any registers of the syn588® NIC is made, thus
false data may corrupt the clock stability, the clock servo and other functions of the syn1588®
NIC.
SYN1588_VER(31:0) 4 digit ASCII version id, coded in the manner of the following example:
‘M’ .. 4dh,
‘2’ .. 32h .. major version id
nd
‘1’ .. 31h .. minor version id 2 digit
st
‘0’ .. 30h .. minor version id 1 digit
page 37
®
syn1588 User Guide
Every timestamp is made up of four or six entries in the TSFIFO, depending on the version of
the clock synchronization protocol used. The first two entries are the ClockID, followed by the
port number and sequence ID for version 2008, MAC ID and sequence ID for version 2002.
The remaining entries are the timestamp itself; two entries (64 bit) for version 2002 and three
entries (96 bit) for version 2008 (upper 16 bit are zero padded) starting with the most
significant word first.
page 38
®
syn1588 User Guide
page 39
®
syn1588 User Guide
Writing a 0 to a bit clears the bit. Writing 1 to a bit does not influence its contents. Whenever
one of the above mentioned sources issues an interrupt the corresponding bit in the IRSRC
register is set and the interrupt line to the CPU is activated, if the appropriate bit in IREN is
set to 1.
page 40
®
syn1588 User Guide
TIMECTRL(0) 1 loads all registers simultaneously with the values of their shadow
registers.
TIMECTRL(1) 0 .. two-step mode of transmit time stamping unit
1 .. one-step mode of transmit time stamping unit
TIMECTRL(28:2) N/A
TIMECTRL(29) 1 enables load of the Step Register for the amortisation phase with the
contents of its shadow register SHDWSTEP.
TIMECTRL(30) N/A
TIMECTRL(31) 1 enables load of the Time Register TIME with the contents of its shadow
register SHDWTIME.
page 41
®
syn1588 User Guide
Whenever the input event_i(0) or event_i(1) exhibits a transition from 0 to 1 and the related
enable bit (i.e. EVENTCTRL(0) or EVENTCTRL(1)) is set to 1, further the corresponding flag
(i.e. IRSRC(10) or IRSRC(11)) is set to 1 and an interrupt to the CPU is generated, if enabled
in IREN.
Whenever the registers TRIGGERTIME0 or TRIGGERTIME1 are equal or smaller to the
corresponding value of the TIME register, the bits IRSRC(12) and IRSRC(13) respectively
are set. At the same time the outputs trigger_o(0) or trigger_o(1) are set to one. Bits are
cleared with next access to IRSRC register.
page 42
®
syn1588 User Guide
SHDWSTEPPU_L Lower 32 bit for the new value of the step size.
(31:0)
The 32 bits of this register will be added to the bits 23:-8 of the Time Register.
SHDWSTEPPU_H Upper 32 bit for the new value of the step size.
(31:0)
The 32 bits of this register will be added to the bits 55:24 of the Time Register.
SHDWTIME_L(31:0) Lower 32 bit of the value that is copied into the TIME register.
SHDWTIME_M(31:0) Middle 32 bit of the value that is copied into the TIME register. Note that bit
31:30 are forced to 0.
SHDWTIME_H(31:0) Upper 32 bit of the value that is copied into the TIME register.
page 43
®
syn1588 User Guide
TIME_L(31:0) Lowest 32 bit of the current time value. A read access causes a
simultaneous update of all four time registers with the current time of the
high accuracy clock
The unit of this register is sub nsec
TIME_M(31:0) Middle 32 bit of the current time. The value is updated only with the read
access to TIME_L. Note that the absolute value is limited to 10^9 in
conformance to the IEEE1588 standard.
The unit is nsec.
TIME_H(31:0) Upper 32 bit of the current time. The value is updated only with the read
access to TIME_L.
The unit is Seconds
TIME_E(31:0) Extended 16 bits of the current time The value is updated with the read access to
TIME_L.
The unit is 2^32 Seconds
Only the lower 16 bits are valid, the high word of this register is undefined.
page 44
®
syn1588 User Guide
EVENTTIME0_L(31:0) Lower 32 bit of the time the last event on input event_i<0> occurred.
These bits correspond to the bits (63:32) of the TIME register.
The fifo value gets updated to the next value with each read of the
EVENTTIME0_H register. So the read order of those two registers is
important. Read the EVENTTIME0_L first and the EVENTTIME0_H last.
EVENTTIME0_H(31:0) Upper 32 bit of the time the last event on input event_i<0> occurred.
These bits correspond to the bits (95:64) of the TIME register.
Read the description of EVENTTIME0_L for the correct usage of this
register.
page 45
®
syn1588 User Guide
EVENTTIME1_L(31:0) Lower 32 bit of the time the last event on input event_i<1> occurred.
These bits correspond to the bits (63:32) of the TIME register.
EVENTTIME1_H(31:0) Upper 32 bit of the time the last event on input event_i<1> occurred.
These bits correspond to the bits (95:64) of the TIME register.
Lower 32 bit of the time the trigger_o<0> output shall be set to 1. These
bits correspond to the bits (63:32) of the TIME register.
page 46
®
syn1588 User Guide
TRIGTIME0_H(31:0) Upper 32 bit of the time the trigger_o<0> output shall be set to 1. These
bits correspond to the bits (95:64) of the TIME register.
To reset this trigger clear the corresponding bit in the IRSRC register.
TRIGTIME1_L(31:0) Lower 32 bit of the time the trigger_o<1> output shall be set to 1. These
bits correspond to the bits (63:32) of the TIME register.
TRIGTIME1_H(31:0) Upper 32 bit of the time the trigger_o<1> output shall be set to 1. These
bits correspond to the bits (95:64) of the TIME register.
To reset this trigger clear the corresponding bit in the IRSRC register.
page 47
®
syn1588 User Guide
The 64 bits of the registers PERIODTIME_L and PERIODTIME_H contain the amount of
time (notably not the number of clock cycles) to elapse after the last interrupt has been
triggered. At the point in time the periodical timer is enabled (by setting bit EVENTCTRL(4)
to 1), the contents of this register will be added to the actual contents of the Time Register at
position 79:16. The result will be stored in a separate register and if the contents of bits 80:16
of the Timer Register are equal or greater than the before registered value, the interrupt is
launched IRSRC(24). If now the periodical timer is still enabled (EVENTCTRL(4) still set to 1)
the next period is started immediately.
page 48
®
syn1588 User Guide
The 64 bits of the registers PERIODTIME1_L and PERIODTIME1_H contain the amount of
time (notably not the number of clock cycles) to elapse after the last interrupt has been
triggered. At the point in time the periodical timer is enabled (by setting bit EVENTCTRL(5) to
1), the contents of this register will be added to the actual contents of the Time Register at
position 79:16. The result will be stored in a separate register and if the contents of bits 80:16
of the Timer Register are equal or greater than the before registered value, the interrupt is
launched IRSRC(25). If now the periodical timer is still enabled (EVENTCTRL(5) still set to
1) the next period is started immediately.
OSCPWM_CTRL(31) 0 inserts 0
1 inserts 1
OSCPWM_CTRL(16:0) Counter value for inserting 1 or 0 at the PWM output
Periodically inserts 1 or 0 till the counter reaches the value in the register OSZPWM_CTRL
(16:0). After the Value is reached, the PWM output toggles with each clock cycle till the
counter reaches the overflow and starts with value 0. 1 is inserted if the value of highest bit in
the register is set to 1, else there is 0 inserted. Valid values for the counter are 0x000 to
0x100. Value 0x000 the PWM output toggles permanent and with 0x100 the PWM output is
constant 1 or 0, depends on the bit 31 of the OSCZPWM_CTRL register.
The OSZPWM_CTRL register is used to alter the control voltage of an OCXO, if one is
installed on the board. This is used to fine tune the oscillator frequency of the OCXO.
page 49
®
syn1588 User Guide
page 50
®
syn1588 User Guide
IOMATRIX(31-28) reserved
IOMATRIX(27) Level definition for SMA connector 3 input (X5)
0 = high active
1 = low active (inverted internally)
IOMATRIX(26) Level definition for SMA connector 2 input (X6)
0 = high active
1 = low active (inverted internally)
IOMATRIX(25) Level definition for SMA connector 1 input (X7)
0 = high active
1 = low active (inverted internally)
IOMATRIX(24) Level definition for SMA connector 0 input (X4)
0 = high active
1 = low active (inverted internally)
IOMATRIX(23:20) Source definition for event 1 input of syn1588®Clock_M
IOMATRIX(19:16) Source definition for event 0 input of syn1588®Clock_M
IOMATRIX(15:12) Source definition for SMA connector 3 output (X5)
IOMATRIX(11:8) Source definition for SMA connector 2 output (X6)
IOMATRIX(7:4) Source definition for SMA connector 1 output (X7)
IOMATRIX(3:0) Source definition for SMA connector 0 output (X4)
For every of the possible six sinks (SMA connectors 0-3 and the two event inputs of the
syn1588®Clock_M IP core) a 4 bit pattern defines the source for this signal. Additionally
every output may be additionally inverted.
Value Description
0x0 disabled (output tri-state)
0x1 SMA connector 0 (X4)
0x2 SMA connector 3 (X5)
0x3 SMA connector 2 (X6)
0x4 SMA connector 1 (X7)
0x5 period0_o signal of syn1588®Clock_M
0x6 period1_o signal of syn1588®Clock_M
0x7 trigger0_o signal of syn1588®Clock_M
0x8 trigger1_o signal of syn1588®Clock_M
0x9 1pps_o signal of syn1588®Clock_M
0xa -0xf disabled (output tri-state)
page 51
®
syn1588 User Guide
TIME2_M(31:0) Middle 32 bit of the current time value. A read access causes a
simultaneous update of all three time2 registers with the current time of
the high accuracy clock . Note that the absolute value is limited to 10^9 in
conformance to the IEEE1588 standard.
The unit is nsec.
page 52
®
syn1588 User Guide
TIME2_H(31:0) Upper 32 bit of the current time. Contents is updated only with the read access
to TIME2_M.
The unit is Seconds
TIME2_E(31:0) Extended 16 bits of the current time The value is updated with the read access
to TIME2_M.
The unit is 2^32 Seconds
Only the lower 16 bits are valid, the high word of this register is undefined.
page 53
®
syn1588 User Guide
CTRL(31:24) OFF2 Offset value for the second data section to extract from the packet if a
match has been found. The values is counted in multiples of bytes
starting with the first byte after the SOF octet
CTRL(23:16) OFF1 Offset value for the first data section to extract from the packet if a
match has been found. The values is counted in multiples of bytes
starting with the first byte after the SOF octet
CTRL(15:12) LEN2 Length in number of bytes to extract from the packet starting at OFF2 to
be stored into the time stamping unit FIFO
Note: (LEN1 + LEN2) mod 4 = 0
CTRL(11:8) LEN1 Length in number of bytes to extract from the packet starting at OFF1 to
be stored into the time stamping unit FIFO
Note: (LEN1 + LEN2) mod 4 = 0
CTRL(7:0) NBYTES Number of byte in the packet to compare against the pattern&mask
memory
If NBYTES is set to 0 the time stamping unit is disabled
If NBYTES is larger than the total packet length no match is found
If the first NBYTES of the packet match against the pattern&mask RAM
the packet is matched.
Caution:
Do not alter this register if the card is operated as an IEEE1588 node (i.e. while the
syn1588® PTP stack is running) !
page 54
®
syn1588 User Guide
Since the memory content is unknown following a reset the user (application) is responsible
for initializing the whole memory. Each pattern & mask memory is 256 entries deep, allowing
to define a search region within a packet of 512 octets.
MEM(31:24) MASK Allows to select the bits of (PATTERN Byte N+1) to be compared
Byte N+1 against the data in the packet. If a bit in the mask byte is set, the data
of the respective pattern byte is compared against the packet data. If
the bit is set to 0 the bit in the packet is ignored
MEM(23:16) PATTERN
Pattern data for byte N+1
Byte N+1
MEM(15:8) MASK Allows to select the bits of (PATTERN Byte N) to be compared against
Byte N the data in the packet. If a bit in the mask byte is set, the data of the
respective pattern byte is compared against the packet data. If the bit is
set to 0 the bit in the packet is ignored
MEM(7:0) PATTERN
Pattern data for byte N
Byte N
Caution:
Do not alter this memory if the card is operated as an IEEE1588 node (i.e. while the
syn1588® PTP stack is running) !
page 55
®
syn1588 User Guide
Since the memory content is unknown following a reset the user (application) is responsible
for initializing the whole memory. Each pattern & mask memory is 256 entries deep, allowing
to define a search region within a packet of 512 octets.
MEM(31:24) MASK Allows to select the bits of (PATTERN Byte N+1) to be compared
Byte N+1 against the data in the packet. If a bit in the mask byte is set, the data
of the respective pattern byte is compared against the packet data. If
the bit is set to 0 the bit in the packet is ignored
MEM(23:16) PATTERN
Pattern data for byte N+1
Byte N+1
MEM(15:8) MASK Allows to select the bits of (PATTERN Byte N) to be compared against
Byte N the data in the packet. If a bit in the mask byte is set, the data of the
respective pattern byte is compared against the packet data. If the bit is
set to 0 the bit in the packet is ignored
MEM(7:0) PATTERN
Pattern data for byte N
Byte N
Caution:
Do not alter this memory if the card is operated as an IEEE1588 node (i.e. while the
syn1588® PTP stack is running) !
page 56
®
syn1588 User Guide
Since the memory content is unknown following a reset the user (application) is responsible
for initializing the whole memory. Each pattern & mask memory is 256 entries deep, allowing
to define a search region within a packet of 512 octets.
MEM(31:24) MASK Allows to select the bits of (PATTERN Byte N+1) to be compared
Byte N+1 against the data in the packet. If a bit in the mask byte is set, the data
of the respective pattern byte is compared against the packet data. If
the bit is set to 0 the bit in the packet is ignored
MEM(23:16) PATTERN
Pattern data for byte N+1
Byte N+1
MEM(15:8) MASK Allows to select the bits of (PATTERN Byte N) to be compared against
Byte N the data in the packet. If a bit in the mask byte is set, the data of the
respective pattern byte is compared against the packet data. If the bit is
set to 0 the bit in the packet is ignored
MEM(7:0) PATTERN
Pattern data for byte N
Byte N
Since the memory content is unknown following a reset the user (application) is responsible
for initializing the whole memory. Each pattern & mask memory is 256 entries deep, allowing
to define a search region within a packet of 512 octets.
MEM(31:24) MASK Allows to select the bits of (PATTERN Byte N+1) to be compared
Byte N+1 against the data in the packet. If a bit in the mask byte is set, the data
of the respective pattern byte is compared against the packet data. If
the bit is set to 0 the bit in the packet is ignored
MEM(23:16) PATTERN
Pattern data for byte N+1
Byte N+1
MEM(15:8) MASK Allows to select the bits of (PATTERN Byte N) to be compared against
Byte N the data in the packet. If a bit in the mask byte is set, the data of the
respective pattern byte is compared against the packet data. If the bit is
set to 0 the bit in the packet is ignored
MEM(7:0) PATTERN
Pattern data for byte N
Byte N
page 57
®
syn1588 User Guide
page 58
®
syn1588 User Guide
3.8 Diagnostics
For further details on generating and using diagnostics see also chapter 6 and 7.
For further details on generating and using diagnostics view Chapter 6 and 7.
Unless otherwise noted the command line options are available for both Linux and Windows
version of the syn1588® PTP Stack.
The principle operation of the syn1588® PTP-Stack can be verified by use of the console log
messages as well as a packet dump on the corresponding Ethernet interface, e.g.
Whireshark or TCPdump. Please note that the verbosity level of the console output of the
syn1588® PTP Stack may be controlled by a command line parameter.
Selecting a syn1588® node to act as master or slave is done automatically following the best-
mast-algorithm defined in the IEEE1588 standard. No user interaction is required.
Important driver log messages can be found by using the dmesg command under Linux.
There is a simple utility “syn1588app” available that allows the user to read and write all
syn1588® registers. This utility eases debugging of your installed syn1588® hard- and
software as well as testing your own application.
Caution!
If you run the syn1588® PTP stack or any other software that accesses the syn1588® NICs
registers in parallel with this utility one may end up with unexpected behaviour of the
software.
Invoking the syn1588app is quite simple. Just run the executable either in a DOS window of
a Windows machine or any shell window of your Linux machine. One receives a short
copyright notice and version information.
C:\>syn1588app
Syn1588 Driver Interface, Version 1.0.0
Oregano Systems - Design & Consulting GesmbH Aug 5 2009
By entering the syn1588® register address one issues a read of this register. Please note that
you have to strip the 0x1000 prefix (base address of the syn1588® registers in the
syn1588®NICs) for the syn1588® register addresses in both the syn1588® PCI/PCIe NIC.
page 59
®
syn1588 User Guide
Reading the version ID of the syn1588®Clock_M is as simple as entering 0x0 for the registers
address. The syn1588app replies with the contents of this register.
C:\>syn1588app
Syn1588 Driver Interface, Version 1.0.0
Oregano Systems - Design & Consulting GesmbH Aug 5 2009
0x0
0x4c313030
The following example show a read of the IOMATRIX register (address 0x200) followed by a
write command to this register finally followed by another read operation to verify that the
write operation had succeeded.
C:\>syn1588app
Syn1588 Driver Interface, Version 1.0.0
Oregano Systems - Design & Consulting GesmbH Aug 5 2009
0x200
0x00430059
0x200 0x00430959
0x200
0x00430959
The syn1588®app Utility also has some built in Commands for often used functions.
With this command you can extract the PTP Clock Id from the syn1588® Clock.
Syntax:
id
Example:
page 60
®
syn1588 User Guide
ver
Example:
With the time command you can get and set the current time of the syn1588® Clock.
The optional parameter for this command is the time you want to set in seconds and
nanoseconds.
Syntax:
time [secs,nsecs]
Example:
time
1001,056843296
With this command you can configure one of the Ethernet packet timestamping units of the
syn1588® Clock. There are two Ethernet timestamping units inside the syn1588® Clock. The
reception side and the transmission side of each timestamping unit can be configured
separately.
Do not use this command to configure Ethernet timestamping unit 0 while the PTP Stack is
running. This will lead to a loss of sync of the node.
Syntax:
Example:
page 61
®
syn1588 User Guide
This example shows how to generate timestamps for incoming Ethernet packets using the
cfgts command. In this example the receive side of timestamping unit 0 is configured to
extract the source MAC address and Ethernet type of incoming packets. Further the pattern
is configured to match ARP packets only. Note: the whole command has to be typed on a
single line.
Now we can extract the timestamps from the timestamp fifo using the getts command.
With this command you can extract timestamps that were created after a timestamper was
configured with the cfgts command and a packet was successfully timestamped.
Syntax:
Example:
With the rate command you can manually configure the rate of the clock. This command is
only useful for quick testing purposes and should not be used while the syn1588® PTP stack
is running.
Syntax:
rate nsecs
page 62
®
syn1588 User Guide
Example:
With this command you can clear the fifo that stores the timestamps of a timestamping unit.
Syntax:
Example:
clrts0t
clrts1r
clrts1t
This command is used to configure the event Generation resources TRIGTIME and
PERIODTIME. With this command it is also possible to combine TRIGTIME0 with
PERIODTIME0 or TRIGTIME1 with PERIODTIME1. The command combines the
configuration of TRIGTIME0 with PERIODTIME0 and TRIGTIME1 with PERIODTIME1.
Depending on the parameters of the command it enables PERIODTIME, TRIGTIME or both.
If you set start_sec and start_nsec to zero, only PERIODTIME is enabled. If you set
period_sec and period_nsec to zero, only TRIGTIME is enabled. If you set both,
PERIODTIME is enabled after the timeout of TRIGTIME is reached.
Syntax:
page 63
®
syn1588 User Guide
Example:
Here we have four examples of the usage of the event command. Example 1 shows how to
set a trigger event on SMA port 0 using TRIGTIME0 and waiting for 2 and a half seconds.
Example two shows how to create a periodical signal on SMA port 1 using PERIODTIME0
that toggles every 500000 nanoseconds. Example 3 shows how to combine TRIGTIME and
PERIODTIME. Here we want an event for SMA port 2 using TRIGTIME1 and
PERIODTIME1. We wait until a timeout of 5 seconds is reached by TRIGTIME1 and then the
signal toggles every 250000 nanoseconds using PERIODTIME1.
Pps – Route the syn1588® One Pulse per Second to any SMA Port
The PPS command can be used to route the 1 PPS pulse of the syn1588® Clock to any SMA
output port of the syn1588® PCI/PCIe NIC.
Syntax:
Example:
0x200
0x00000009
page 64
®
syn1588 User Guide
With the REGEV command you can enable one of the two Event Input Resources of the
syn1588® Clock and route a SMA input port to it.
Syntax:
Example:
0x200
0x00010000
0x200 0x00090000
wait 0 1 1
3784,598866427
This example needs a little explanation: To show the two functions regev and wait in action,
this command uses the IOMATRIX register to reroute the one PPS pulse internally.
With the wait command you can wait on the interrupt of one of the Event Inputs and extract
the created timestamp if successful.
Syntax:
Example:
See Regev for an example usage of the wait command.
page 65
®
syn1588 User Guide
3.9.1 Interoperability
The syn1588® PCI NIC has proven compatibility with the corresponding standards by
passing various in-house test scenarios and successful participation in the IEEE1588
compatibility plug-fest organized at the ISPCS conference on a regular basis.
As soon as the on-board clock of the syn1588® PCI NIC is activated by the software, a one
pulse per second (PPS) output is generated on the SMA connector X4 (next to the RJ45
Ethernet jack). Depending on the accuracy of the clock settings and whether a PTP stack is
running and periodically correcting the local clock, the 1 PPS output shows a rising edge at
the beginning of each second, holding the output to logic 1 for a duration of a few hundred
milliseconds. The syn1588® clock of the chip is derived from an external 25 MHz oscillator
and internally multiplied in a PLL to 62,5 MHz.
Please note that the actual output has a constant delay of three clock cycles plus the clock to
output delay of the chip. On the syn1588® PCI NIC this is
3*(1/62,5 MHz) + 0,36 ns = 48,36 ns.
Here the delay of the board trace from the chip to the SMA connector has been neglected.
Note that if several 1 PPS outputs (e.g. GPS receiver) are to be compared via measurement
equipment, also to cable delay has to be taken into account.
The 1 PPS signal of the clock can be rerouted to any of the four available SMA connectors of
the syn1588® PCI NIC by writing a corresponding value to the IOMATRIX register of the chip.
See the API documentation in Chapter 6 for further details on how to access the hardware
features from application software.
page 66
®
syn1588 User Guide
To generate a periodic signal, which is derived directly from the synchronized syn1588®
clock, the corresponding values of the PERIODx and related control registers have to be set
accordingly in the chip.
The syn1588® clock of the chip is derived from an external 25 MHz oscillator and internally
multiplied in a PLL to 62,5 MHz. It is thus not possible to generate a frequency larger than
31 MHz out of the periodic timer units of the syn1588® PCI NIC chip. Please note that the
clock resolution is not bounded by the period of the frequency driving the syn1588® clock of
the chip, which is 1/62,5 MHz = 16 ns since the PERIOD registers allow the definition of
16 bit sub-nanoseconds for the clock period (see chapter 3.7.2).
The output of the periodic timer unit can be rerouted to any of the four available SMA
connectors of the syn1588® PCI NIC by writing a corresponding value to the IOMATRIX
register of the chip.
Please note that the actual output has a constant delay of the clock to output delay of the
chip. On the syn1588® PCI NIC this is about 0,36 ns.
3.9.3.1 Example
Assume one would like to generate a PERIOD output signal with a frequency of 500 kHz on
connector X7. Connector X7 is the default connector for the period timer PERIOD0. There
are two PERIOD0 registers PERIODTIME0PU_L (address 0xF0) and PERIODTIME0PU_H
(address 0xF4) which hold combined the half period in nanoseconds of the output signal to
be generated using the notation “48 bit , 16 bit”. Maximum half period is thus 248 while the
resolution is 2-16.
The half period for a 500 kHz signal is 1 µs or 1000 ns. Thus one has to write the value 0x0
to the register PERIODTIME0PU_H and 0x3E80000 to the register PERIODTIME0PU_L.
Note that 0x3E8 is hexadecimal for 1000 while the remaining 0x0000 stand for the 16 bit
fractional part (sub-nanoseconds).
After defining these values one has to activate the PERIOD0 output via the EVENTCTRL
register. Please note, that for simplicity we just write the whole EVENTCTRL (address 0x4C)
register in this example. In real life applications one would have to read the register first and
set/reset the intended bits carefully in order to avoid that bits set by other software are
affected.
page 67
®
syn1588 User Guide
Writing these values can be accomplished simply from command line by using the
“syn1588app” utility. See chapter 3.8.3 for more details on this utility. The following listing
shows how the values are written to the registers and read back.
C:\>syn1588app
Syn1588 Driver Interface, Version 1.0.0
Oregano Systems - Design & Consulting GesmbH Aug 5 2009
0xf0 0x3e80000
0xf4 0x0
0xf0
0x03e80000
0xf4
0x4c 0x0
0x4c
0x00000000
0x4c 0x50
0x4c
0x00000050
The syn1588® PCI NIC offers four SMA connectors on the rear side at the PCI bracket.
These SMA connectors are assigned default functions like 1PPS signal output and frequency
output. The following table lists the default functions of the four SMA connectors. See Figure
16 for exact position of the four connectors mentioned in this chapter.
Connector Description
X4 1PPS output
connector next beside RJ45
X7 frequency output
X6 event input
X5 1PPS input
top most connector
Table 4 Default functions of the SMA connectors
The user may change these default assignments via programming the register “IOMATRIX”
that is described in the following sub-chapter.
page 68
®
syn1588 User Guide
For every of the possible six sinks (SMA connectors 0-3 and the two event inputs of the
syn1588®Clock_M IP core) a 4 bit pattern defines the source for this signal. Additionally
every output may be additionally inverted.
page 69
®
syn1588 User Guide
Value Description
The register is under control of software running in the user space (“the user application”); no
kernel mode software is required.
page 70
®
syn1588 User Guide
3.9.4.2 Example 1
Assume one would like to receive the 1PPS output signal not only on connector X4 but also
on connector X6. Thus the third nibble of the IOMATRIX register that defines the source for
connector X6 has to be changed from 0x0 (disabled) to 0x9 (1pps_o signal of
syn1588®Clock_M).
Writing the value 0x00430959 to the IOMATRIX register results the intended function. This
can be accomplished simply from command line by using the “syn1588app” utility. See
chapter 3.8.3 for more details on this utility.
C:\>syn1588app
Syn1588 Driver Interface, Version 1.0.0
Oregano Systems - Design & Consulting GesmbH Aug 5 2009
0x200
0x00430059
0x200 0x00430959
0x200
0x00430959
3.9.4.3 Example 2
Assume one would like to receive the 1PPS output signal not only on connector X4 but also
as event on the input 0 of the syn1588®Clock_M. Thus the fifth nibble of the IOMATRIX
register that defines the source for event 0 input of the syn1588®Clock_M has to be changed
from 0x3 (X6) to 0x9 (1pps_o signal of syn1588®Clock_M).
Writing the value 0x00490059 to the IOMATRIX register results the intended function. This
can be accomplished simply from command line by using the “syn1588app” utility. See
chapter 3.8.3 for more details on this utility.
C:\>syn1588app
Syn1588 Driver Interface, Version 1.0.0
Oregano Systems - Design & Consulting GesmbH Aug 5 2009
0x200
0x00430059
0x200 0x00490059
0x200
0x00490059
page 71
®
syn1588 User Guide
The timestamping unit used in Oregano Systems’s syn1588® PCI NIC allows the
independent detection of two different packets for both receive and transmit direction. One
timestamper unit is used for detecting IEEE1588 packets and thus used by the syn1588®
PTP stack. The second timestamping unit may be used by the customer and its software to
detect and timestamp any packet.
3.9.5.1 Introduction
This section briefly outlines the required actions in the user software. A simple example is
presented that may be easily extended to meet your specific requirements.
®
Figure 20. MII timestamping units in the syn1588 PCI/PCIe NIC
Please note that the Oregano timestamping units acts as a passive observer on the GMII/MII
interface. It does not alter data transferred on this interface.
The following figure shows the basic timestamper structure; the timestamping comparator.
Two of these comparators made up one timestamping unit. Two timestamping units and thus
four timestamping comparators are available in the syn1588® PCI NIC.
page 72
®
syn1588 User Guide
The time stamping unit will compare the first NBYTES octets of the packet against the data in
the pattern&mask memory as expressed in a c-style syntax below (pattern and mask refer to
the respective octets in the pattern&mask memory.
Match = 0;
for (i:= 0; i < NBYTES; i++)
Match += ((packet(i) & mask(i)) ^ pattern(i)) ^ 0xFF;
The timestamping comparator enables checking the first 256 bytes of an Ethernet packet.
The compare process starts with the first byte following the SFD (start-of-frame-delimiter),
i.e. the first byte of the destination MAC address. For every byte of the packet the user may
define an expected value (the pattern) and a mask value. For all bits that are set to one in the
mask the value of the pattern is compared against the value of the actual (G)MII data byte.
For every timestamping comparator there is a control register. One is able to enable the
timestamper comparator as well as to define the length of the check performed. Additionally
one may extract two sections out of the Ethernet packet controlled by this register.
The example given below shows the configuration of the RX and TX time stamping unit 0 to
detect IEEE1588 layer 2 packets.
writeReg(MIITS0_RXMEM + 6*4, 0xFFF7FF88); // Ethernet Type 0x88F7
writeReg(MIITS0_RXMEM + 7*4, 0x0F020C00); // MsgType 0-3, Version 2
if (m_cfg->nwMode == 1)
writeReg(MIITS0_RXMEM + 10*4, 0x00000404); // Unicast Flag
writeReg(MIITS0_TXMEM + 6*4, 0xFFF7FF88); // Ethernet Type 0x88F7
writeReg(MIITS0_TXMEM + 7*4, 0x0F020C00); // MsgType 0-3, Version 2
if (m_cfg->nwMode == 1)
writeReg(MIITS0_TXMEM + 10*4, 0x00000404); // Unicast Flag
// RX extract: SeqId off | SrcMAC off| SeqId len | SrcMac len| cap len
writeReg(MIITS0_RXCRTL, (44 << 24) | (6 << 16) | (6 << 12) | (6 << 8) | 22);
// TX extract: SeqId off | DstMAC off| SeqId len | DstMac len| cap len
writeReg(MIITS0_TXCRTL, (44 << 24) | (0 << 16) | (6 << 12) | (6 << 8) | 22);
page 73
®
syn1588 User Guide
There are four MII Timestamp Control registers available; one for each timestamping
comparator. The following table shows the contents of this MII Timestamp Control register.
Bit(s) Description
NBYTES[7:0] number of packet bytes to be compared with pattern & mask memory
A length of 0 disables the unit
LEN1[11:8] number of bytes extracted starting at byte OFF1. The number of
extracted bytes is LEN1 * 2
LEN2[15:12] number of bytes to extracted starting at byte OFF2. The number of
extracted bytes is LEN2 * 2
OFF1[23:16] offset used for extracting LEN1*2 bytes from the packet.
OFF2[31:24] offset used for extracting LEN2*2 bytes from the packet.
The following table lists the address of these control registers. Note that the address listed is
the local address of the syn1588® PCI/PCIe card.
Address Description
0x1214 MII Timestamper #0 Receive – control register
0x1208 MII Timestamper #0 Transmit – control register
0x120c MII Timestamper #1 Receive – control register
0x1210 MII Timestamper #1 Transmit – control register
For every timestamping unit there is a pattern and mask memory defining the comparator
condition. Every memory holds 256 entries of two times eight bit thus 512 bytes. The
following table lists the base address of these pattern & mask memories.
Address Description
0x1400 MII Timestamper #0 Receive – pattern & mask memory
0x1600 MII Timestamper #0 Transmit – pattern & mask memory
0x1800 MII Timestamper #1 Receive – pattern & mask memory
0x1a00 MII Timestamper #1 Transmit – pattern & mask memory
Table 9 Addresses map of the MII Timestamp patter and mask memories
page 74
®
syn1588 User Guide
At the even byte of the pattern and mask memory the pattern is stored while at the odd byte
the mask value resides.
For every timestamping comparator there is a timestamping FIFO. Whenever one compa-
rator unit detects a packet matching its comparator condition the packet’s timestamp value
as well as optional data extracted out of the packet are stored in this timestamping FIFO.
Additionally an interrupt is generated informing the user application or the syn1588® PTP
stack that there is new data available.
Address Description
0x1010 MII Timestamper #0 Receive FIFO
0x1018 MII Timestamper #0 Transmit FIFO
0x101C MII Timestamper #1 Receive FIFO
0x1020 MII Timestamper #1 Transmit FIFO
Finally there is a status register for every RX/TX timestamp FIFO pair available.
Bit(s) Description
RX FIFO EMPTY[0] a ‘1’ flags that the RX timestamp FIFO is empty
RX FIFO FULL[1] a ‘1’ flags that the RX timestamp FIFO is full
RX FIFO CNT[9:2] number of words available in the RX timestamp FIFO
RESERVED[15:10] reserved
TX FIFO EMPTY[16] a ‘1’ flags that the TX timestamp FIFO is empty
TX FIFO FULL[17] a ‘1’ flags that the TX timestamp FIFO is full
TX FIFO CNT[25:18] number of words available in the TX timestamp FIFO
RESERVED[31:26] reserved
Address Description
0x1030 MII Timestamper #0 FIFO Status
0x1034 MII Timestamper #1 FIFO Status
page 75
®
syn1588 User Guide
This simple example shows how to setup timestamping unit for comparatoring any Ethernet
packet. The mission: Timestamp every ARP packet sent or received.
For performing this action one comparators the type/length field of the
Ethernet packet for the value 0x0806 denoting that this packet contains an
ARP. The source code is shown in
#include "syn1588_ifc.h"
#include "stdio.h"
#include "unistd.h"
void setupMIITS(Syn1588Ifc *syn, unsigned ctrlReg, int nbytes, int len1, int
off1, int len2, int off2) {
int main() {
Syn1588Ifc syn;
page 76
®
syn1588 User Guide
0xFF06FF08,
};
for (size_t i = 0; i < sizeof(ts_mem) / sizeof(unsigned long); i++) {
syn.writeReg(MIITS1_RXMEM + i*4, ts_mem[i]);
syn.writeReg(MIITS1_TXMEM + i*4, ts_mem[i]);
}
int got;
while (1) {
got = 0;
// poll from Receive Fifo and display
while (!(syn.readReg(TSFIFO_STAT1) & 0x1)) {
usleep(10);
printf("RX1: %08x\n", syn.readReg(TSFIFO_RX1));
got = 1;
}
if (got) printf("--------------\n"); // separating line
got = 0;
// poll from Transmit Fifo and display
while (!(syn.readReg(TSFIFO_STAT1) & 0x10000)) {
usleep(10);
printf("\t\tTX1: %08x\n", syn.readReg(TSFIFO_TX1));
got = 1;
}
if (got) printf("\t\t--------------\n");// separating line
usleep(100000);
}
return 0;
}
There is a setup process “setupMIITS” and the “main” process. Every step is well
commented.
#include "syn1588_ifc.h"
#include "stdio.h"
#include "unistd.h"
page 77
®
syn1588 User Guide
void setupMIITS(Syn1588Ifc *syn, unsigned ctrlReg, int nbytes, int len1, int
off1, int len2, int off2) {
int main() {
Syn1588Ifc syn;
page 78
®
syn1588 User Guide
int got;
while (1) {
got = 0;
// poll from Receive Fifo and display
while (!(syn.readReg(TSFIFO_STAT1) & 0x1)) {
usleep(10);
printf("RX1: %08x\n", syn.readReg(TSFIFO_RX1));
got = 1;
}
if (got) printf("--------------\n"); // separating line
got = 0;
// poll from Transmit Fifo and display
while (!(syn.readReg(TSFIFO_STAT1) & 0x10000)) {
usleep(10);
printf("\t\tTX1: %08x\n", syn.readReg(TSFIFO_TX1));
got = 1;
}
if (got) printf("\t\t--------------\n");// separating line
usleep(100000);
}
return 0;
}
The ZIP file “miits.zip” includes this code example as well as all the included files and a
Makefile required to build the software.
basictypes.h
clock_ifc.h
main.cpp
Makefile
syn1588_ifc.cpp
syn1588_ifc.h
page 79
®
syn1588 User Guide
Some applications require the notion of time of the IEEE1588 system and network to be tied
to a reference time scale (e.g. GPS time) with the highest possible accuracy. The setup
described in the following offers a cheap and easy way to do exactly this with the help of an
Oregano Systems’ syn1588® NIC and a COTS GPS receiver.
The required components include a GPS receiver with antenna. The GPS receiver has to
have a 1 PPS output signal of sufficient accuracy as required by the application and a NMEA
compatible serial interface. Furthermore a computer or system is needed, able to connect to
the GPS receiver via a RS232 interface or equivalent. Also a syn1588® NIC (either PCI or
PCIe) is needed. The 1 PPS output of the GPS receiver has to be connected to one SMA
input of the syn1588® NIC to allow for precise timestamping.
Note that the used syn1588® NIC does not have to be changed, however, the PTP stack
running on the computer or system must be forced to act as master of the PTP network by
invoking the PTP application e.g. “ptp –C M_EXT”. Having a GPS receiver connected to a
PTP slave and having the two time scales, i.e. PTP time and GPS time synchronized, may
result in instable behaviour of the slave.
The actual synchronization between the PTP time and GPS time is achieved by invoking an
additional executable “esync” while the PTP stack is running. See the following log for some
details.
page 80
®
syn1588 User Guide
Note that this program will synchronize the clock of the PTP master to the GPS time with the
same algorithm that is used for the PTP synchronization in the stack itself. The
communication of the program with the GPS receiver is limited to the widely used NMEA
protocol.
The “esync” application is distributed with Oregano Systems’ syn1588® products and can
thus easily be extended. The source code of the “esync” application is available for all
customers that licensed the syn1588® PTP Stack source code.
page 81
®
syn1588 User Guide
Frequently user require to synchronize the node’s system clock to the highly accurate
synchronised IEEE1588 clock maintained by the syn1588® PTP stack on the syn1588® PCI
NIC instead of accessing the hardware clock directly. This chapter briefly describes typical
questions, common misunderstandings and solutions.
The syn1588® PTP Stack Does Not Sync the System Clock !
A common misunderstanding is the function of the syn1588® PTP stack. This software is
responsible for maintaining the IEEE1588 functions and thus the hardware clock. These
functions are independent from the selected operating system. That’s why the syn1588®
basically runs on “any” operating system (of course there has to be a network driver support
for the syn1588® NICs).
Unfortunately there is no standard way how to access or maintain the system clock in
different operating systems. That’s why the syn1588® cannot synchronize directly the node’s
system clock.
LSYNC
There is a utility called “LSYNC” that enables the user to synchronize several syn1588® NICs
to each other as well as to the system clock. This application is responsible for local
synchronization of at least two clocks. For example LSYNC can be used to synchronize the
system clock to a syn1588® hardware clock found on any Oregano syn1588® NIC.
This utility is available on the syn1588® Live CD for all our syn1588® NIC customers. The file
is named “lsync” for Linux OS and “lsync.exe” for Windows OS. These are the command line
parameters of LSYNC:
PTPv2\bin>lsync -h
usage: lsync [-h][-v logLevel][-U UtcOffset] -O A|L|0|1
Note, that the parameter “-O” is not an optional but a required parameter.
PTPv2\bin>lsync
Command line parse error: -O is a required parameter
Use -h option for help.
page 82
®
syn1588 User Guide
The parameter “-O” defines the origin for synchronizing the clocks.
“-O N –i <ip_address>” for Windows or “-O N –i <device>” for Linux selects the mentioned
syn1588(R) NIC as the master and syncs all other syn1588(R) NIC clocks as well as the
system clock to the selected syn1588(R) NIC. Please note that the option “-O N” requires the
option “-i <interface>”.
“-O L” selects the local system clock as the master and synchronizes all syn1588(R) NIC
hardware clocks to the system clock.
“-O A” selects the auto mode. One has to distinguish two modes of operation
• A syn1588® PTP Stack is running on the node (in SLAVE mode)
• No syn1588® PTP Stack is running on the node
I.) A syn1588® PTP Stack is running on the node in SLAVE mode
Ia.) The node is equipped with one syn1588®NIC
LSYNC will synchronize the system clock of the node to the syn1588® NIC
IIb.) The node is equipped with two or more syn1588® NICs
LSYNC will synchronize the system clock of your node to the syn1588® NIC where the
syn1588® PTP Stack runs in SLAVE mode. Additionally LSYNC will synchronize all
other syn1588® NICs to the syn1588® NIC where the syn1588® PTP Stack runs in
SLAVE mode.
II.) No syn1588® PTP Stack is running on the node
The system clock will be the clock master for LSYNC
IIa.) The node is equipped with one syn1588® NIC
LSYNC will synchronize the syn1588® NIC to the system clock.
IIb.) The node is equipped with two or more syn1588® NICs
All X4 SMA connectors (that's the one next beside of the RJ45 network connector on
the syn1588® PCI/PCIe NICs) need to be connected to each other. LSYNC will all
syn1588® NICs to the system clock.
The option “-U utcOffset” enables the user to add the leap seconds when synchronizing the
IEEE1588 clock hold in the syn1588(R) NIC. Note that the system clock and the IEEE1588
clocks inherently use a different time notation.
Example of an unsuccessful “lsync” invocation:
PTPv2\bin>lsync -ON -i 192.168.102.64
lSync - Local Synchronization engine, Version 1.1.0 Rev 125 $
Oregano Systems - Design & Consulting GesmbH Feb 18 2011
page 83
®
syn1588 User Guide
page 84
®
syn1588 User Guide
®
Figure 23: syn1588 PCIe NIC
As the hardware assisted time stamping mechanism has been designed using a generic
architecture, the syn1588® network card supports both version 2002 and version 2008 of the
IEEE1588 standard. Oregano Systems offers the Precision Time Protocol (PTP) Stack
supporting either version 2002 or version 2008 of the IEEE1588 standard.
page 85
®
syn1588 User Guide
4.1 Features
• 10/100/1000 Mbit/s Ethernet network interface card compliant to IEEE802.3-2000
• Fully compliant to IEEE1588-2002 (also referred to as IEEE1588 version 1.0)
• Fully compliant to IEEE1588-2008 (also referred to as IEEE1588 version 2.0)
• IEEE1588 hardware timestamping supported
• Two-step as well as one-step timestamping supported
• Clock accuracy up to 50 ns
• Linux driver available (binary and source included with the NIC)
• Windows driver available (binary included with the NIC)
• syn1588® PTP Stack available for Linux and Windows (binary included with the NIC)
• Supports all IEEE1588 version 2008 enhancements
o Transparent clocks
o Management messages
o Unicast messages
• PCI Express card (half height)
• Up to four programmable I/O signals routed to SMA jacks (3V3 LVCMOS)
• Two independent and programmable timestamping units available for receive and
transmit, enabling parallel timestamping of user specified packets
• Operating temperature range 0 – 50°C
Optional features:
• High accuracy local oscillator (OCXO). With the help of the OCXO the frequency stability
increases from 100 PPM to 0.5 PPM. This is very useful if you want to operate the
syn1588® PCIe NIC as a free running Master Clock.
• Connectivity to an external GPS receiver via a 1pps input as well as the serial port of the
host PC. When the syn1588® PCIe NIC is synced to a GPS receiver in this way, you can
effectively sync your whole network to GPS using additional syn1588® Products.
page 86
®
syn1588 User Guide
4.5 Testing the syn1588® PCIe NIC with the syn1588® Live CDROM
See the description for the syn1588® PCI NIC in Section 3.5.
4.8 Diagnostics
See the description for the syn1588® PCI NIC in Section 3.7.
page 87
®
syn1588 User Guide
See chapter 3.9.2 for more details on generating a 1PPS output signal. Please note that the
internal syn1588® clock frequency for the syn1588® PCIe NIC is 88.88 MHz (instead of
62.5 MHz for the syn1588® PCI NIC).
See chapter 3.9.3 for more details on generating a frequency output signal. Please note that
the internal syn1588® clock frequency for the syn1588® PCIe NIC is 88.88 MHz (instead of
62,5 MHz for the syn1588® PCI NIC). Thus the maximum frequency of a generated periodical
signal is 42 MHz.
The syn1588® PCIe NIC offers two SMA connectors on the rear side at the PCI bracket.
These SMA connectors are assigned default functions like 1 PPS signal output and
frequency output. Additionally there are two more SMA connectors that may be used
internally. The following table lists the default functions of the four SMA connectors. See
Figure 23 for exact position of the four connectors mentioned in this chapter.
Connector Description
X4 1PPS output
connector next beside RJ45
X7 frequency output
X6 event input
X5 1PPS input
top most connector
Table 15 Default functions of the SMA connectors
The user may change these default assignments via programming the register “IOMATRIX”
that is described in the chapter 3.9.4.1.
See chapter 3.9.5 for more details on timestamping of user defined packets using the
syn1588® PCIe NIC.
page 88
®
syn1588 User Guide
See chapter 3.9.6 for more details on synchronising the IEEE1588 clock maintained in the
syn1588® PCIe NIC to an external GPS reference.
Since the syn1588® PCIe NIC offers just two SMA connectors on the rear side (PCI bracket)
one hast to select the connector X7 for the 1PPS input when invoking the “esync” application
as shown in the following example.
esync –p 3
See chapter 3.9.7 for more details how to synchronize the system clock to the IEEE1588
clock maintained in the syn1588® PCIe NIC.
page 89
®
syn1588 User Guide
page 90
®
syn1588 User Guide
5 syn1588® VIP
The syn1588® VIP design is a highly integrated single chip IEEE1588 solution. Only a single
external Ethernet PHY is required to create a fully functional layer2 or layer3 IEEE1588-2008
node.
The syn1588®VIP offers a standard 10/100/1000 Mpbs Ethernet network interface with
hardware enhancements to provide the system with accurate clock synchronization via
Ethernet following the IEEE1588 standard.
The presented solution keeps all clock related processing encapsulated within the Intellectual
Property (IP) Core and provides a system with a highly accurate synchronized clock without
having to run any dedicated code of a host CPU connected to this system. The design is
suited for embedded systems or system-on-chip designs (SoC) not willing to contaminate the
application software with clock synchronization or protocol code or simply seeking a simple
and cost effective solution.
The syn1588®VIP comes in three flavours:
• syn1588®VIP device
• syn1588®VIP IP Core written in VHDL
• syn1588®VIP evaluation Board.
5.1 Features
• Single chip IEEE1588 solution
• 10/100/1000 Mbit/s Ethernet MAC included
• Fully compliant to IEEE802.3-2005
• IEEE1588 hardware timestamping support using syn1588® technology
• IEEE1588 hardware clock using syn1588® technology
• IEEE1588-2008 Layer-2 and Layer-3 compliant
• Clock accuracy better than 50 ns
• syn1588® PTP Stack included (running on integrated 8-bit CPU core)
• 3 programmable I/O signals (1pps output, event input, period output, etc.)
The syn1588®VIP evaluation board allows for fast and easy verification of the syn1588®VIP
features without risks of building an evaluation system. Our customers may receive the board
schematic, the layout data as well as the BOM (bill of material) of the syn1588®VIP
evaluation board free of charge.
page 91
®
syn1588 User Guide
exchange of PTP messages via IEEE 802.3/Ethernet. This represents a Layer 2 communi-
cation in terms of the OSI reference model. The standard defines the Ethernet type, which
shall be set to 0x88F7, Multicast MAC addresses (01-80-C2-00-00-0E for peer delay
messages, 01-1B-19-00-00-00 for all other messages), and the settings of a few transport
specific field values. Thus the payload of the Ethernet frame does not differ much from the
PTP frames normally used. The length of IEEE1588 Layer 2 messages, however, is
significantly smaller because the entire IP header has become obsolete. A layer 2 PTP sync
message hence has an overall length of 64 bytes, already including two bytes for padding,
compared to the 90 bytes for the normal sync message.
However, the syn1588®VIP is also capable of handling IEEE1588 Layer 3. Choosing
between IEEE1588 Layer 2 Mode and IEEE1588 Layer 3 Mode is simple involving merely
changing the logic level of one input pin.
Based upon out syn1588®PTP Stack, a concept has been developed at Oregano Systems to
perform clock synchronization completely in the background, i.e. Integrated in a chip design
IP-core, the proposed solution provides an easy-to-use, low-gate count, small memory
footprint IEEE 1588 clock synchronization unit for product developments especially for
embedded systems or SoC designs.
®
Figure 24: syn1588 VIP: Block diagram
Figure 24 shows the block diagram of Oregano Systems' syn1588®VIP. An Ethernet MAC
with additional interfaces delivers PTP messages to a small 8-bit controller, which runs the
small footprint protocol stack and controls the attached hardware clock.
The main building blocks of the novel solution comprise a dedicated Ethernet Media Access
Controller (MAC), a Clock Unit, and an 8-bit microcontroller core. The MAC is equipped with
a packet filter such that PTP messages can be extracted from and inserted into the
communication traffic.
To overcome various non-deterministic communication delays, hardware-assisted time-
stamping is used. To this end, the Oregano Systems syn1588® concept has been selected to
page 92
®
syn1588 User Guide
be used in the clock unit. It includes an adder-based clock, various triggers and timers, and a
time-stamping logic supporting 10/100/1000 Mbit/s Ethernet. The synchronization algorithm,
all processing of PTP-messages, and low-level accesses to the clock IP-core, however, are
performed by the Offload Engine, basically a small 8-bit 8051 microcontroller.
With its unrivalled small memory footprint of less than 32 kbytes of ROM and less than 24
kbytes of RAM and an ASIC gate count of less than 20k gates, Oregano Systems'
syn1588®VIP Chip is at the leading edge of easy to use, small, and yet fully compatible clock
synchronization solutions.
In combination with a syn1588® PCI/PCIe NIC and a GPS receiver you can propagate GPS
time information through your whole network and effectively sync all your network devices to
GPS using this and other syn1588® Products, having only one real GPS timing receiver in
your network.
®
Figure 25 syn1588 VIP Node
The SPI Flash will store the encrypted bitstream of the FPGA. The syn1588®VIP requires an
8 Mbit SPI flash. The syn1588® VIP evaluation board for example contains the 8 Mbit SPI
flash SST25VF080B-50-4C-S2AF from SST.
page 93
®
syn1588 User Guide
The I2C serial number device assures that each syn1588®VIP node has a unique MAC
address in the network and a unique clock ID for the Precision Time Protocol. The
syn1588® VIP is designed with the 24AA02E48 from Microchip in mind.
The Ethernet PHY connects the digital MII/GMII of the syn1588®VIP to the physical network
medium. The syn1588®VIP supports any commercially available 10/100 Mbit PHY For
1000 Mbit operation the syn1588®VIP supports two PHYs; The 88E1111 from Marvell and
the DP83865 from National Semiconductor. If you need support for an additional Gbit PHY,
please contact Oregano Systems.
The oscillator for the syn1588®VIP shall deliver 25 MHz with Ethernet quality (100 ppm). Our
syn1588®VIP uses the reset and power watch-dog device MAX6854 from Maxim, to enable
the FPGA only when the power supply is stable.
page 94
®
syn1588 User Guide
The basic usage of the PTPMMM tool in combination with the syn1588®VIP is to read the
value of a syn1588®Clock register. This is accomplished in the following way:
First invoke the PTPMMM utility:
# ./ptpmmm
Precision Time Protocol (PTP) Engine IEEE1588 V2, V 1.0.1 Rev 125 $
Oregano Systems - Design & Consulting GesmbH Dec 23 2009
After invocation of PTPMMM you can enter commands that send IEEE1588 management
messages to the syn1588®VIP nodes in the network. Note that PTPMMM has no command
prompt or the like to facilitate batch operation and automated post processing of output data.
page 95
®
syn1588 User Guide
To discover all syn1588®VIP nodes in the network issue the “clock” command. You do this by
typing “clock” followed by a carriage return. This should give a similar output like this:
# ./ptpmmm
Precision Time Protocol (PTP) Engine IEEE1588 V2, V 1.0.1 Rev 125 $
Oregano Systems - Design & Consulting GesmbH Dec 23 2009
clock
clock 0060350000018C37 1 O "IEEE 802.3" 006035018C37 IPv4:00000000 FFFFFF
"Oregano Systems;Model xx;Serial yy" "1.0.1;1.0.1;1.0.2" "name;location"
001B19000100
timeout
The timeout message means that after a time of one second the command does not wait for
further responses to the issued clock command.
Now every PTP node in the network responds to the message. In this example only one
node responds. The responding node has a clock id of 0060350000018C37, a port id of 1
and belongs to clock domain 0. Remember the clock id, port id and clock domain, because
you need those values for ”set” commands. For “get” commands it is optional to specify
those values.
The syn1588®VIP supports a proprietary extension to the PTP Management Interface. This
extension is made up of only one - very powerful - command. It allows to read and write to
the hardware registers of the syn1588® VIP.
This command is called “clkman”. For example with this command we can read the version
of the syn1588® Clock Core that is embedded in the node. The version of the clock is located
in register 0x0. So to get the version of the clock we issue a “clkman” command to read clock
register 0x0. We do this like this:
# ./ptpmmm
Precision Time Protocol (PTP) Engine IEEE1588 V2, V 1.0.1 Rev 125 $
Oregano Systems - Design & Consulting GesmbH Dec 23 2009
clock
page 96
®
syn1588 User Guide
The result of the “clkman” command is always in hexadecimal notation. Since the clock
version is encoded as four ASCII characters the result of 0x4d323130 has to be converted in
ASCII to get the clock version: 0x4d equals ‘M’, 0x32 equals ‘2’, 0x31 equals ‘1’, and finally
0x30 equals ‘0’. So the clock version is ‘M210’.
PERIODTIME_H (31:16) are seconds and PERIODTIME_L (15:0) is the upper fraction of the
nanoseconds. PERIODTIME_L (31:0) is the lower fraction of the nanoseconds and
PERIODTIME_L (31:0) are sub nanoseconds. EVENTCTRL contains control bits for enabling
and disabling of some features of the syn1588® Clock Core
If for example we want to generate an output signal that toggles with a frequency of 1 MHz,
we need to set the period to 1000 nanoseconds. Now we convert this value to hex which
results in 0x3e8 nanoseconds. This means we have to set PERIODTIME_H to “0x0” and
PERIODTIME_L to “0x03e80000”. We have to set EVENTCTRL(16:15) to “00” and
EVENTCTRL(4) to “1”.
Therefore we issue the following commands within the ptpmmm tool:
# ./ptpmmm
Precision Time Protocol (PTP) Engine IEEE1588 V2, V 1.0.1 Rev 125 $
Oregano Systems - Design & Consulting GesmbH Dec 23 2009
clock
clock 0060350000018C37 1 O "IEEE 802.3" 006035018C37 IPv4:00000000 FFFFFF
"Oregano Systems;Model xx;Serial yy" "1.0.1;1.0.1;1.0.2" "name;location"
001B19000100
timeout
page 97
®
syn1588 User Guide
For further details about the usage of the syn1588® Clock Core refer to Chapter 11 of this
User Guide.
page 98
®
syn1588 User Guide
page 99
®
syn1588 User Guide
6.1 Features
The syn1588® drivers offer the following system features:
• Basic Ethernet and IP network driver for the operating system (OS)
• Register interface to syn1588® Clock registers for user applications
• Linux kernel version 2.6.16 to 2.6.30 required
• Linux x32 and x64 architectures supported
• Windows XP, Windows Server 2003 and 2008
• Windows x32 and x64 architectures supported
• Windows Vista support available upon request
6.2.1 Linux OS
There are two basic software modules running in the Kernel space:
• Clock Device Driver (syn1588nic)
• Synchronization Driver (SyncDriver)
There is one or more user application(s) running in the user mode. One example for this
application is Oregano Systems’ syn1588® PTP stack. The syn1588® NIC driver must be
loaded before the SyncDriver.
page 100
®
syn1588 User Guide
The clock device driver module provides the Ethernet interface as well as the interfacing to
the network subsystem of the OS. Additionally it performs all the hardware access and data
abstractions required for the clock synchronization cell.
Furthermore, the clock device driver module implements the general device interrupt
handling and distribution as well as providing a virtual frequency register, thus allowing
applications to adapt to nodes hardware frequency without recompilation.
C-Code Setup
Building
For building the device driver it is necessary to have the Linux kernel sources and the
necessary binary tools for building the kernel installed. Further, in the first line of the
delivered Makefile the variable KSRC has to be set to the kernel source directory. The driver
module can be built by calling the make target syn1588nic.ko or by building both drivers
using target “all”. Help on available target can be found by “make help”. For installing and
loading the driver root permissions are required!
Functional Description
The synchronization driver module provides a character device file for user space
applications. These character device files can be read and written on all valid syn1588®Clock
IP core register addresses using symbolic names.
page 101
®
syn1588 User Guide
These symbolic names for all hardware registers and bit mask names are defined in an
include file specific for a syn1588®Clock IP core. Thus, changing the syn1588®Clock IP core
requires just changing the appropriate include file. Any user space application should include
“SyncDriver.h” in order to get all necessary defined names.
The basic task of the synchronization driver module is to enable multi-application support for
the user. The device virtualization for the important hardware registers (IRSRC, IREN)
supports the following file operations:
• llseek
• read
• write
• poll
• open (blocking/non-blocking)
• release
• fasync
page 102
®
syn1588 User Guide
Command llseek
Action: repositions the offset of the file descriptor to the argument (register position)
according to the directive (3rd argument). If the position is not a multiple of REG_SIZE the
position is truncated to the previous multiple.
Example: position file descriptor to interrupt enable register
lseek(fd, IREN, SEEK_SET);
Command read
Action: reads from the current file descriptor position a number of bytes into the given buffer
(gets register value). Reading from IRSRC can be blocking or non-blocking, depending on
the flags given to the open command.
Example: read from the register, the file pointer is currently pointing to
unsigned long data;
read(fd, &data, REG_SIZE);
Command write
Action: writes the given buffer to the current file descriptor position (sets register value)
Example: enable clock overflow and programmable clock interrupt, requires a lseek to IREN
in advance
unsigned long data = IRQB_TIME_OFLW | IRQB_PCLK;
write(fd, &data, REG_SIZE);
Command poll
Command open
Action: opens the device character file with the given flags.
Example: (open character device read and writeable in non-blocking mode)
int fd; // file descriptor
fd = open(“/dev/” SYNC_DEV, O_RDWR | O_NONBLOCK);
page 103
®
syn1588 User Guide
Command release
Example
The following C-code shows a simple example how to use the commands available in the
synchronisation driver.
#include "SyncDriver.h"
// write to SHDWTIME_M
if (lseek(fd, SHDWTIME0_M, SEEK_SET) < 0) {
perror("lseek");
}
if (write(fd, data, sizeof(data)) < 0) {
error("write");
}
page 104
®
syn1588 User Guide
// close device
close(fd);
C-Code Setup
Building
For building the synchronization driver it is necessary to have the Linux kernel sources and
the necessary binary tools for building the kernel installed. Further, in the first line of the
Makefile the variable KSRC has to be set to the kernel source directory. The driver module
can be built by calling the make target SyncDriver.ko or by building both drivers using target
“all”. Help on available target can be found by “make help”.
A sample script how to load both modules and to generate the device file node is provided as
“syn1588nic.load” and can be started using the target “test”. For installing and loading the
driver root permissions are required!
Installation
The following steps are necessary in order to install the clock device driver under Linux.
1) Plug in syn1588® PCI NIC or syn1588® PCIe NIC to your computer
2) Extract driver sources driver.tgz into the working directory
3) In general two options for installing the driver exist:
A) Installation for use on any Distribution with kernel newer than 2.6.16.x: To compile
the driver just type "make" in the driver working directory. It is necessary to have
the kernel sources installed (usually under /usr/src/linux). Otherwise install them
using Linux distribution-specific package installation routines (e.g. yum install
kernel-devel under CentOS 5.2 distribution). Additionally the kernel has to be
configured for the actual configuration: Copy the kernel configuration file to the
kernel source root directory (cp /boot/config-... /usr/src/linux/.config) and type
"make oldconfig; make" to configure and build the kernel. The kernel build
process may be stopped after a few seconds (when starting actual compiling, CC
output). This is necessary for the module dependencies to be calculated.
B) Using pre-compiled binaries (only for use with CentOS 5.2): Copy the pre-
compiled binaries (SyncDriver.ko and syn1588nic.ko) to the modules directory
(/lib/modules/<kernel-version>/kernel/driver/net.
4) Install driver: Type "make install" with root privileges in the driver working directory.
page 105
®
syn1588 User Guide
5) Activate driver when booting: Add the line "alias eth0 SyncDriver" to the file
/etc/modprobe.conf.local. Replace "eth0" with the actual interface used for the
syn1588(R) PCI/PCIe NIC (use "ifconfig" to figure out the interface name).
6) Automatic network interface configuration: Edit the interface file
(/etc/sysconfig/network/ifcfg-ethx) to set interface options like DHCP, fixed IP address
or the like.
7) Call the "ptp" executeable under root privileges. Starting the "ptp" may be done using
the conventional init.d routines.
page 106
®
syn1588 User Guide
6.2.2 Windows OS
The driver for the syn1588PCI NIC can only be used with Microsoft Windows XP and later
and is optimized for usage with service pack 2. However, service pack 3 is also supported
and fully tested. The NIC appears as Standard Network device in Windows. Therefore, all
applications that are using network devices can be used in context with the syn1588 NIC.
The syn1588 NIC driver supports 100/1000 Mbit/s link speed.
1.1 Supplied files
Files to install the driver:
• syn1588.SYS
• syn1588.INF
• syn1588.CAT
• SOURCES
• MAKEFILE
• syn1588_APP.C
The following files are supplied and necessary for compiling, installing and using the driver.
They consist of already compiled and usable files for installation and their corresponding
source code and are grouped as follows.
page 107
®
syn1588 User Guide
• syn1588.SYS
Resides in the .\sys\objxxx_wxp_x86\i368 folder, where xxx is either ‘chk’ or ‘fre’
• syn1588.INF
Resides in the main folder
To supply an interface, thru which user mode applications can access the syn1588 NIC, the
driver provides the ability to satisfy this need by I/O-Control-Requests (IOCTL). These
requests are initiated by Windows API functions. The functions could be implemented in a
library which contains a set of routines to carry out the communication tasks with the kernel-
mode driver. All interrupts from the PTP Hardware part are also transferred to the user mode.
In Figure 26 a sample application is displayed with an IOCTL library acting in combination
with a WinPCAP library.
page 108
®
syn1588 User Guide
The interface between user-mode applications and the driver is established by a file handle
to the syn1588NIC driver. The windows API offers a set of functions to achieve and process
file handles to device drivers. The sample application supplied with the driver sources is
giving some hints, how to pass requests to the device driver. In general these requests are
passed to the driver by using IOCTL codes. A user mode program has to include the public.h
header file supplied with the driver sources to get the proper code set. Detailed description of
the driver supported IOCTL codes is listed below.
When the first syn1588 NIC is enumerated by the WindowsXP PnP Manager, the driver
creates a device object. There is only one global device object for each installed NIC. To
create a handle to the device object user code must use CreateFile() with “syn1588” as
filename parameter. With DeviceIoControl(), the user program is able to pass requests to the
device object. This function also specifies the number of returned bytes received from the
driver, for this reason the value of the returned bytes is also part of the description.
IOCTL_syn1588_DEVICE_COUNT
Parameter Buffersize Info
Input 0 No input required
Output ULONG Number of installed NICs
Returned bytes sizeof(ULONG) On success
On error
sizeof(IOCTL_STATUS)
Note: This is also 4 Byte long.
Description:
This IOCTL request returns the number of installed syn1588 NIC devices. Only a wrong specified
output buffer length leads to an error and ends in the return of an
IOCTL_STATUS_PARAMETER_ERROR error code.
IOCTL_syn1588_DEVICE_INFO
Parameter Buffersize Info
Input ULONG Number of the desired device
Output syn1588_IOCTL_DEVICE_INFO_DATA Number of installed NICs
Returned bytes Output Buffer size On success
sizeof(ULONG ) Error code
Description:
This request returns the MAC Address as well as the link status of the chosen device. If an error
occurs this request returns the appropriate error code.
page 109
®
syn1588 User Guide
IOCTL_syn1588_DEVICE_SELECT
Parameter Buffersize Info
Input ULONG index of the chosen NIC
Output ULONG Variable to store the result
Returned bytes sizeof(ULONG) On error and success
Description:
With this request the user can choose one of the installed syn1588 NICs. The index starts with one
and ends up to the number returned from IOCTL_syn1588_DEVICE_COUNT. If a wrong index
passed to the driver the request returns IOCTL_STATUS_NO_ADAPTER_AVAILABLE.
Note that if no card has been selected none of the other IO request (except device info) will result
successfully.
IOCTL_syn1588_GET_INT_INFO
Parameter Buffersize Info
Input 0 No Input required
Variable to store the interrupt
Output ULONG
source
Returned bytes sizeof(ULONG) On error and success
Description:
This request returns the last interrupt source in the data field of the IO structure.
IOCTL_syn1588_REGISTER_EVENT
Parameter Buffersize Info
This structure contains a handle to
Input syn1588_IOCTL_INT_REG an event object and the interrupt
mask.
Output syn1588_IOCTL_INT_REG Result of the registration
Returned bytes sizeof(syn1588_IOCTL_INT_REG) On error and success
Description:
To Listen to interrupts generated by the syn1588 Clock IP-Core user mode applications might create
an event object and pass the handle to the object down to the driver. Also the interrupt mask has to
be passed to the driver. If an interrupt occurs, the event will be signaled by the driver.
page 110
®
syn1588 User Guide
IOCTL_syn1588_READ_DATA
Parameter Buffersize Info
Input syn1588_IOCTL_DATA The offset member has to be filled.
Result and data are passed to the
Output syn1588_IOCTL_DATA
user mode application
Returned bytes sizeof(syn1588_IOCTL_DATA) On error and success
Description:
This request initiates a read to the specified offset. Size of the data returned by this request is always
ULONG. If offset is greater than 0x1FFC, an error will be returned within the structure.
IOCTL_syn1588_WRITE_DATA
Parameter Buffersize Info
The offset and the data members
Input syn1588_IOCTL_DATA
have to be filled.
The result is passed to the user
Output syn1588_IOCTL_DATA
mode application
Returned bytes sizeof(syn1588_IOCTL_DATA) On error and success
Description:
This request initiates a write to the specified offset. The write data request always writes one
DWORD to memory. If offset is greater than 0x1FFC, an error will be returned within the structure.
syn1588_IOCTL_DATA
IOCTL_STATUS status Result of the request
Unsigned long Offset Must be in range of 0x0 to 0x1FFC
On read request the data is stored here. On write
Unsigned long Data request this data will be placed at the specified
offset.
syn1588_IOCTL_INT_REG
IOCTL_STATUS status Result of the request
Unsigned long eventHandle Handle to an event Object
Unsigned long intMask Interrupt Mask
If greater zero an existing handle will be replaced
Unsigned long overwrite
by the one specified above.
page 111
®
syn1588 User Guide
syn1588_IOCTL_DEVICE_INFO_DATA
Unsigned char [ ] MAC_ADDRESS Self-explanatory
0 equals to disconnected and 1 equals to
Unsigned char bLinkStatus
connected
C-Code Setup
This section provides information to exemplify the dependencies of the driver source files
and the containing functions. The first figure shown below displays the file dependency within
the driver. The reason for splitting the source code into separate files is to increase the
transparency of the driver project. This structure is adopted from a Microsoft DDK sample
diver project.
Figure 27 depicts the dependencies between the source-code and their corresponding
header files (Included file including file).
page 112
®
syn1588 User Guide
page 113
®
syn1588 User Guide
Building
MS Visual Studio
Installation
The installation is made in a similar way like the installation of each other PnP capable
device, which is inserted into the computer. When the system determines the syn1588NIC
PCI card it asks for the driver. In the installation wizard you specify a path to the driver
provided inf file. Then the wizard passes the information provided within the inf file to the
Windows registry and copies the driver executable sys file to the driver path in the windows
system folder. By default the wizard is looking for the sys file in the same folder the inf file
resides. After these steps are carried out, the system is going to load the driver by calling its
entry routines. If everything is done right, the NIC should appear in the Network Connections
window.
The NIC’s default MAC-Address is no longer static, because it is taken from the cards
internal ROM. However, the user has the ability to replace the default MAC-Address by a
customized address. To enter a custom address, go to the properties menu of the NIC and
select the advanced tab as shown in Figure 28. Amongst other options the Custom MAC-
Address attribute will be found.
page 114
®
syn1588 User Guide
6.2.3 FreeBSD OS
We also have developed a FreeBSD driver for our syn1588® NICs. It is currently tested with
FreeBSD 7.2, but it is compatible with FreeBSD 6.x and FreeBSD 7.x.
C-Code Setup
Building
Building the FreeBSD driver has one prerequisite; you need to have your FreeBSD kernel
sources installed. If you do not want to install the FreeBSD kernel sources or do not want to
build the driver yourself, you can also try our precompiled FreeBSD driver that comes with
the driver sources; just skip to the Installation section.
After you have installed the kernel sources, building the driver for FreeBSD is a very
streamlined Process:
• Unpack the driver sources to a suitable directory:
> mkdir ~/src
> cd ~/src
> tar –xzvf ../freebsd_driver_*.tgz
• Invoke Make:
> cd freebsd
> make
Installation
• Change to the Driver directory if you have not already done this:
> cd freebsd
• Load the driver into the kernel (must be root user to do this):
# kldload ./if_syn.ko
page 115
®
syn1588 User Guide
• If you are satisfied, you can permanently install the module like this:
> make install
Functional Description
Please refer to the Section about the Linux driver for a functional description of the FreeBSD
driver, because the userland interface of the FreeBSD driver is the same as for the Linux
driver. In fact our syn1588® PTP Stack for Linux runs unmodified on FreeBSD as well!
6.3 Diagnostics
The principle operation of the syn1588® PCI/PCIe NIC and the syn1588® PTP-Stack can be
verified by use of a packet dump on the corresponding Ethernet interface, e.g. Wireshark or
TCPdump.
6.3.1 Linux
If you run into problems with the Linux driver, try the following two steps to diagnose the
problem:
1.) Verify that the driver was loaded correctly and did not print any errors in the kernel
log.
To verify that the driver was loaded into the kernel use:
$ lsmod
6.3.2 Windows
Correct installation of the driver can be checked on Windows by opening the network
connections menu and checking for the name “syn1588PCIe Ethernet Adapter”.
page 116
®
syn1588 User Guide
Another good place to have a look at in case of problems is the Device Manager. If the
syn1588® PCI/PCIe NIC is marked as faulty in the Device Manager, then open the Error
Event Log and look for Messages regarding “syn1588”.
6.3.3 FreeBSD
If you run into problems with the FreeBSD driver try these steps:
1.) Verify that the syn1588® NIC driver was loaded into the kernel.
Use the commands kldstat and grep to do this:
kldstat | grep if_syn
This should show up a line containing “if_syn”, if the driver was loaded into the kernel.
2.) Verify that the driver correctly detected and initialized the syn1588® PCI/PCIe NIC.
For this task use dmesg to have a look at the kernel log:
dmesg
page 117
®
syn1588 User Guide
page 118
®
syn1588 User Guide
7.2 Features
• Fully IEEE1588-2008 compliant
• IEEE1588 management messages supported
• IEEE1588 hardware timestamping support using syn1588® NICs
• Software timestamping for use with NICs that do not support IEEE1588 timestamping
• IEEE1588 transparent clock supported
• Adjustable synchronization (rate synchronization as well as state synchronization)
• One step and two step clock support
• Master and slave capability
• Layer-2 support (Linux only)
• Support for PDelay, DelayRequest, and pure syntonization mechanism
• Optional support for unicast operation
• C/C++ implementation
• Support for Linux or Windows operating systems
• Optional IEEE1588 security
• Possibility to synchronize time to GPS receiver
page 119
®
syn1588 User Guide
page 120
®
syn1588 User Guide
page 121
®
syn1588 User Guide
7.5 Diagnostics
Designed as a process that rather runs in the background, the syn1588® PTP Stack does not
necessarily produce any output like a log file etc.. While testing or for maintenance purposes,
however, it is frequently convenient to have more outputs or simply to have an idea of how to
check the sanity of the clock synchronization of a node or within a network. Since the main
core of the syn1588® PTP Stack is the same for all products and operating systems, logging
is similar even in the case of the syn1588® VIP fully integrated solution.
If running the syn1588® PTP Stack without any logging active the operation of the syn1588®
PTP Stack can be checked by checking the process list the operating system is currently
running. If the syn1588® PTP Stack is listed, this is a first positive indication that the stack is
alive. Under Linux a command for checking this could e.g. look like this:
“ps uax | grep ptp”
Another option is to use software to trace the Ethernet network traffic that is being received
or sent on a machine or system. This can be done with a simple tcpdump or with a more
sophisticated wireshark with graphical user interface. In both cases it will make sense to
limit the dump to PTP messages only by applying corresponding filtering rules. Note that only
a PTP master node will send out PTP sync messages periodically, a PTP slave will only
send out PTP delayrequest messages from time to time.
Of course the syn1588® PTP Stack is prepared to produce a sufficient amount of logging for
testing, debugging, or evaluation. To this end the stack has to be started with the according
verbosity level starting with a level of 0 and increasing the amount of logging up to a level of
4, e.g. ptp –v 4. See the following log fragments for comparison or orientation.
page 122
®
syn1588 User Guide
# ptp -C S -v 2
Precision Time Protocol (PTP) Engine IEEE1588 V2, Version 1.1.0 Rev 336 $
Oregano Systems - Design & Consulting GesmbH Apr 7 2011
State Change Listening -> Uncalibrated
TsM 7320.748230043 TsS 7320.779999382 Cor 0.0 Ofs 31769339.0 Build Date and
TsM: Timestamp at Master in [ns] Build Version of the
TsM 7321.755767114 TsS 7321.792174078 Cor 0.0 Ofs 36406964.0 syn1558® PTP Stack
TsM 7322.779030907 TsS 7322.777965288 Cor 0.0 Ofs -1065619.0
TsS: Timestamp at Slave in [ns]
TsM 7323.786553058 TsS 7323.787580251 Cor 0.0 Ofs 1027193.0
TsM 7324.809832010 TsS 7324.809786262 Cor 0.0 Ofs -45748.0
TsM 7325.817369352 TsS 7325.817398968 Cor 0.0 Ofs 29616.0
PathDelay 17876 ns
TsM 7326.840640481 TsS 7326.840639175 Cor 0.0 Ofs -19183.5
Cor: Correction field value in [ns]
TsM 7327.848162972 TsS 7327.848199847 Cor 0.0 Ofs 18998.5
TsM 7328.871426119 TsS 7328.871442707 Cor 0.0 Ofs -1289.5
Ofs: Offset from Master in [ns]
TsM 7330.902238049 TsS 7330.902258626 Cor 0.0 Ofs 2700.5
# ptp -C S -v 4
Precision Time Protocol (PTP) Engine IEEE1588 V2, Version 1.1.0 Rev 336 $
Oregano Systems - Design & Consulting GesmbH Apr 7 2011
Syn1588 compatible hardware found
Hardware Clock Version M-Core V 2.0.0 f=87600000 Hz
ClockId 00:60:35:00:00:01:8E:64
rate & step size for clock
Starting PTP Engine adjusting in [ns/s]
Initializing
ClockHAL initialize
Adjusting Rate by 0 ns/s
Step is (00000B6A, 41E58600)
Settings: ClockId 00:60:35:00:00:01:8E:64
Settings: Prio1 128 ClkClass 255 clkAccuracy 39 clkVariance 65535
Settings: Prio2 128 Domain 0
The arrows indicate
Initializing Unicast incoming PTP messages
Event message of size 44 and their type
---> Sync
Sync Msg received
General message of size 44
---> FollowUp
FollowUp Msg received
General message of size 64
---> Announce
Announce Msg received
BMC new Foreign Master announced
Event message of size 44
page 123
®
syn1588 User Guide
---> Sync
Sync Msg received
General message of size 44
---> FollowUp
FollowUp Msg received
General message of size 64
---> Announce
Announce Msg received
BMC Foreign Master detected
BMC number of valid Announces: 1
Event message of size 44
---> Sync
Sync Msg received
General message of size 44
---> FollowUp
FollowUp Msg received
Timeout: state Listening
Announce Timeout
State Change Event
BMC resetting Foreign Master dataset
State Change Listening -> Uncalibrated
Event message of size 44
---> Sync
Sync Msg received
General message of size 44
---> FollowUp
FollowUp Msg received
TsM 7421.280727903 TsS 7421.309164679 Cor 0.0 Ofs 28436776.0
Synchronizing M2S-Delay 28436776 ns
Offset (M2S - PathDelay) is 28436776 ns
Adjusting Rate by 0 ns/s
Step is (00000B6A, 41E58600)
General message of size 64
---> Announce
page 124
®
syn1588 User Guide
Yet another possibility, and maybe the most convenient one, is to query the status of any
node in a network via the syn1588® management tool, described in more detail in Chapter 7.
If started interactively the log output is visible on the console directly. If started via a boot
script or on the syn1588® Live CDROM the log output can be redirected to a log file, e.g.
/root/ptp.log.
To stop the syn1588® PTP Stack on the syn1588® Live CDROM type: killall -9 ptp .
On other OS this may be different. If started from command line, use CTRL-C to stop the
stack. If properly hooked up to the Linux OS boot setup it can also be started and stopped
via the corresponding scripts, most likely located in the /etc/init.d subdirectory. To start
the syn1588® PTP Stack just change to the directory where the ptp executable is located and
type e.g. ./ptp –v1 –C M. See Section 7.4 for further details.
To find out whether a node or computer is acting as PTP master or as PTP slave, again this
can be checked indirectly using wireshark or tcpdump. If generated, the log files give
indication of the state of the PTP stack starting with verbosity level 2.
To check whether a node or computer is actually synchronizing its local clock accordingly or
to assess the quality or precision of the overall synchronization of a network again there are
several options. First interpreting the log files starting with verbosity level 2 allows getting an
indication of the local clock’s own understanding of its offset from the PTP master. Second a
comparison of the 1 PPS outputs of a number of nodes also gives an indication of the
precision and stability of the synchronization, if possible.
page 125
®
syn1588 User Guide
The Operating System Interface is very simple, because it only is used to query the current
system time from the OS. The definition of this interface can be found in ‘os.h’
The Logging Interface is also a simple interface, because you only have to provide four
Functions that get a printf compatible format string and additional variables. What happens
with the format string and the variables is implementation depended. Typically those strings
will be presented to the user or written to a log file. The definition of this interface can be
found in ‘log.h’
The Software / Hardware Clock Interface is a more sophisticated interface. This interface
is used to connect the syn1588® PTP Stack to a precision hardware clock or software based
clock as an automatic fallback. This interface is used to draw timestamps for network packets
and is also used to control the speed of the hardware or software clock so that its offset to
the master is as small as possible. The definition of this interface can be found in
‘clock_hal.h’
The Network Interface is also a very platform dependent one. If the target platform of the
syn1588® PTP Stack supports BSD style sockets not much has to be done for this interface.
For an implementation example on a target platform without BSD style sockets, have a look
on the MC8051 implementation of the syn1588® PTP Stack. The definition of this interface
can be found in ‘network_ifc.h’
page 126
®
syn1588 User Guide
After a successful build of the syn1588® PTP Stack, the bin folder
contains all built binaries.
The doc folder contains Doxygen templates to automatically build a
manual for the internals of the syn1588® PTP Stack.
In the proj folder is a subfolder with a compiler project for each
already supported working target platform of the syn1588® PTP Stack.
As the name implies, the src folder contains the source code of the
syn1588® PTP Stack.
All paths in the repository are relative to the trunk directory.
To build the syn1588® PTP Stack for Windows open the ptp.sln file
with Visual Studio. This file is located in the msvc directory. We
recommend Visual Studio 2008 Express Edition to build the syn1588®
PTP Stack for Windows.
To build the syn1588® PTP Stack on a Linux machine change your current folder to the gcc
directory and execute the build-all.sh script.
To build the syn1588® PTP for our MC8051 based embedded platforms use the IAR compiler
and open the PTP.eww IAR-Workbench file in the iar subdirectory.
page 127
®
syn1588 User Guide
7.9 Installation
To install the syn1588® PTP Stack and its utility applications copy them to wherever you think
is a suitable place for them. We recommend C:\syn1588 for Windows and /syn1588 for
Linux, but this is not enforced by the applications.
The syn1588® PTP Stack and its utility applications are built with static libraries per default.
This means that there are no constraints on the location on the file system for the syn1588®
PTP Stack and its utilities. In fact this also means that the syn1588® PTP Stack is highly
portable between different Linux distributions in its binary form.
page 128
®
syn1588 User Guide
page 129
®
syn1588 User Guide
page 130
®
syn1588 User Guide
page 131
®
syn1588 User Guide
Invocation Example:
accuracy
accuracy 0060350000018C37 1 39
timeout
Parameter Values:
Default Value: N/A
Allowed Values: 0x20 – 0x31
The announce interval is the interval at which a PTP Master or alternative PTP Master
announces its presence to other PTP nodes in the network.
Invocation Example:
aival
aival 0060350000018C37 1 1
timeout
Parameter Values:
Default Value: 1
Allowed Values: 0 – 4
The Announce Receipt Timeout specifies the number of Announce Intervals that has to pass
without receipt of an Announce message before the occurrence of the event
ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Invocation Example:
atout
atout 0060350000018C37 1 3
timeout
Parameter Values:
Default Value: 3
Allowed Values: 2 – 255 (subject to further restrictions depending on PTP
Profile)
page 132
®
syn1588 User Guide
This is a syn1588® specific command. Therefore this command is only usable in combination
with syn1588® Nodes. With this command you can set/get hardware clock registers of
syn1588® nodes.
Refer to chapter 3.7 for further details about the syn1588® registers.
The basic rule for this command is:
clkman <clockid> <portnr> <domain> <addr> <data>
Invocation Example:
clkman 0060350000018C37 1 O 0x0
clkman 0060350000018C37 1 0x00000000
timeout
With this command you get the clock description of the specified clocks or of all of them.
Invocation Example:
clock
clock 0060350000018C37 1 O "IEEE 802.3" 006035018C37 IPv4:00000000 FFFFFF
"Oregano Systems;Model xx;Serial yy" "1.0.1;1.0.1;1.0.2" "name;location"
001B19000100
timeout
With this command you can query the current dataset from a PTP node.
The current dataset shows you the distance of the clock to the grandmaster clock, its offset
from the master and the mean path delay.
Invocation Example:
current
current 0060350000018C37 1 0 0.0 0.0
timeout
page 133
®
syn1588 User Guide
timeout
With this command you can set/query the delay mechanism used by a clock to calculate the
mean path delay
Invocation Example:
dlymech
dlymech 0060350000018C37 1 E2E
timeout
Parameter Values:
Default Value: Implementation/Profile specific
Allowed Values: 0x01 (E2E) Delay Request/Response mechanism used
0x02 (P2P) Peer Delay mechanism used
0xFE No delay mechanism used
With this command you can Set/Get the current domain a clock is participating in. Each PTP
node only reacts to messages from other PTP nodes which belong to the same domain.
Invocation Example:
domain
domain 0060350000018C37 1 0
timeout
Parameter Values:
Default Value: 0
Allowed Values: 0x0 – 0xFF
With this command you can initialize a PTP Node. This command has a parameter, the
InitializationKey. Depending on the InitializationKey the initialization can yield different
results.
Invocation Example:
init 0060350000018C37 1 0 0x0000
init 0060350000018C37 1
Parameter Values:
InitializationKey Values: 0x0000 Perform default
initialization
0x0001 - 0x7FFF Reserved. No Action
page 134
®
syn1588 User Guide
This command retrieves a list of fault log entries from a clock. This command does not delete
the retrieved records from the fault log.
Invocation Example:
log
log 0060350000018C37 1 NOT_SUPPORTED
timeout
With this command you can query the Parent Dataset from a clock
Invocation Example:
parent
parent 0060350000018C37 1 0060350000018C37 0 0 65535 2147483647 128 6 39
65535 128 0060350000018C37
timeout
With this command you can set/get the Peer Delay Interval. The Peer Delay Interval is the
time between two consecutive measurements of the Peer Delay using the configured Peer
Delay measurement mechanism.
Invocation Example:
page 135
®
syn1588 User Guide
pival
pival 0060350000018C37 1 0
timeout
Parameter Values:
Default Value: 0
Allowed Values: 0 – 5
With this command you can query the Port Dataset of a clock port.
Invocation Example:
port
port 0060350000018C37 1 0060350000018C37 1 Master 4 0 1 3 0 E2E 0 2
With this command you can disable a port of a clock. This command causes the
DESIGNATED_DISABLED event to occur.
Invocation Example:
portdis 0060350000018C37 1 0
portdis 0060350000018C37 1
With this command you can enable a port of a clock. This command causes the
DESIGNATED_ENABLED event to occur.
Invocation Example:
porten 0060350000018C37 1 0
porten 0060350000018C37 1
With this command you can Set/Get the Value of priority1 of the Default Dataset.
Since the priority1 attribute is considered in the operation of the Best Master Clock algorithm,
the setting of the priority1 attribute in any clock by means of this command can result in a
change of grandmaster the next time the Best Master Clock algorithm is performed.
Invocation Example:
prio1
prio1 0060350000018C37 1 4294967168
timeout
Parameter Values:
page 136
®
syn1588 User Guide
With this command you can Set/Get the Value of priority2 of the Default Dataset.
Since the priority2 attribute is considered in the operation of the Best Master Clock algorithm,
the setting of the priority2 attribute in any clock by means of this command can result in a
change of grandmaster the next time the Best Master Clock algorithm is performed.
Invocation Example:
prio2
prio2 0060350000018C37 1 4294967168
timeout
Parameter Values:
Default Value: 128
Allowed Values: 0 – 255 (subject to further restrictions depending on
PTP Profile)
The receipt of this command causes the values in non-volatile read-write memory to be reset
to their default values.
Invocation Example:
reset
reset 0060350000018C37 1 NOT_SUPPORTED
timeout
The receipt of this command causes the current values of the applicable dynamic and
configurable data set members to be copied into non-volatile read−write memory.
Invocation Example:
save
save 0060350000018C37 1 NOT_SUPPORTED
timeout
With this command one can Set/Get the current Sync Interval.
Invocation Example:
page 137
®
syn1588 User Guide
sival
sival 0060350000018C37 1 0
timeout
Parameter Values:
Default Value: 0
Allowed Values: -1 – +1
With this command one can Set/Get the value of the Slave Only Mode bit. If this bit is TRUE
the PTP Node cannot become a Master or Grandmaster Clock.
Invocation Example:
slave
slave 0060350000018C37 1 0
timeout
Parameter Values:
Default Value: 0
Allowed Values: 0 - 1
With this command one can Set/Get the current time of a PTP Node. Setting of the time only
makes sense on a grandmaster clock.
Invocation Example:
time
time 0060350000018C37 1 04b30830f 19570680
ttimeout
page 138
®
syn1588 User Guide
With this command one can Set/Get the current Timescale of the PTP node.
Invocation Example:
timescale
timescale 0060350000018C37 1 P 160
timeout
With this command one can get the Time Properties Dataset of a PTP node.
Invocation Example:
tprop
tprop 0060350000018C37 1 33 P 160
timeout
With this command one can get the Traceability Properties of a PTP node.
Invocation Example:
traceab
traceab 0060350000018C37 1 0
timeout
With this command one can set/get the User Description of a PTP node. This is a text field
with a maximum size of 128 Octets.
Invocation Example:
user
user 0060350000018C37 1 "name;location"
timeout
user 0060350000018C37 1 0 "Grandmaster;Room1"
user 0060350000018C37 1
With this command one can Set/Get the UTC Properties of the PTP node.
Invocation Example:
utc
utc 0060350000018C37 1 33 0
page 139
®
syn1588 User Guide
timeout
page 140
®
syn1588 User Guide
With this command one can Set/Get the PTP Version used by a clock port.
Invocation Example:
version
version 0060350000018C37 1 2
timeout
Parameter Values:
Default Value: 2
Allowed Values: 1 Process only PTP version 1 messages on this port
2 Process only PTP version 2 messages on this port
page 141
®
syn1588 User Guide
page 142
®
syn1588 User Guide
page 143
®
syn1588 User Guide
Our syn1588® software for Windows and Linux is located in the folders mentioned in Table
22 on the Live CD. Here is a list of the syn1588® software and a short description of every
software:
Binary Usage
esync / esync.exe This tool is used for external synchronization to GPS
devices.
lsync / lsync.exe This tool is used for local synchronization of different clocks
on the local system. For example syncing the system clock
to the hardware clock on an Oregano NIC
ptp / ptp.exe This is the PTP-Stack for version 2 of the PTP protocol
ptp1 / ptp1.exe This is the PTP-Stack for version 1 of the PTP protocol
ptp_demo / ptp_demo.exe This is a demo version of the PTP-Stack for version 2 of the
PTP protocol. It runs without syn1588® hardware but stops
syncing after some time.
ptpmmm / ptpmmm.exe This tool is used to query PTP-nodes using the PTP
management interface.
syn1588 / syn1588.exe This tool is used to query the registers of a local syn1588®
hardware clock on an Oregano NIC
®
Table 23 Available syn1588 software on the LiveCD
page 144
®
syn1588 User Guide
page 145
®
syn1588 User Guide
11.1 Basics
Before one can use the inputs and outputs of the syn1588® Clock Core in an efficient and
easy manner, one has to understand the functionality of three Registers:
• IREN / IRSRC
• EVENTCTRL
• IOMATRIX
The usage of the IREN and IRSRC is straightforward. If you want to get an Interrupt when a
specific hardware event occurs, you set the associated bit in the IREN register.
If the hardware event occurs, the associated bit in the IRSRC register is set and the
hardware interrupt line is activated. To clear the interrupt write a zero to the associated bit in
the IRSRC register.
Refer to 3.7.1.8 and 3.7.1.9 for further details about IREN and IRSRC.
The next important register is EVENTCTRL. With the EVENTCTRL register one can enable
and disable the generation of events. The EVENTCTRL register is very similar to use as the
IREN and IRSRC registers. Every event that can be generated has an associated Bit in the
EVENTCTRL register. Just set the associated Bit to 1 to enable the Feature or 0 to disable it.
Refer to 3.7.1.11 for further details about EVENTCTL.
IOMATRIX
The last but not least of the common registers is the IOMATRIX register. You can think of the
IOMATRIX register as a switch board. With the IOMATRIX register you can connect every
event input port to every event output port, and also invert the signals along the way.
You can sink of every port that generates events as a source and of every port that gets
events routed to as sinks.
Within the IOMATRIX Register every sink has a fixed position in the Register. And every
Source has a fixed value. So if you want to connect a source to a sink you write the value of
the source to the position of the sink.
Refer to 3.7.1.36 for further details about IOMATRIX.
page 146
®
syn1588 User Guide
There are two sinks to react on external events. They are EVENTINPUT0 and
EVENTINPUT1. Even though the name of them is similar, they are a little different.
EVENTINPUT0 uses a fifo to store occurred events and EVENTINPUT1 does not.
Because of this, EVENTINPUT0 is better suited for situations where a lot of events can occur
in a short amount of time, and EVENTINPUT1 is for events that occur rather seldom.
If there is an event on EVENTINPUT0 the current time of the syn1588® clock is stored and
added to the fifo, which can be read out from the registers EVENTTIME0_L and
EVENTTIME0_H. The read order of these two registers is important! Always read
EVENTTIME0_L first and EVENTTIME0_H last. The fifo stores up to 16 entries.
If you read the contents of the fifo remember to read the fifo until it is empty, which is
indicated by a value of 0 for EVENTTIME0_L and EVENTTIME0_H. This is important,
because EVENTINPUT0 only generates an interrupt if the fifo is empty.
Events on EVENTINPUT1 get recorded in the registers EVENTTIME1_L and
EVENTTIME1_H. Do not wait too long to read the value of EVENTTIME1_L and
EVENTTIME1_H, because it gets overwritten whenever an event on EVENTINPUT1 occurs.
Because of that EVENTINPUT1 generates an Interrupt every time an event occurs.
Another possibility of external events which does not fit in the source/sink analogy is
timestamping of Ethernet packets. Timestamping of Ethernet packets basically works like
this:
You define a pattern that matches the packets you want to timestamp and put it into the
pattern memory of the timestamping unit.
You define some data to extract from the packet, so you can later associate the drawn
timestamp to the timestamped packet. This information goes into the ControlRegister of the
timestamping unit.
When the timestamper detects a packet that matches the pattern and has a correct FCS the
timestamp is copied into a timestamp fifo. This is indicated by the status register of the
timestamp fifo.
Now all you have to do is read out the timestamp from the timestamp fifio.
page 147
®
syn1588 User Guide
The One Pulse per Second is the most basic Event to generate and use, because this is
automatically enabled when starting the syn1588® PTP Stack.
Periodical Events are similar events to the one pulse per second, but as the name implies
the period of the signal can be freely chosen by the user.
Two Resources are available to generate Periodical Events, namely PERIODTIME0 and
PERIODTIME1. These two work exactly the same, so only PERIODTIME0 will be explained.
You define the Period of your Signal with the two registers PERIODTIME0_L and
PERIODTIME0_H and enable the periodical event using the associated bit in the
EVENTCTRL register.
For a diagram of how to enter seconds, nanoseconds and sub nanoseconds into the
PERIODTIME registers, refer to Table 17 for details about the alignment of time into the
registers.
With the two TRIGTIME resources of the syn1588® Clock Core you can set up events in the
future that will occur exactly at the specified time. TRIGTIME0 is Fifo based and TRIGTIME1
is not. This is similar to EVENTINPUT0 and EVENTINPUT1
The Fifo based TRIGTIME0 is useful for situations where it is necessary to generate a lot of
Events (Signal Edges) in a short Amount of time. You can load the TRIGTIME0 Fifo with up
to 16 Events.
To use TRIGTIME0 you have to enable it using the associated bit in the EVENTCTRL
register first. This is important because if TRIGTIME0 is not enabled the Fifo is in a reset
state and all data is flushed.
After TRIGTIME0 is enabled, fill the Fifo with Values. Be careful to write to TRIGTIME0_L
first and TRIGTIME0_H last, because otherwise the fifo will not contain the values you are
expected.
page 148
®
syn1588 User Guide
What happens next is that every time the syn1588® Clock Core reaches the time of the
current fifo value, the event is generated and the next fifo value is loaded for comparison.
This continues until the fifo is empty or TRIGTIME0 is disabled using the associated
EVENTCTRL bit.
The usage of TRIGTIME1 is straightforward: Enable TRIGTIME1 in the EVENTCTRL register
and write the desired time into the TRIGTIME0_L and TRIGTIME0_H registers. Afterwards
the event will be generated when the syn1588® Core Clock reaches the specified time.
For a diagram of how to enter seconds, nanoseconds and sub nanoseconds into the
TRIGTIME registers, refer to Table 17 for details about the alignment of time into the
registers.
It is also possible to combine TRIGTIME and PERIODTIME. This is accomplished using the
EVENTCTRL register. Using this you can define exactly when a periodical event should
begin. You can combine PERIODTIME0 and PERIODTIME1 with TRIGTIME0 or
TRIGTIME1.
To accomplish this Task, first setup the desired combination of PERIODTIME and TRIGTIME
resources using the bits reserved for this task in the EVENTCTRL register.
Now setup the PERIODTIME resource as explained in Section 11.3.2. Then setup the
TRIGTIME resource as explained in Section 11.3.3 and that’s it!
page 149
®
syn1588 User Guide
page 150
®
syn1588 User Guide
12.1 Precision
Supposing that the mentioned uncertainties are averaged sufficiently long, the achievable
precision can be summarized in the following equation, as
π = Max{ εPHY, εCABLE, εLINK, ρI, G } ,
where
• εPHY is the Ethernet physical layer uncertainty,
• εCABLE is the cable delay asymmetry,
• εLINK is the Ethernet link layer uncertainty,
• ρ is the drift of the local clock oscillator,
• G is the granularity of the local clock,
• I is the synchronization interval.
εPHY
10 Mbit/s 400 ns
100 Mbit/s 2 ns
1 Gbit/s 8 ns
page 151
®
syn1588 User Guide
εCABLE
100 m CAT5 Not defined
100 m CAT5E 45 ns
100 m CAT6 45 ns
εLINK
Hub 100 Mbit/s (no Collisions) 20 ns
Hub 10 Mbit/s (no Collisions) 40 ns ?
Switch 100 Mbit/s (no Traffic) 100 ns
Switch 10 Mbit/s (no Traffic) 500 ns ?
Transparent Switch 100 Mbit/s (independent of Traffic, 5 ns ?
Timestamping Granularity neglected)
Transparent Switch 10 Mbit/s (independent of Traffic, 400 ns
Timestamping Granularity neglected)
Switch 100 Mbit/s (with Traffic) 20 µs
Switch 10 Mbit/s (with Traffic) 200 µs
ρI (1 s) ρI (10 s) ρI (100 s)
XO (100 ppm) worst case 100 µs 1 ms 10 ms
TCXO (10 ppm) worst case 10 µs 100 µs 1 ms
OCXO (0.1 ppm) worst case 100 ns 1 µs 10 µs
XO (100 ppm) typical 10 µs 100 µs 1 ms
page 152
®
syn1588 User Guide
G
Adder based clock in FPGA 10 ns
Adder based clock in ASIC 5 ns
Adder based clock in FPGA (with 2,5 ns
HF-Prescaler for Timestamping)
Adder based clock in ASIC(with 1 ns
HF-Prescaler for Timestamping)
page 153