Demonstration of Precision Time Protocol in VxWorks
An industrial system can consist of hundreds of sensors, motors, and controllers. When the physical infrastructure connecting them together is an Ethernet network, it takes special handling to make sure that sensor data and control commands reach their destinations in the network within a hard time limit, often within one or two microseconds. Failure for a message to reach its destination in time can result in uncoordinated mechanical movements, or wrong correlation of sensor data.
Time-sensitive networking (TSN) contains a set of standards to address the needs of time-critical networked applications. As a first step, devices on the network need to have their clocks synchronized to sub-microsecond level. The IEEE 802.1AS synchronization standard enables clock synchronization across TSN-aware devices on linked networks.
The IEEE 802.1AS standard is a profile of the Precision Time Protocol (PTP). VxWorks users have the ability to participate in TSN networks using PTP, and to make use of the high precision clock available in some Ethernet controllers. Devices running VxWorks can synchronize with other devices running 802.1AS – those running VxWorks and those running other operating systems with PTP. VxWorks devices can run as the clock master, clock slave, or as the boundary clock to extend the network.
I tried out the VxWorks implementation of PTP across two boards: a Kontron mini-ITX board and an Intel Customer Reference Board (CRB). Both boards have Intel Core i5 processors, and both boards are outfitted with Intel I210 Ethernet PCIe cards. The Intel I210 Ethernet controller contains a high precision timer supported by VxWorks. This controller includes a digital output pin called the Software Defined Pin (SDP). This pin can be set up to switch voltage in hardware when the high precision timer reaches certain values, so it can be programmed to emit specific pulses per second.
The two VxWorks devices are connected to a Cisco switch with 802.1AS capabilities. The Cisco switch acts as the master clock, and the two VxWorks devices synchronize their system clocks to the master clock. The SDP on both devices is set up to emit a digital output pulse 10 times a second based on the I210 high precision timer. Using an oscilloscope probing the SDP, I can see the synchronization between the two boards. See Figure 1.
Figure 1 TSN Setup. Two VxWorks slave clock devices connected to a Cisco switch master clock.
The results confirm the ability for VxWorks to synchronize at the sub-microsecond level. Figure 2 shows the traces on my oscilloscope when the nodes are disconnected from the Cisco switch. The two traces each correspond to the SDP from one of the VxWorks devices. I’ve offset the voltages slightly to avoid overlapping the traces. You can see that when not using TSN, the clocks are wildly out-of-sync by almost 60 milliseconds. This large offset is expected. While both devices are deterministic and real-time, there is no correlation between the timers on the two devices.
Figure 2 No PTP synchronization. Digital outputs at 10 pulses per second. 50 milliseconds per division.
When I connect the two nodes to the Cisco switch, PTP synchronization happens automatically. The two traces snap together instantly. Figure 3 shows the digital output of the two devices with PTP synchronization.
Figure 3 With PTP synchronization. Digital output at 10 pulses per second. 50 milliseconds per division.
To see if the devices read the refined timing criteria required by 802.1AS, I can zoom in to see precisely how well aligned the pulses are to each other. In the traces in Figure 4, the pulses are 20 nanoseconds apart. The traces generally drift between 20 – 50 nanoseconds.
Figure 4 PTP Synchronization at the sub-microsecond level. The traces are the pulses produced by the SDP on the Intel I210 ethernet controller. The oscilloscope is set to 100 nanoseconds per division.
Now that we know VxWorks can synchronize clocks over Ethernet, the devices can participate in TSN scheduled traffic, opening up the way to time-critical network applications.
The sub-microsecond synchronization demonstrates the PTP capabilities of VxWorks. Wind River continues to invest in more TSN standards, enabling VxWorks devices to correlate sensor readings collected across industrial systems and push out coordinated commands to actuators. Wind River participates in the Industrial Internet Consortium (IIC) TSN Testbed http://www.iiconsortium.org/time-sensitive-networks.htm, and coordinates with other TSN device manufacturers to ensure interoperability. You can learn more about the VxWorks RTOS products at http://www.windriver.com/products/vxworks/.