Download presentation
Presentation is loading. Please wait.
1
Controller Area Network (CAN Bus)
And MilCAN
2
Origins / background of CAN Architecture , Layers and mapping to OSI
Overview Origins / background of CAN Architecture , Layers and mapping to OSI CAN protocol, and Framing Multi-master and arbitration MilCAN overview Deterministic vs Non deterministic networks Network Technology Richard Anthony The University of Greenwich
3
Controller Area Network (CAN) - Origins / background
Developed by Robert Bosch GmbH, specifically for Automotive control systems (now also used in e.g. industrial automation and medical equipment). CAN was designed to enable vehicle components such as engine management, power-train, brakes, steering, lights and indicators, climate control, security systems etc. to be interconnected by a network bus – enabling the Electronic Control Units (ECU) to communicate with each other. The CAN 1.2 protocol was released in 1986 ( ‘Standard’). CAN controller chips, produced by Intel and Philips, introduced in 1987. The CAN 2.0 specification was published in 1991 ( ‘Extended’). CAN has some specific features: It is fault-tolerant It allows message prioritisation It operates in multicast manner It uses message-filtering in place of traditional addressing It uses very short messages which are well-suited to sensing and control applications but not suited to data-intensive applications. Network Technology Richard Anthony The University of Greenwich
4
CAN bus concept – automotive example
The CAN network connects the various subsystems in a larger system. The subsystems are usually embedded microcontrollers with specific sensing / control applications In a CAN network there is no requirement to have a central, or coordinating computer. Network Technology Richard Anthony The University of Greenwich
5
CAN is a non-deterministic (see later) serial communication system.
CAN basic details CAN is a non-deterministic (see later) serial communication system. CAN networks have a bus configuration. CAN operates with bitrates up to 1Mbit/S (bus length below 40 meters), Longer network distances can be achieved at lower bit rates (e.g., 500 m at 125 kbit/s). The CAN data link layer protocol is standardized in ISO (2003). describes mainly the data link layer (LLC sublayer and MAC sublayer) and some aspects of the physical layer of the OSI reference model. The other protocol layers are selected by the network designer. There are two CAN modes of operation: Standard – uses 11-bit Identifier Extended – uses 29-bit Identifier CAN is a three-layer technology - {Object, Transfer, Physical} layers. Network Technology Richard Anthony The University of Greenwich
6
CAN Architecture CAN’s three layers are equivalent to the Physical and Data-Link layers of the OSI model. The Application layer sits above the CAN Object layer. The Application layer can be hardware and software that comprise a specific component (usually an embedded system) within the wider network. The main role of the CAN Object layer is message filtering which determines which messages are passed up to the Application layer and which messages are ignored. The CAN Transfer layer is the core of the CAN protocol. It performs MAC functions such as message framing, conflict detection and arbitration, and error detection. The CAN Physical layer is not defined as part of the CAN protocol specification – this allows the transmission medium and signal levels to be optimised for particular implementations. Network Technology Richard Anthony The University of Greenwich
7
CAN mapped onto ISO OSI 7-layer model
CAN Object layer Message filtering Message and status handling Logical Link Control (LLC) Sub-Layer OSI Data Link Layer CAN Transfer layer Fault confinement Error detection and signalling Message validation Acknowledgement Arbitration Message Framing Transfer rate and timing Media Access Control (MAC) Sub-Layer CAN Physical layer Signal level and bit representation Transmission medium OSI Physical Layer Network Technology Richard Anthony The University of Greenwich
8
Frame Types and Fields and Spacing - Overview
Frames contain an Identifier Data Frame – Carries data from a transmitter to a receiver. Remote Frame – transmitted to request a Data Frame The remote Frame and subsequent Data Frame contain the same Identifier. Error Frame – Transmitted by any unit on detecting a bus error. Overload Frame – Provides an extra spacing between preceding and succeeding Data Frames or Remote Frames. Data Frames and Remote Frames are separated from preceding frames by an Interframe Space. Network Technology Richard Anthony The University of Greenwich
9
The CAN protocol Information is sent in the form of a number of different formats (Frames). When the bus is detected to be free, any connected unit can start to transmit a message. The sender must monitor the bus whilst it sends, one bit at a time – error detection due to a conflict is immediate, based on a single bit difference between what is transmitted and what is heard on the bus. The detection of conflicts only occurs during the ‘arbitration field’. A node that looses arbitration (see later) stops transmitting, the winner continues to transmit its message. The message is NOT corrupted during a bus conflict. Network Technology Richard Anthony The University of Greenwich
10
The CAN protocol – Bit Timing and propagation on the bus
The CAN bus operates at up to 1Mbit/S at bus lengths of up to 40 meters. Key timing requirement: A single bit must propagate the entire length of the bus in less than a single bit time, to ensure that a single bit difference is detected by any transmitting node, within the duration of the transmission of that bit. Propagation speed of a signal in the bus is 2 * meters per second. Time required to propagate 1 meter is 1 / (2 *108) S = *10-8 S Time required to propagate 40 meters is 40 * 0.5 *10-8 S = 20 *10-8 S = 2 * 10-7 S One bit-time is 1/1,000,000 S = 1 * 10-6 S ( = 10 * 10-7 S) → The signal propagation time is equivalent to 1/5 of a bit-time (given from 10 * 10-7 S / 2 * 10-7 S = 5) Network Technology Richard Anthony The University of Greenwich
11
CAN does not use station addresses to route information
Information Routing CAN does not use station addresses to route information All messages are sent in a Multicast manner: The content of a message is named by an Identifier. This is a means of describing the type or meaning of the data. It does not indicate the destination of the message. A message is sent, using its Identifier as a means of filtering at receiving nodes. Only nodes interested in the Identifier act upon the message. Effectively this is a publish-subscribe network → Nodes can be added to the system without changing the existing configuration of software or hardware. Network Technology Richard Anthony The University of Greenwich
12
Transmission scheme (1)
The CAN bus is a single bi-directional channel. It can be configured in either a Wired-AND configuration or a Wired-OR configuration. Wired-AND The bus is pulled high (1) by a pull up resistor – the quiescent state. Each station uses an open-collector transistor gate to drive the bus low (0). A station leaves its transistor off to transmit a ‘1’ – i.e. No drive is needed. Thus a ‘0’ is dominant over a ‘1’. When no station transmits a ‘0’ the bus is at a ‘1’ state. Truth table Station Bus value 2 Gnd (0V) Pull-up resistor Tx Rx +Vcc Data bus Bus unit 1 Bus unit n Network Technology Richard Anthony The University of Greenwich
13
Transmission scheme (2)
Wired-OR The bus is pulled low (0) by a pull down resistor – the quiescent state. Each station uses an open-collector transistor gate to drive the bus high (1). A station leaves its transistor off to transmit a ‘0’ – i.e. No drive is needed. Thus a ‘1’ is dominant over a ‘0’. When no station transmits a ‘1’ the bus is at a ‘0’ state. dominant vs recessive bits Wired-AND Wired-OR When a bus is driven the bit is dominant When a bus floats (not driven), the bit is recessive Truth table Station Bus value 2 Gnd (0V) Pull-down resistor Tx Rx +Vcc Data bus Bus unit 1 Bus unit n Network Technology Richard Anthony The University of Greenwich
14
SOF Identifier RTR IDE r0 DLC Data CRC ACK
CAN DATA Frame format Standard Mode Extended Mode SOF Identifier RTR IDE r0 DLC Data CRC ACK d bits d bits 0–8 bytes Arbitration field Control field Arbitration field Control field SOF Identifier SRR IDE Identifier RTR r1 r0 DLC Data CRC ACK d bits r r bits bits 0–8 bytes Key: SOF = Start Of Frame, always ‘d’ RTR = Remote Transmission Request, ‘d’ in DATA frame, ‘r’ in REMOTE frame IDE = IDentifier Extension, ‘d’ in Standard frame, ‘r’ in Extended frame DLC = Data Length Code r0, r1 = Reserved bits SRR = Substitute Remote Request (always ‘r’ to ensure that a Standard frame wins arbitration) Network Technology Richard Anthony The University of Greenwich
15
Message filter accepts
Message sequences - Scenario 1 Bus unit 1 sends a message “Engine Temperature” Identifier Value (2 bytes of data). A DATA frame message is sent by bus unit 1. Other bus units perform Message filtering based on the identifier. Bus units 3 and 4 are interested in this message. Application layer Object layer Transfer layer Physical layer Bus unit 1 Sends data frame Bus unit 2 Message filter blocks Data Frame Bus unit 3 Message filter accepts Bus unit 4 Network Technology Richard Anthony The University of Greenwich
16
Message filter accepts
Message sequences - Scenario 2 Bus unit 4 requests the value of “Throttle Position” Identifier A Remote frame message is sent. Bus unit 2 has the required data value – sends a DATA frame Other bus units perform Message filtering based on the identifier. Bus units 3 and 4 are interested in this message. Application layer Object layer Transfer layer Physical layer Bus unit 1 Message filter blocks Data Frame Bus unit 4 Requests data Remote Frame Bus unit 2 Responds with Data Bus unit 3 Message filter accepts Network Technology Richard Anthony The University of Greenwich
17
Message sequences - Scenario 3
Bus unit 1 sends a message “Engine RPM”, Identifier , DATA frame sent. At the same time Bus unit 4 sends a message “Oil pressure”, Identifier , DATA frame sent. An access conflict occurs – arbitration is performed using the Identifier. In Wired-AND configuration, the lowest Identifier has the highest priority (i.e. Oil Pressure reading is more important than Engine speed value) Bus unit 4 wins the arbitration in this case, Bus unit 2 is interested in the message. Bus unit 2 Responds with Data Bus unit 3 Message filter accepts Application layer Object layer Transfer layer Physical layer Bus unit 1 Message filter blocks Data Frame (Lowest Identifier) Wins arbitration – transmission succeeds Bus unit 4 Requests data Data Frame (Highest Identifier) Looses arbitration – transmission stopped Network Technology Richard Anthony The University of Greenwich
18
The arbitration scheme ensures:
Bus Arbitration (1) The CAN bus is designed such that any bus unit can take control of the bus (i.e. Transmit) at any time that the bus is free (Idle). The multi-bus-master approach is implemented as a contention scheme in which a bus unit listens to the bus before transmitting and only transmits when the bus is determined to be Idle (similar to CSMA/CD as used in Ethernet). The transmitting node listens while transmitting, on a bit-by-bit basis and can thus detect any bit-errors that occur during the transmission of its message. The arbitration scheme ensures: No data is lost – in the highest priority message, No time is lost – the highest priority message is transmitted with the same timing regardless of conflict. Network Technology Richard Anthony The University of Greenwich
19
Bus Arbitration (2) - Arbitration in operation (two Data Frames)
Arbitration is based on the dominant (d) vs recessive (r) bit values in the Identifier For Wired-AND d = 0 (drives the bus low - strong) r = 1 (passive, allows the pull-up resistor to pull the bus high – weak) Consider the messages: “Engine RPM”, Identifier = dddrdddrddd and “Oil pressure”, Identifier = ddddddrrrdd Assume both messages are sent as Data Frames, and that Standard Mode CAN is used Message SOF 11-bit Identifier RTR IDE ... Engine RPM d d d d r d d d r d d d d d ... Oil pressure d d d d d d d r r r d d d d ... Resultant d d d d d d d r r r d d d d ... Bit values MSB transmitted first Remaining bits NOT transmitted Transmission direction Arbitration lost Arbitration field Network Technology Richard Anthony The University of Greenwich
20
Bus Arbitration (3) - operation (Data Frame and Remote Frame)
One bus unit sends a Data Frame “Engine RPM” whilst at the same time another bus unit sends a Remote Frame requesting the same data. “Engine RPM”, Identifier = dddrdddrddd (for Wired-AND) Message SOF 11-bit Identifier RTR IDE ... Data Frame d d d d r d d d r d d d d d ... Remote Frame d d d d r d d d r d d d r d ... Resultant d d d d r d d d r d d d d d ... Bit values dominant for data Frame recessive for Remote Frame Standard Mode CAN MSB transmitted first Transmission direction Remaining bits NOT transmitted Arbitration field Arbitration lost Network Technology Richard Anthony The University of Greenwich
21
Power saving – CAN node’s Sleep mode
A CAN bus unit can be put into sleep mode to reduce power consumption – for example when the functionality managed by the unit is not needed. In this mode the device has no internal activity and its bus driver is disabled. Sleeping units are woken up by any bus activity or by internal conditions of the unit (e.g. A timer expires). When one unit needs to wake-up another unit that is required to re-join communication activities, it uses a special wake up message with a special dedicated Identifier, rrr rrrd rrrr , this is the lowest priority identifier. For wired-AND the pattern is Network Technology Richard Anthony The University of Greenwich
22
MilCAN
23
Deterministic means predictable in terms of:
Overview of MilCAN MilCAN is a Deterministic protocol that can be applied to Controller Area Network (CAN) technology (a Higher Layer Protocol that can be applied above CAN). Deterministic means predictable in terms of: access to media without conflict (ability to transmit) timing (transmit at known intervals or slots) transmission success rate MilCAN is specified by ISO MilCAN was originally developed for use in military vehicles to provide deterministic (predictable ) communications between a range of real-time and high importance (safety-critical, mission critical) applications. MilCAN is available for use beyond Military applications – it can be applied wherever deterministic data transfer is required. Network Technology Richard Anthony The University of Greenwich
24
(synchronisation slots are numbered 0 to 1023, then start again at 0).
MilCAN Operation In MilCAN, the Bus-time is divided into 1024 fixed position sync slots. (synchronisation slots are numbered 0 to 1023, then start again at 0). A periodic Sync frame is used to inform all nodes of the current sync slot number. Making it Deterministic Nodes access the bus and transmit messages according to a pre-defined message schedule which is based on the 1024 sync slot cycle. The total number of messages that may be transmitted in each slot can be calculated and a schedule created that bounds the latency of each message, so: * no conflicts occur, * all messages are transmitted successfully, and at predictable times. Network Technology Richard Anthony The University of Greenwich
25
ECU / Embedded control systems
Message Allocated Sync Slot Engine temperature 1 Oil Pressure 3 Oil Temperature 4 MilCAN node Sensors / actuators ECU / Embedded control systems T Bus with terminators Engine temperature Oil Pressure Oil Temperature Example scenario – Engine management Slot Possible message transmission sequence on the bus Possible message slot allocations Network Technology Richard Anthony The University of Greenwich
26
MilCAN robustness A specific node (sync frame master node) is responsible for sending the Sync Frames, and thus synchronising the whole network. A Sync Frame Arbitration protocol is used during network start-up to automatically select the sync frame master node. During network operation, if any node detects that absence of Sync Frames, the Sync Frame Arbitration protocol is used to automatically elect a new sync frame master node. No more than one message (identified by a unique message ID) is transmitted in any particular slot. Transient bus-fault conditions could temporarily cause violation of this – e.g. An electrical fault. Network Technology Richard Anthony The University of Greenwich
27
MilCAN A uses 29 bit Identifiers Applied on top of extended mode CAN.
MilCAN variants MilCAN A uses 29 bit Identifiers Applied on top of extended mode CAN. Both periodic and event driven data can be transmitted via the bus. Supports 1Mbit and 250Kbit Baud rates. MilCAN B uses 11 bit Identifiers. Applied on top of standard mode CAN. Allows only periodic data to be transmitted via the bus. Supports a range of data rates from 10 kbps to 1 Mbps. Network Technology Richard Anthony The University of Greenwich
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.