deterministic and flexible communication for real-time ... hu_presentation.pdf · it is the de...

23
Deterministic and Flexible Communication for Real-Time Embedded Systems Supervisor Candidate prof. Riccardo Sisto Tingting Hu dott. Ivan Cibrario Bertolotti Department of Control and Computer Engineering (DAUIN) Politecnico di Torino 2015/02/27 Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 1 / 23

Upload: others

Post on 25-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Deterministic and Flexible Communication forReal-Time Embedded Systems

Supervisor Candidateprof. Riccardo Sisto Tingting Hudott. Ivan Cibrario Bertolotti

Department of Control and Computer Engineering (DAUIN)Politecnico di Torino

2015/02/27

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 1 / 23

Page 2: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Outline

Introduction

Controller Area Network (CAN)

Deterministic Communication

8B9B, VHCC, ZSC

Flexible Communication

IP over CAN

Modbus CAN

Conclusion

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 2 / 23

Page 3: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Introduction

As embedded systems evolve from centralized to distributed architecture,communication becomes more and more important.

Controller Area Network (CAN) is a real-time communication network

It is the de facto standard in automotive and gained popularity innetworked embedded control systems recently.

Determinism is an important feature of real-time embedded systems:

I Delay: time taken to complete a certain taskI Jitter: variability in delay

Jitter impairs determinism, and worsens the real-time performance

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 3 / 23

Page 4: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Sources of jitter in CAN-based distributed system

CAN Node

Operating System

T1

Device Driver

CAN Controller

Tn

CAN Node CAN Node

Header Data CRC

OS schedulingand timingVariable task execution time

Software

Hardware

CPU/Controllerinterface [1]

Bus arbitration

Bit stuffing

CAN bus

Task-level jitter

Comm.-level jitter

1G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Performance Evaluation andImprovement of the CPU–CAN Controller Interface for Low-Jitter Communication”.Proc. IEEE ETFA.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 4 / 23

Page 5: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Bit stuffing mechanism

At the physical layer, CAN relies on bit stuffing (BS) for receiversynchronization

Tx

…10000001…

Rx

…10000001…

…100000(1)01…

Rx

…10000001…

# of stuff bits depends not only on the frame length, but also onits content⇒ Jitter in communication.For real-time systems with tight timing constraints, ~20% ofsystem-wide jitter.BS interferes with the CRC-based error detection mechanismin CAN and jeopardizes data integrity severely.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 5 / 23

Page 6: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

State of the art

ID(11 bit)SOF ID(11 bit) RTR r1 r0 DLC

(4 bit)DATA

(0 ... 64 bit)CRC

(15 bit) CDEL ACK

ADEL EOF

(7 bit)

Bit stuffing No bit stuffing

Header Data field CRC Trailer

Header: fixed & known in advance⇒ no communication jitterData field: variable from message to messageCRC: depends on both the header and the data field;

calculated by hardware, at run time

Existing approaches just prevent BS jitter in the data field, byeither scrambling or encoding the payload in a way that less or nostuff bits will be added by the CAN controller during transmission.NO approaches available for the CRC.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 6 / 23

Page 7: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

BS prevention mechanisms

ZSD and ZSC prevent BS from the data field and the CRC, respectively

Zero Stuff-bits Data (ZSD)I Fixed-length payload encoding: 8B9B23

I Variable-length payload encoding: VHCC

Zero Stuff-bits CRC (ZSC)ZSD and ZSC are compatible with each other

2G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Fixed-Length Payload Encodingfor Low-Jitter Controller Area Network Communication”. IEEE Trans. Ind. Inf.

3G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Un codec a basso jitter per retiCAN”. Automazione e strumentazione.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 7 / 23

Page 8: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

8B9B

Every byte of the original payload is translated into a distinct 9-bitcodeword.

Codebook property 1)I ≤ 4 consecutive bits at the same value within the 9-bit codewordI ≤ 2 consecutive bits at the same value at the beginning & end

Padding is needed at the end of the data fieldAchieve better encoding efficiency than existing approaches.

ID(11 bit)SOF ID + RTR

(11 +1 bit)DATA

(0 ... 8 Byte)CRC

(15 bit) CDEL ACK

ADEL EOF

(7 bit)

Header Data field CRC Trailer

C1 (9 bit)

BB (1 bit)

C2 (9 bit)

… Cn (9 bit)

PAD (≤ 6 bit)

res + DLC(2 + 4 bit)

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 8 / 23

Page 9: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

VHCC4

ID(11 bit)SOF ID + RTR

(11 +1 bit)DATA

(0 ... 8 Byte)CRC

(15 bit) CDEL ACK

ADEL EOF

(7 bit)

Header Data field CRC Trailer

C1 (9 bit)

BB (1 bit)

C2 (9 bit)

… Cn (9 bit)

PAD (≤ 6 bit)

res + DLC(2 + 4 bit)

Instead of padding, pack sub-byte application information

Codebook property 2)I Nested codebooks: 8B9B codebook can also be used for any N bit

