CONTROLLER AREA

NETWORK (CAN)
15.12.2016
CRISTIAN DABU

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 1
WHAT CAN YOU EXPECT FROM THIS SEMINAR

Learn about bus network topology
Learn about communication logic on the bus
Know about CAN Frame format
Know about error detection/handling
Know about Bus Synchronization

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 2
LEARNING OBJECTIVES

1. CAN Introduction
2. CAN Communication
3. CAN Framing
4. CAN Errors
5. CAN Bus Synchronization

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 3
1. CAN Introduction
CONTENTS

1. CAN Introduction

1.1.How it all began…
1.2. CAN benefits
1.3.Standardization

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 4
1. CAN Introduction
1.1. HOW IT ALL BEGAN…

The development of CAN began when more and more electronic
devices were implemented into modern motor vehicles.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 5
1. CAN Introduction
1.1. HOW IT ALL BEGAN…

To improve the behavior of the vehicle even further, it was necessary for the different control
systems (and their sensors) to exchange information. This was usually done by discrete
interconnection of the different systems (i.e. point to point wiring).

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 6
1. CAN Introduction
1.1. HOW IT ALL BEGAN…

The solution to this problem was the connection of the control systems via a serial bus
system. This bus had to fulfill some special requirements due to its usage in a vehicle.

With the use of CAN, point-to-
point wiring is replaced by one serial
bus connecting all control systems.
This is accomplished by adding some
CAN-specific hardware to each
control unit that provides the "rules"
or the protocol for transmitting and
receiving information via the bus.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 7
1. CAN Introduction
1.1. HOW IT ALL BEGAN…

- Development of the CAN bus started in
1983 at Robert Bosch GmbH

- The protocol was officially released in
1986 at the Society of Automotive
Engineers (SAE) conference in Detroit,
Michigan

- CAN 2.0 published in 1991.
- CAN device that uses 11-bit
identifiers is commonly called CAN
2.0A
- CAN device that uses 29-bit
identifiers is commonly called CAN
2.0B.

- In 2012 Bosch released CAN FD 1.0 or
©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 8
1. CAN Introduction
1. 2. CAN BENEFITS

 CAN is low cost
• Fast serial bus with two wires: good price/performance ratio
• Low cost protocol devices (controllers, transceivers) available mainly driven by high
volume production in the automotive market

 CAN is reliable
• Sophisticated error detection and error handling mechanisms results in high reliability
transmission
• Example: 500 kbit/s, 25% bus load, 2000 hours per year: one undetected error every
1000 years
• Erroneous messages are detected and repeated
• System-wide data consistency (every bus node is informed about an error)
• Faulty nodes automatically withdraw from bus communication
• High immunity to Electromagnetic Interference

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 9
1. CAN Introduction
1. 2. CAN BENEFITS

 CAN means real-time
• maximum data rate is 1 MBit/s @ 40m bus length (still about 40 kBit/s @ 1000m bus
length)
• Short message length (0 to 8 data bytes / message) (Larger data can be split up into
several messages)
• Low latency between transmission request and actual start of transmission
• Bus access handled via CSMA/CA w/ AMP method (message with the highest priority
wins arbitration without losing any time)
 CAN is flexible
• CAN allows Multi-Master Operation (every CAN node is able
to access the bus individually)
• CAN Nodes can easily be connected / disconnected (i.e. plug
& play)
• Number of nodes not limited by the protocol

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 10
1. CAN Introduction
1. 2. CAN BENEFITS

 CAN means Multicast / Broadcast Capability
• CAN is not node-oriented but message-oriented
• Message identifier specifies contents & priority of the message
• Messages can be easily sent to multiple / all nodes simultaneously
• All nodes simultaneously receive and work on common data

 CAN is standardized
• ISO-11898

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 11
1. CAN Introduction
1.3. STANDARDIZATION

 ISO 11898-1 which covers the
data link layer
 ISO 11898-2 which covers the
CAN physical layer for high-
speed CAN (CAN C up to 1 Mbit/s)
 ISO 11898-3 was released later
