Real-Time Systems
Real-Time Networking
Цели урока
- Understand TSN principles: time synchronization and Time-Aware Shaper
- Learn CAN bus arbitration and SocketCAN usage in Linux
- Understand AVB/CBS for media applications
- Select the right deterministic networking protocol for a given use case
An industrial robot lost synchronization with its servo drives due to 2 ms of network jitter - and an expensive part was ruined. Deterministic networks solve exactly this: guaranteed packet delivery at the right moment, not 'sometime soon'.
- **Tesla:** CAN FD + Automotive Ethernet in every car for ECU and camera communication
- **BMW iDrive:** AVB carries 20+ audio channels over a single Ethernet cable
- **Siemens SINUMERIK:** TSN for sub-millisecond CNC machine tool control
- **Glastonbury, Coachella:** Dante (AVB) distributes 512 audio channels across the concert site
TSN: Time-Sensitive Networking
Standard Ethernet is best-effort: packets compete for the medium and delays are unpredictable. **Time-Sensitive Networking (TSN)** is a set of IEEE 802.1 standards that add determinism to Ethernet. It is not a new protocol - it is an extension of existing infrastructure.
The foundation of TSN is time synchronization across all nodes (IEEE 802.1AS, gPTP) with accuracy below 1 us. All switches and endpoints share a common time, enabling packet transmission to be scheduled with nanosecond precision.
TSN requires hardware support: network cards and switches must apply schedules in hardware. Intel i210/i225, NXP LS1028A, Microchip LAN9662 are examples of TSN-capable chips. Software TSN without hardware timestamping gives significantly worse results.
What is the foundation that makes Time-Aware Shaper (TAS) in TSN work?
CAN bus: protocol and arbitration
**Controller Area Network (CAN)** was developed by Bosch in 1983 for automotive electronics. Decades later it remains the de-facto standard in cars, industrial automation, and medical devices - valued for reliability, determinism, and fault tolerance.
The key feature of CAN is **collision-free arbitration**. All nodes start transmitting simultaneously, but the node with the lowest ID wins: dominant bits (0) override recessive bits (1). A losing node stops instantly and waits. The result: deterministic priority without a central arbiter.
CAN FD (Flexible Data-rate, 2012) extends CAN: up to 64 bytes of data instead of 8, speed up to 8 Mbit/s in the data phase. CAN XL (2023) goes further: up to 2048 bytes and 20 Mbit/s. But basic CAN 2.0 (500 kbit/s) still dominates in automotive.
How does CAN bus resolve conflicts when multiple nodes transmit simultaneously?
Ethernet AVB for media
**Audio Video Bridging (AVB)** is the predecessor to TSN, developed to guarantee audio and video delivery over Ethernet. IEEE 802.1BA uses a Credit-Based Shaper (CBS) to reserve bandwidth for real-time streams.
AVB is widely used in professional audio (Dante, AES67, Milan) and in automotive (BMW, Mercedes use AVB for multimedia buses). TSN is its successor with stricter guarantees for industrial use.
**Milan** (2020) is a profile on top of AVB/TSN created by a consortium of pro-audio companies (AVID, Focusrite, and others). It standardizes AVB for live concerts: guaranteed latency below 2 ms with 250+ audio channels over a single network.
When a stream's credits run out in AVB Credit-Based Shaper, what happens?
Deterministic networks: comparing approaches
Several approaches to deterministic networking exist, each with its own trade-off between complexity, latency, and compatibility with existing infrastructure.
| Protocol | Latency | Bandwidth | Use case | Compatibility |
|---|---|---|---|---|
| CAN 2.0 | < 1 ms | 1 Mbit/s | Automotive ECU, industry | None (dedicated cable) |
| CAN FD | < 1 ms | 8 Mbit/s | Automotive CAN FD | CAN 2.0 (partial) |
| Ethernet AVB | < 2 ms | up to 100 Mbit | Pro audio, automotive media | Standard Ethernet |
| TSN | < 100 us | up to 10 Gbit | Industry, automotive | Standard Ethernet |
| PROFINET RT | < 1 ms | 100 Mbit | Siemens PLC networks | Ethernet (custom stack) |
| EtherCAT | < 100 us | 100 Mbit | Servo drives | Ethernet (master/slave) |
For controlling a 6-DOF robot arm with servo drives, 1 ms control cycle, standard Ethernet cable - the optimal choice is:
Deterministic networks
- TSN = standard Ethernet + gPTP sync + Time-Aware Shaper, latency < 100 us
- CAN bus: non-destructive bitwise arbitration by ID, 1 Mbit/s, indispensable in automotive
- AVB/CBS: bandwidth reservation via credits, latency < 2 ms, pro-audio standard
- Choosing: CAN for short RT messages, TSN for high bandwidth + determinism, AVB for media
- Linux: SocketCAN for CAN, tc taprio for TSN, ptp4l for time sync
Related topics
Deterministic networks work together with RT operating systems.
- Real-Time Linux — OS foundation for TSN endpoints
- Real-time scheduler — Task management on RT endpoint devices
- Industrial protocols — PROFINET, EtherCAT in context
Вопросы для размышления
- Why does TSN require hardware support in network cards rather than just a software stack?
- CAN has existed for 40 years and still dominates automotive - what properties ensure such longevity?
- How does gPTP achieve synchronization accuracy below 1 us over standard Ethernet without GPS?