AEICOR - Industry 4.0 Technology Library
Docs» Technology» Industry 4.0 — OT/IT convergence» OPC UA: an Industry 4.0 information framework» S2OPC - Safe & Secure Open-source OPC UA stack» S2OPC : Safe & Secure OPC UA - Quick Start Guides» S2OPC - TSN

S2OPC - TSN

This guide runs the S2OPC OPC UA PubSub sample across a Time-Sensitive Networking path between two Linux hosts, using the kernel's ETF (Earliest TxTime First) qdisc for transmit scheduling and IEEE 1588 / IEEE 802.1AS time synchronisation through linuxptp. Publisher and subscriber are two DUTs connected peer-to-peer through Intel i210 NICs. Versions used here: RT kernel 5.05, linuxptp v3.1, iproute2 v5.0; the lowest publisher cycle time exercised was 1 ms.

Prerequisite

  • S2OPC – TSN testing requires 2 DUT’s with below configuration
  • DUT H/W: i5 Quad core with intel i210 NIC card
  • DUT S/W: Install debian 9.5 or ubuntu on the DUT + RT kernel 5.05
    • Enable <font inherit/inherit;;inherit;;transparent>ETF, CBS, MQPRIO and TAPRIO scheduler in networking options during kernel config</font>
  • [Note] The DUT hardware configuration is upto the users. If you need steps to setup the DUT with Linux + RT patch follow this QSG

Dependencies

  • After installing Debian + RT kernel in the DUT’s, now login
  • Follow these dependencies section and install all packages. For TSN demo, PTP and iproute2 package should be installed additionally.
Linux PTP v3.1 – release installation
  • Now come back to ** S2OPC/** parent folder and download and install latest PTP stack v3.1 – release
# wget https://github.com/richardcochran/linuxptp/archive/v3.1.tar.gz
# tar -xvf linuxptp-3.1.tar.gz
# cd linuxptp-3.1/
# make
# make install
Iproute2 v5.0 – release
# cd ..
# wget https://github.com/shemminger/iproute2/archive/v5.0.0.tar.gz
# tar -xvzf iproute2-5.0.0.tar.gz
# ./configure
# make
# make install

Run S2OPC TSN demo application

Network Architecture
  • Connect the DUT 1 and 2 i210 NIC in peer to peer (P2P)
  • DUT1 is the publisher and DUT2 is the subscriber.

Queuing discipline

On DUT 1 (publisher): Run the below commands; Replace the IFNAME with the i210 interface name. Use “ifconfig” to find the interface name.

# tc qdisc add dev <IFNAME> parent root handle 100 mqprio num_tc 3 map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 queues 1@0 1@1 2@2 hw 0
# tc qdisc add dev <IFNAME> parent 100:1 etf offload clockid CLOCK_TAI delta 150000
IEEE - 1588 time synchronization

Time synchronization is one of the core functionalities of TSN which uses IEEE 1588 in 802.1AS, also known as Precision Time Protocol (PTP).

  • ptp4l: Synchronizes the PTP Hardware Clock (PHC) from the i210 NIC
  • phc2sys: Synchronizes the PHC and the System clock

In this demo, DUT 1 will act as ptp4l master and DUT 2 as ptp4l slave.

On DUT 1 (publisher):

  • Run the below PTP4l and PHC2SYS command

# ptp4l -i <IFNAME> -2 -mq

  • Open another terminal and run PHC2SYS command

# phc2sys -s enp1s0 -m -O 0

On DUT 2 (subscriber):

  • Run the below PTP4l and PHC2SYS command. The slave device report out the time offset calculated from the PTP master.

# ptp4l -2 -s -i <IFNAME> -m

Compile and run S2OPC Publisher application
  • Open a new terminal. Clone the S2OPC repository from GitLab
# git clone https://gitlab.com/systerel/S2OPC.git
# cd S2OPC
  • Open samples/RT_PubSub/udp_rt_pub.c, modify the ETH_INTERFACE, MCAST_PORT, MCAST_ADDR and CYCLE_TIME flag as per the DUT configuration. The lowest cycle time tested is 1ms i.e 1000000ns

# ./build.sh
# cd build/bin
# ./udp_rt_pub

In DUT 2 (subscriber): For measuring the layer2 network jitter, run the below command

# tcpdump -c 60000 -i <IFNAME> -w tmp.pcap -j adapter_unsynced -tt –time-stamp-precision=nano udp port 4840

Now, open the trace in wireshark and verify the packet-to-packet jitter.

  • You should observe a worstcase network jitter of +/-40 ns with few outliers (approx <0.02%)

To download live analyzer tool

To see our test bench results


For more help with setting up your evaluation and toolkits, contact us at adopt.opctsn@aeicor.com
You can also reach S2OPC support at https://www.s2opc.com

Previous Next

Site Tools

  • Media Manager

Page Tools

  • Show pagesource
  • Fold/unfold all
  • Back to top

User Tools

  • Log In
technology/industry40/opcua/s2opc/qsg/etfpubsub.txt · Last modified: 2026/07/30 20:02 by apibot
AEICOR - Industry 4.0 Technology Library

Table of Contents

Table of Contents

  • Prerequisite
  • Dependencies
  • Run S2OPC TSN demo application
  • Case studies: delivered systems, written for a reader
  • custom-solutions
  • dev
  • Machine-builder industries: the same engineering, every industry
  • Embedded platforms: choosing between an RTOS and embedded Linux
  • playground
  • Silicon for industrial communication
  • Solutions and tools: engineering wedges, delivered as a service
  • Technology
  • Turnkey product development
  • Use cases: what the machine actually has to do
  • Whitepapers and webinars
  • wiki