and covers the CAN physical
layer for low-speed, fault-
tolerant CAN (CAN B up to 125 kbit/s)
 ISO 11898-4 (an extension of the Data
Link Layer that adds a time triggered
communication option for CAN-based
networks)
 ISO 11898-5 (new functionality for
systems requiring low-power consumption
features while there is no active bus
communication.)
 ISO 11898-6 (specifying a selective
©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED
wake-up mechanism using configurable CAN 12
2. CAN Communication
CONTENTS

2. CAN Communication

2.1.CAN Network
2.2. CAN Node
2.3.CAN Bus
2.4. CAN Communication Principle and Bus
Access

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 13
2. CAN Communication
2.1. CAN NETWORK

A CAN network consists of
a number of CAN nodes
which are linked via a physical
transmission medium (CAN
bus) In practice, the CAN
network is usually based on a
line topology with a linear
bus to which a number of
electronic control units are
each connected via a CAN
interface
High Speed CAN Network. ISO
11898-2

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 14
2. CAN Communication
2.1. CAN NETWORK

• An unshielded twisted
two-wire line is the physical
transmission medium used
most frequently in
applications (Unshielded
Twisted Pair — UTP), over
which symmetrical signal
transmission occurs.

• Typically, UTPs have wire
cross-sections between
0.34 mm2 and 0,6 mm2.

• High Speed CAN Network. ISO
Line resistance should be
11898-2
less than 60 mΩ.
©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 15
2. CAN Communication
2.1. CAN NETWORK

• The maximum data
rate is 1 Mbit/s.

• A maximum network
extension of about 40
meters is allowed.

• At the ends of the CAN
network, bus termination
resistors contribute to
preventing transient
phenomena (reflections).
High Speed CAN Network. ISO
11898-2

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 16
2. CAN Communication
2.1. CAN NETWORK

• ISO 11898-3, also
called low speed or fault
tolerant CAN, uses a linear
bus, star bus or multiple
star buses connected by a
linear bus and is
terminated at each node by
a fraction of the overall
termination resistance. The
overall termination
resistance should be about
100 Ω, but not less than
100 Ω.

• Fault tolerant CAN is often
used where groups of
©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 17
2. CAN Communication
2.2. CAN NODE

• Host - the microcomputer
integrated in the control
unit/device

• The CAN controller fulfills
communication functions
prescribed by the CAN
protocol, which relieves the
host considerably.

• The CAN transceiver
connects the CAN controller
to the physical transmission CAN Controller is not
medium. integrated

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 18
2. CAN Communication
2.2. CAN NODE

• CAN Controller receives the transfer
data from the microcomputer integrated
in the control unit/device (also known as
CAN Node). The CAN controller processes
this data and relays it to the CAN
transceiver. Also, the CAN controller
receives data from the CAN transceiver,
processes it and relays it to the
microcomputer integrated in the control
unit/device.

• CAN Transceiver is a transmitter and
receiver in one. It converts the data
which the CAN controller supplies into
electrical signals and sends this data
over the data bus lines. Also, it receives
data and converts this data for the CAN
controller.
©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 19
2. CAN Communication
2.3. CAN BUS

• Physical signal transmission in a
CAN network is based on
transmission of differential
voltages (differential signal
transmission).

• This effectively eliminates the
negative effects of interference
voltages

• Consequently, the transmission
medium (CAN bus) consists of
two lines: CAN high line
(CANH) and CAN low line
(CANL).

• Terminating the ends of the
communication channel using
termination resistors prevents
reflections
©2016 in a INDUSTRIES,
HARMAN INTERNATIONAL high-speed CAN
INCORPORATED 20
2. CAN Communication
2.3. CAN BUS

• ISO 11898-2 assigns logical “1” to a • ISO 11898-3 assigns a typical
typical differential voltage of 0 Volt. differential voltage of 5 Volt to logical
• The logical “0” is assigned with a “1”, and a typical differential voltage of
typical differential voltage of 2 Volt. 2 Volt corresponds to logical “0”.
High-speed CAN transceivers interpret a
differential voltage of more than
©20160.9 Volt as a dominant
HARMAN INTERNATIONAL level
INDUSTRIES, INCORPORATED 21
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
CAN Communication Principle

Safety-critical applications, such as those in the powertrain area, place severe demands on a communication system’s
availability. So it would be disadvantageous to assign responsibility for bus distribution to just a single bus node. Failure of this
vulnerable bus node would cause all communication to fail.
A much more elegant solution is to decentralize bus access, so that each bus node has the right to access the bus.

That is why a CAN network is based on a combination of multi-master architecture and line topology: essentially each CAN
node is authorized to place CAN messages on the bus in a CAN network. The transmission of CAN messages does not follow any
predetermined time sequence, rather it is event-driven.

The communication channel is only busy if new information actually needs to be transmitted, and this allows for very quick bus
accesses. In principle, real-time data transmissions on the magnitude of milliseconds are no problem in a CAN network, because
of the ability to quickly react to asynchronous events and very high data rates up to 1 MBit/s.

A method of receiver-selective addressing is used in a CAN network to prevent dependencies between bus nodes and thereby
increase configuration flexibility: Every CAN message is available for every CAN node to receive (broadcasting). A prerequisite
is that it must be possible to recognize each CAN message by a message identifier (ID) and node-specific filtering. Although this
increases overhead, it allows integration of additional CAN nodes without requiring modification of the CAN network.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 22
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 23
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS

Typical CAN
Communication

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 24
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
Principle of Bus Access in the CAN Network

ISO 11898-1 defines a multi- To preserve the In case of simultaneous bus
master architecture to assure high communication system’s real- access, the CSMA/CA method
availability and event-driven data time capability, ISO 11898-1 based on bitwise bus
transmission. Each node in the CAN
network has the right to access the
provides for a bus access that arbitration ensures that the
CAN bus without requiring guarantees nondestructive highest priority CAN message
permission and without prior data transport. The so-called among the CAN nodes
coordination with other CAN nodes. CSMA/CA (Carrier Sense prevails. In principle, the
Although bus access based on an Multiple Access with Collision higher the priority of a CAN
event-driven approach enables
very quick reactions to events, there
Avoidance) method is used message the sooner it can be
is the inherent risk that several CAN here. The CSMA/CA method transmitted on the CAN bus. In
nodes might want to access the CAN ensures that CAN nodes case of poor system design,
bus at the same time, which would wishing to send do not access low priority CAN messages
lead to undesirable overlaps of data the CAN bus until it is even run the risk of never
on the CAN bus.
available. being transmitted.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 25
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
Principle of Bus
Access in the CAN
Network

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 26
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS

• There are two bus states, called
"dominant" and "recessive".

• The bus logic uses an wired- AND
bus logic mechanism, that is,
"dominant bits" (equivalent to the logic
level "Zero") overwrite the "recessive"
bits (equivalent to the logic level
"One" ).

• Only if all nodes transmit recessive bits
(ones), the Bus is in the recessive state.

• As soon as one node transmits a
dominant bit (zero), the bus is in the
dominant state.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 27
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
CAN Bus Access
Logic
After network-wide
synchronization, all CAN nodes
wishing to send place their
identifier of the CAN message
bitwise onto the CAN bus, from
most significant to least
significant bit. In this process, the
wired-AND bus logic upon
which the CAN network is based
ensures that a clear and distinct
bus level results on the bus.

Finally, the arbitration logic
decides whether a CAN node may
continue to send, or whether it
must stop sending. The
interactive figure “Bus Access
Logic” helps you to become more
familiar with the mechanisms
underlying bitwise bus arbitration.
©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 28
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
Bus Access
Procedure

At the end of the arbitration
phase, the CAN node transmitting
the CAN message with the lowest
ID gets authorization to send.
CAN nodes with lower priority
messages switch to the receiving
state, later they access the CAN
bus for another sending attempt
as soon as it is available again.
The figure “Bus Access Procedure”
depicts all actions of a CAN node
in the context of bus access.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 29
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
Bitwise Bus
Arbitration

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 30
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
Exercise

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 31
2. CAN Communication
2.4. CAN COMMUNICATION PRINCIPLE AND BUS
ACCESS
Exercise

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 32
3. CAN FRAMING
CONTENTS

3. CAN Framing

3.1. Data Frame
3.2.Remote Frame
3.3. Bit Stuffing
3.4. Error Frame
3.5. Overload Frame
3.6. Interframe Space

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 33
3. CAN FRAMING
3.1. DATA FRAME

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 34
3. CAN FRAMING
3.1. DATA FRAME

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 35
3. CAN FRAMING
3.1. DATA FRAME

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 36
3. CAN FRAMING
3.1. DATA FRAME

With the Acknowledge
Positive Acknowledge

Check the transmitter
checks in the
Acknowledge Field of a
message to determine if
the Acknowledge Slot,
which is sent out as a
recessive bit, contains a
dominant bit.

If this is the case, at
least one other node,
has received the frame
correctly.

If not, an
Acknowledge Error has
occurred and the
message has to be
repeated. No Error
Frame is generated,
©2016 HARMANthough
INTERNATIONAL INDUSTRIES, INCORPORATED 37
3. CAN FRAMING
3.2. REMOTE FRAME

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 38
3. CAN FRAMING
3.2. REMOTE FRAME

Generally data transmission is
performed on an autonomous basis
with the data source node (e.g. a
sensor) sending out a Data Frame. It is
also possible, however, for a
destination node to request the data
from the source by sending a Remote
Frame.

There are 2 differences between a
Data Frame and a Remote Frame.
Firstly the RTR-bit is transmitted as a
dominant bit in the Data Frame and
secondly in the Remote Frame there is
no Data Field. In the very unlikely
event of a Data Frame and a Remote
Frame with the same identifier being
transmitted at the same time, the
Data Frame wins arbitration due to the
dominant RTR bit following the
identifier. In this way, the node that
transmitted
©2016 the Remote
HARMAN INTERNATIONAL INDUSTRIES,Frame
INCORPORATED 39
3. CAN FRAMING
3.3. BIT STUFFING

The
resynchronization
mechanism is based
on evaluation of
recessive-to-
dominant signal
edges. Such signal
edges are assured by
the so-called bit
stuffing
mechanism. ISO
11898-1 prescribes
that senders must
transmit a
complementary bit BIT Stuffing
at the latest after
transmitting five
homogeneous bits; a
stuff bit is added
even if a
complementary bit
followed the five
homogeneous
©2016 bits
HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 40
3. CAN FRAMING
3.4. ERROR FRAME

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 41
3. CAN FRAMING
3.5. OVERLOAD FRAME

An Overload Frame has
the same format as an
“active” Error Frame. An
Overload Frame, however
can only be generated
during Interframe Space.
This is the way then an
Overload Frame can be
differentiated from an
Error Frame (an Error
Frame is sent during the
transmission of a
message).

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 42
3. CAN FRAMING
3.6. INTERFRAME SPACE

Interframe Space separates a
preceeding frame (of whatever
type) from a following Data or
Remote Frame. Interframe
space is composed of at least 3
recessive bits, these bits are
termed the Intermission. This
time is provided to allow nodes
time for internal processing
before the start of the next
message frame. After the
Intermission, for error active
CAN nodes the bus line remains
in the recessive state (Bus Idle)
until the next transmission
starts.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 43
4. CAN ERRORS
CONTENTS

4. CAN ERRORS

4.1.Bit Monitoring
4.2. Bit Stuffing Check
4.3.Frame Check
4.4. Cyclic Redundancy Check
4.5. ACK Check
4.6. Error Handling
4.7. Error Tracking

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 44
4. CAN ERRORS

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 45
4. CAN ERRORS

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 46
4. CAN ERRORS
4.1. BIT MONITORING

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 47
4. CAN ERRORS
4.2. BIT STUFFING CHECK

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 48
4. CAN ERRORS
4.3. FRAME CHECK

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 49
4. CAN ERRORS
4.4. CYCLIC REDUNDANCY CHECK

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 50
4. CAN ERRORS
4.5. ACK CHECK

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 51
4. CAN ERRORS
4.6. ERROR HANDLING

Transmission of an error flag is always terminated by an error
delimiter. This consists of eight recessive bits. The error delimiter
replaces the ACK delimiter and the EOF of a regular message
transmission, so that together with the obligatory transmission
pause (ITM — Intermission) on the CAN bus, this results in eleven
recessive bits (bus-idle identifier).

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 52
4. CAN ERRORS
4.6. ERROR HANDLING
Handling of Bit Monitoring
Error

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 53
4. CAN ERRORS
4.7. ERROR TRACKING

Consequently, each CAN controller has a
TEC (Transmit Error Counter) and a REC
(Receive Error Counter). In case of
successful transmission of a data or remote
frame, the relevant error counter is
decremented (TEC=TEC-1; REC=REC-1).
Detection and subsequent transmission of a
error flag causes the relevant error counter
to be incremented according to certain
rules. For the sender the following rule
applies: TEC=TEC+8. Error-detecting
receivers initially increment their REC by
one unit (REC=REC+1). For the error
causing receiver: REC=REC+8.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 54
5. CAN BUS SYNCHRONIZATION
CONTENTS

5. CAN BUS SYNCHRONIZATION

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 55
5. CAN BUS SYNCHRONIZATION

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 56
5. CAN BUS SYNCHRONIZATION

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 57
5. CAN BUS SYNCHRONIZATION

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 58
5. CAN BUS SYNCHRONIZATION

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 59
5. CAN BUS SYNCHRONIZATION

The limit to the amount of
lengthening or shortening of the
phase buffer segments is set by the
Resynchronization Jump Width.

The Resynchronization Jump Width
may be between 1 and 4 Time
Quanta, but it may not be longer
than Phase Buffer Segment 2.

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 60
NEXT

1. CAN Bus Synchronization

©2016 HARMAN INTERNATIONAL INDUSTRIES, INCORPORATED 61