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 1 or 2µs.
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 synchronised to a sub-microsecond level. The IEEE 802.1AS synchronisation standard enables clock synchronisation 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 synchronise 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 synchronise 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 synchronisation 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 synchronise 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 60ms. 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 synchronisation: digital outputs at 10 pulses per second; 50ms per division
When I connect the two nodes to the Cisco switch, PTP synchronisation happens automatically. The two traces snap together instantly. Figure 3 shows the digital output of the two devices with PTP synchronisation.
Figure 3 - With PTP synchronisation: digital output at 10 pulses per second; 50ms 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 20ns apart. The traces generally drift between 20-50ns.
Figure 4 - PTP Synchronisation at the sub-microsecond level: the traces are the pulses produced by the SDP on the Intel I210 Ethernet controller; he oscilloscope is set to 100ns per division
Now that we know VxWorks can synchronise clocks over Ethernet, the devices can participate in TSN scheduled traffic, opening up the way to time-critical network applications.
The sub-microsecond synchronisation 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 and coordinates with other TSN device manufacturers to ensure interoperability. You can learn more about the VxWorks RTOS products here.
By Ka Kay Achacoso.