to N+1 bit encoding, N ∈ [1, 8].I Nested codebooks still preserve property 1)

4G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “On a family of run length limited,block decodable codes to prevent payload-induced jitter in Controller Area Networks”. ComputerStandards & Interfaces.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 9 / 23

Page 10: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Zero Stuff-bits CRC (ZSC)

Instead of padding, use it to prevent BS in the CRC.

Exploiting only 3 bits at the end of the data field, it is alwayspossible to tune the CRC calculation to a value that is BS freeindependent from the payload content and the encoding scheme.ZSD + ZSC leads to deterministic communication5:

50

60

70

80

90

100

110

120

16 24 32 40 48 56 64

Tota

l fra

me

trans

mis

sion

tim

e (b

it)

Data Field Size nD (bit)

Minimum Maximum

5G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “A Mechanism to Prevent StuffBits in CAN for Achieving Jitterless Communication”. IEEE Trans. Ind. Inf.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 10 / 23

Page 11: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Main achievements

Theoretical/experimental results show that 8B9B and VHCCachieve better computational and communication efficiency6

Highly optimized and portable codec was developed fordissimilar embedded platforms.Residual error probability decreases by about two orders ofmagnitude7

ZSC: an Italian patent8 application was submitted anda European extension is in progress

6G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Performance Comparison ofMechanisms to Reduce Bit Stuffing Jitters in Controller Area Networks”. Proc. IEEE ETFA.

7G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Effect of jitter-reducingencoders on CAN error detection mechanisms”. Proc. IEEE WFCS.

8G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Limitazione del bit stuffing inuna trama di comunicazione di un segnale elettronico”. Italian patent application.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 11 / 23

Page 12: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Flexible communication

Application-level protocols for CAN are mainly automotive oriented.

SAE J1939 and ISO 11783 for communication/diagnostics amongin-vehicle components.CANopen and DeviceNet for industrial automationARINC 825 for local subsystem communication in civil aviation

Extend the flexibility of CAN by broadening the set of high-levelprotocols supported on it

General-purpose protocol (IP)Special purpose protocol (Modbus)

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 12 / 23

Page 13: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

General-purpose protocol support

Internet Protocol (IP): the most widespread protocol, enormoussoftware available

Real time

Intranet R

N1

ETH

C1

ETH

C2

CAN

IP-basedprotocol

N2

ETH

Goal:Integrate CAN (at the fieldlevel) into IntranetSupport non real-timeactivities like remoteconfiguration, firmwareupdate ...

Existing approaches:Protocol translation

IP over CAN: permits IP datagrams to be transmitted on CAN

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 13 / 23

Page 14: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

IP over CAN9

When integrating different subsystems, coexistence among them isalways the main concern

Interference to real-time performance (due to IP traffic):I IP messages can be modeled as real-time messages with the

lowest priorityI Worst-case jitter is bounded.

Non real-time performance is comparable to what can be achievedon a pure CAN link (in absence of RT traffic):

d (B) 1 4 16 64 256 1024

rC→C (kB/s) 0.78 2.91 8.90 18.02 24.76 26.08rC→E (kB/s) 0.65 2.49 7.97 17.80 24.07 26.43rE→C (kB/s) 25.18 26.12 26.36 26.50 26.46 26.44

Table : Mean data transfer rate r for 10 MB data vs data chunk size d .

9G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Seamless Integration of CAN inIntranets”. Computer Standards & Interfaces.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 14 / 23

Page 15: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Special purpose protocol support

ModbusAn application-level real-time communication protocol, which is

commonly used in building automation.

Existing support for Modbus:I RS485: obsolete, extremely slow (19200 bps)I Ethernet: popular, extra cabling and intermediate devices

CAN is a good compromise in terms of both link speed (1 Mb/s)and cost (bus architecture)Modbus CAN: enables Modbus traffic to be transmitted on theCAN bus

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 15 / 23

Page 16: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Modbus CAN10

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

11000

0 20 40 60 80 100 120 140

Ro

un

d-t

rip

tim

e R

TT

wm

r (µ

s)

Number of registers n

CAN, 500 kbpsCAN, 1 Mbps

TCPModbus CAN (mean RTT andjitter) outperforms ModbusTCP on a 100 Mb/s Ethernet,with a 1 Mb/s CAN bus.Break-even point (for meanRTT) at n ' 80 . . .100 registerswhen using a 500 kb/s CANbus.

A compromise between link speed and software processing overhead

10G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano. “Design, verification, and performanceof a MODBUS-CAN adaptation layer”. Proc. IEEE WFCS.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 16 / 23

Page 17: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

Conclusion

Research work was carried out focusing on the determinism andflexibility of CAN communicationBS jitter is completely prevented all over the frame by ZSD + ZSCThe application scenario of CAN was largely broadened by thedesign and implementation of IP over CAN and Modbus CANModbus CAN is adopted by industry for local subsystemcommunication and it paves the way of CAN in buildingautomation.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 17 / 23

Page 18: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

List of Publications (1/5)

2014[1] I. Cibrario Bertolotti and T. Hu,

Modular Design of an Open-Source, Networked Embedded System,Computer Standards & Interfaces, vol. 37, pp. 41–52, Jan. 2015. Available online sinceJune 2014.

[2] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,A Mechanism to Prevent Stuff Bits in CAN for Achieving Jitterless Communication,IEEE Transactions on Industrial Informatics, vol. 11, no. 1, pp. 83-93, Feb. 2015.Available online since Nov. 2014.

[3] T. Hu and I. Cibrario Bertolotti,Model Checking,in Cary R. Spitzer, Thomas Ferrell, and Uma Ferrell (eds.), Digital Avionics Handbook,3rd edition, ISBN 9781439868614. CRC Press, Taylor and Francis, USA,chap. 42, pp. 42.1-42.20, 2014.

[4] A. Ballarino et al.,System-Level Performance of an Automation Solution Based on Industry Standards,Proc. 19th IEEE Conference on Emerging Technologies and Factory Automation (ETFA),pp. 1–6, Sep. 2014.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 18 / 23

Page 19: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

List of Publications (2/5)

[5] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,Effect of Jitter-Reducing Encoders on CAN Error Detection Mechanisms,Proc. 10th IEEE International Workshop on Factory Communication Systems (WFCS),pp. 1–10, May 2014.

[6] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,Design, Verification, and Performance of a Modbus–CAN Adaptation Layer,Proc. 10th IEEE International Workshop on Factory Communication Systems (WFCS),pp. 1–10, May 2014.

[7] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,Un codec a basso jitter per reti CAN,Automazione & strumentazione, vol. 62, no. 3, pp. 76–79, Apr. 2014.

[8] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,Limitazione del bit stuffing in una trama di comunicazione di un segnale elettronico,Italian patent application no. TO2014A000132, Feb. 2014. European extension in progress.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 19 / 23

Page 20: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

List of Publications (3/5)

2013[9] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,

Fixed-Length Payload Encoding for Low-Jitter Controller Area Network Communication,IEEE Transactions on Industrial Informatics, vol. 9, no. 4, pp. 2155–2164, Nov. 2013.

[10] I. Cibrario Bertolotti, L. Durante, T. Hu, and A. Valenzano,A Model for the Analysis of Security Policies in Industrial Networks,Proc. 1st International Symposium for Industrial Control System & SCADA Cyber SecurityResearch, pp. 66–77, Sep. 2013.

[11] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,Software-Based Assessment of the Synchronization and Error Handling Behavior of a RealCAN Controller,Proc. 18th IEEE Conference on Emerging Technologies and Factory Automation (ETFA),pp. 1–9, Sep. 2013.

[12] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,On a Family of Run Length Limited, Block Decodable Codes to Prevent Payload-InducedJitter in Controller Area Networks,Computer Standards & Interfaces, vol. 35, no. 5, pp. 536–548, Sep. 2013.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 20 / 23

Page 21: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

List of Publications (4/5)

2012[13] I. Cibrario Bertolotti, L. Durante, T. Hu, and A. Valenzano,

A Unified Class Model for Checking Security Policies in ICT Infrastructures,Proc. 1st IEEE AESS European Conference on Satellite Telecommunications (ESTEL),pp. 1–6, Oct. 2012.

[14] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,Performance evaluation and improvement of the CPU–CAN controller interface for low-jittercommunication,Proc. 17th IEEE Conference on Emerging Technologies and Factory Automation (ETFA),pp. 1–8, Sep. 2012.

[15] G. Cena, I. Cibrario Bertolotti, T. Hu, and A. Valenzano,Performance comparison of mechanisms to reduce bit stuffing jitters in controller areanetworks,Proc. 17th IEEE Conference on Emerging Technologies and Factory Automation (ETFA),pp. 1–8, Sep. 2012.

[16] G. Cena, I. Cibrario Bertolotti, and T. Hu,Formal Verification of a Distributed Master Election Protocol,Proc. 9th IEEE International Workshop on Factory Communication Systems (WFCS),pp. 245–254, May 2012.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 21 / 23

Page 22: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

List of Publications (5/5)

2011[17] I. Cibrario Bertolotti and T. Hu,

Analisi di una pila protocollare open source per sistemi in tempo reale a basso costo,Atti Congresso Nazionale AICA, pp. 1–10, Nov. 2011.

[18] I. Cibrario Bertolotti and T. Hu,Real-Time Performance of an Open-Source Protocol Stack for Low-Cost, EmbeddedSystems,Proc. 16th IEEE Conference on Emerging Technologies and Factory Automation (ETFA),pp. 1–8, Sep. 2011.

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 22 / 23

Page 23: Deterministic and Flexible Communication for Real-Time ... HU_presentation.pdf · It is the de facto standard in automotive and gained popularity in ... CANopen and DeviceNet for

THANK YOU FOR YOUR ATTENTION

Tingting Hu (DAUIN) Deterministic and Flexible Communication 2015/02/27 23 / 23