Professional Documents
Culture Documents
Universidad
de Oviedo
Lesson :
Controller Area Network (CAN)
Semester 3 Power Systems in hybrid (HEVs) and electric (EV) vehicles
Lecturer: F.F.Linera
More Features :
multi master bus access
random access with collision avoidance (CSMA / CA )
short message length , at max. 8 Bytes per message
data rates 100KBPS to 1MBPS
short bus length, physical length depends on data rate
self-synchronised bit coding technology
Robust EMC - behaviour
build in fault tolerance
2
Europe
www.iso.org
North America
www.sae.org
n/a
SAE J2411
Single Wire CAN for Vehicle
Applications
ISO 11519 - 2
ISO 11898 - 3
n/a.
High-Speed CAN
ISO 11898
SAEJ2284
6
Application Layer
Layer
Presentation Layer
Layer
Session Layer
Layer
void
void
void
Transport Layer
Layer
Network Layer
Layer
Layer
void
Physical Layer
12
This
resistance
reduces slew-rate
in transition an so,
EMC pollution.
Depending of the
speed, a double
choke to reduce
EMC
can
be
neccesary.
15
TJA1040 has a
split voltage Vcc/2
drawn from the IC,
to avoid some
error reads during
wake-ups
for a
sleep-node
16
Pin compatible
with ISO118982 drivers
Typical application
with 3V
microcontroller
17
18
19
20
3.6V
1.4V
Main characteristics
Nominal Values
Recessive
Dominant
VCANH
VCANL
VCANH VCANL
0V
5V
-5V
3.6V
1.4V
2.2V
21
The main advantage to use a slower speed is that the communication distance
can be increased without problems of EMC pollution.
Some applications do not require long distances and the communication
speed can be below 125 Kbps. In this case, this low speed CAN network can
be implemented using the same ISO11898-2 drivers shown in the previous
slides. The main difference with ISO 11898-3 is the electrical levels on the
physical layers.
It will found that as the length of the network increases, it is more likely that it
will suffer of various kinds of electromechanical disturbances due to short
circuits and/or open circuits (wires isolated or cut).
If a CAN communication must be reliable, it must be capable of being
maintained even in severe conditions of physical disturbances, continuing to
transmit, even in degraded mode and signalling and/or indicating any faults
that ocurre.
This is the reason to define a Fault Tolerant Low Speed CAN (FT LS CAN).
This CAN network is not very usual in medium-end cars. It is more usual in
high-end cars used in body applications like roof, seat, windows where a shortcircuit or cut wires can be more likely.
22
Principle of FT LS CAN: If there are any faults on the bus, they must be
detected, signalled and repaired as well as possible.
23
All nodes continue communicating at least with reduced signal and noise ratio.
24
26
Leaving aside any standarization of the physical layer for differential wires, a single-wire
solution (plus ground, of course) was developed several years ago for economical
reasons.
Drivers for this implementation only use one pin, normally called CANH. High Level on
this pin can be achieved with 5V (normal mode)/12V (wake-up mode) with respect to
GND.
Due to a high RF radiation, this bus is only used at low speeds. Typical values are 33,3
Kbps (normal/wake-up mode) and 83,3Kbps (high speed mode)
Failures of the short circuit and opencircuit types are theoretically insoluble and so, it is
only used for non-critical solutions intended to use and comply with the CAN protocol,
benefit from its advantages and the cost must be reduced.
SW-CAN and LIN physical layers are very similar. SW-CAN has the main advantage of
maintaining consistency and performance of the CAN protocol throughout the network,
thus avoiding the need of gateways between protocols or between a protocol and a
sub-protocol, such as LIN.
27
28
There are not many single-wire transceiver manufaturer in the market: NXP AU5790,
Infineon TLE6255, Melexis TH8055/56, Freescale 33897 and ONSemi NCV7356.
GMLAN operation
During Wake-up mode (Mode0 = 0 & Mode1 =
1) the nominal CAN bus electrical levels used
are 12V (high) and 0V (low).
After wake-up, normal mode is activated
(Mode0 = 1 & Mode1 = 1) the nominal CAN
bus electrical levels used are 4V (high) and 0V
(low)
29
By isolation transformer
Every optocoupler delays the signal 20 ms
(equivalent to 200ns)
30
RJ-45 Connector
31
Courtesy of Vector
Informatik GmbH
All fields in a CAN frame have a bit length defined with the exception of the arbitration
field.
The arbitration field has a length of 12 bits if the CAN frame corresponds to CANVersion 2.0A (Standard), where the messages uses a 11-bit standard identifier and nostuffing bits must be added.
The arbitration field has a length of 32 bits if the CAN frame corresponds to CANVersion 2.0B (Extended), where the messages uses a 29-bit standard identifier and nostuffing bits must be added.
If stuffing bits must be added, the arbitration field length can be different to 12 or 32 bits.
CAN-Standard 2.0A messages and CAN-Extended 2.0B messages can share the same
CAN physical network
32
Standard
CAN-Version 2.0A
messages with 11-bit -identifiers
Extended
CAN-Version 2.0B
messages with 29-bit-identifiers
==>
Data Frame: Data is transmitted form a transmitter to one or several receivers upon the
initiative of the source (transmitter). Normally, the frame has all fields, but the data field
is optional.
Remote Frame: A bus node (receiver) can request the transmissin of a data frame of
the same frame identifier by a source. It has not data field.
REMOTE FRAME
ESCENARIO:
Error Frame: It is used to signal an error detected by a bus node (transmitter or receiver)
and to destroy the frame.
Overload Frame: It is used to provide for an extra delay between a preceding and a
succeeding data or remote request frame or to signal a specific error condition.
34
Vcc
node 1
high : reccessive
low : dominant
node 2
node 1
high
high
low
node 2
high
low
low
node 3
node 3
high
high
high
bus
high
low
low
36
(1) arbitration-field :
denote the priority of the message
logical address of the message (identifier)
Standard frame, CAN 2.0A: 11 bit-identifier
Extended frame, CAN 2.0B: 29 bit-identifier
37
Courtesy of Vector
Informatik GmbH
Because dominant (logic 0) wins over recessive (logic 1), low-valued identifiers always
have higher priority to access the bus.
If Std IDs and Ext IDs are involved, the Std IDs compete with the 11 most significant bits
(b28b18) of the Ext IDs.
If all 11 first bits are identical, the Std ID wins if it is a data frame because of the
dominant RTR bit (SRR is always recessive)
If all 11 first bits are identical, the Std ID wins if it is a remote frame because of the
dominant IDE bit (the IDE bit belongs to the arbitration field in the Extended frame and
belongs to the control field in the standard frame)
38
(3) control-field :
Transmit the number of bytes in the data-field (DLC From 0 to 8)
39
40
41
The ACK Field is two bits long and contains the ACK Slot and the ACK Delimiter (always
recessive).
The transmitter of a frame transmits both bits fo the ACK Field recessive.
Every CAN node that receives any error-free transfer (from SOF to CRC) reports this to
the transmitter by sending a dominant bit during the ACK slot regardless of whether the
message was intended for that node.
If the transmitter detects a positive acknowledge, that is a dominant ACK slot, the
transmitter knows that in minimum one node has got his message.
If no one receives the message correctly the ACK Slot stays recessive.
42
RTR
r0
1bit
1 bit
IDE
1 bit
Identifier
11 bits
data
0...8 byte
CRC
15 bits
EOF + IFS
10 bits
ACK
2 bits
DLC
4 bits
s ta rt
1 b it
SRR
1 b it
ID E
1 b it
Id e n tifie r
1 1 b its
R TR
r0
1 b it
1 b it
r1
1 b it
Id e n tifie r
1 8 b it
d a ta
0 ...8 b yte
DLC
4 b its
CRC
1 5 b its
E O F + IF S
1 0 b its
ACK
2 b its
Remote Frames
RTR bit = 1
No Data Field
46
Data frames and remote frames are separated from preceding frames whatever type
they are (Data, remote, error or overload) by a field called INTERFRAME SPACE.
In contrast, Overload and error frames are not preceded by an Interframe space and also
if multiple Overload frames has to be transmitted.
Interframe Space constains two parts: INTERMISSION and BUS IDLE.
INTERMISSION consists of 3 recessive bits. During Intermission the only action to be
taken is signalling an OVERLOAD condition and no station is allowed to actively start a
transmission of a data or remote frame
BUS IDLE may be of arbitrary length. The bus is recognized to be free and any node
having something to trnsmit can access the bus. Even if a message is pending of
transmission during a previous one, it will be started in the first bit following
INTERMISSION.
47
48
error frame
50
error frame
error frame
51
Transmitter X
CAN - Tx
Receiver Y
CAN - Tx
Receiver Z
CAN - Tx
CAN
Bus - level
5
3
Nodes Y, Z realize a stuff bit error after bit 6 of the active error flag field
(note: if the corrupted data frame had dominant bits, the stuff bit error is
detected earlier)
Nodes Y,Z transmit their own active error flag field of 6 dominant bits
All nodes transmit the recessive error delimiter field. Node Y and Z see
no difference @ bus level, but node X detects a delay of 6 bits
between bus level and its own output First node to message error
After the last 8 recessive error delimiter bits @ CAN-bus and 3 bit of
inter frame space a new arbitration is entered by node X, e.g. it has to
compete again with other nodes
53
Bit-Error
the transmitted bit doesnt read back with the same digital
level (except arbitration and acknowledge- slot )
2.
Bit-Stuff-Error
more than 5 continuous bits read back with the same digital
level (except end of frame-part of the message )
3.
CRC-Error
Format-Error
Violation of the data-format of the message , e.g.: CRCdelimiter is not recessive or violation of the end -of-framefield
5.
Acknowledgement-Error
error
detection
error
managing
error
active
error
passive
bus
off
55
REC <127
and
TEC <=127
error active
'reset' or 'init
node'
REC >127 or
127<TEC<255
error passive
bus off
56
Message Filtering
The data transmission via CAN network is based on the principle of message
broadcasting.
This means that all messages transmitted on the bus are accessible to all nodes and
received by the CAN controllers.
In many cases a certain node will only be interested in a few messages intended for it.
For this reason it is very appropriate to implement an additional message filtering
mechanism which ensures that a host controller is only informed of the reception of a
new message is actually relevant for it
For the implementation of this filtering mechanism, the CAN controllers has several
internal registers normally called: mask registers and filter register
The mask registers are formed, at least, by the same number of bits than an identifier in
a CAN frame (29). Every bit in this register indicates if the corresponding bit in the
received frame is relevant or not to inform to the controller core about its reception.
The filter register are also formed, at least, by the same number of bits than an identifier
(29). A received message is relevant for this node if the corresponding identifier bit has
the same value in the filter register.
Normally, a CAN controller has several filter register and several mask register. The
same CAN register can be combined with several filter register
The filter and/or mask registers has normally extra bits in order to define if the filtering
process is only applicable to standard messages, extended messages or both of them
57
Message Filtering
Main Principle
To explain the filtering main principle, we are going to suppose that the identifiers are
formed by only 4 bits
Mask bit = 1 means that this bit is relevant for recepetion
Mask bit = 0 means that this bit is not relevant for reception. It can be 1 or 0.
Receiver3
Mask: 1000b
Filter: 1110b
Receiver1
Mask: 1001b
Filter: 1111b
Transmitter
ID: 1001b
X
Receiver2
Mask: 0000b
Filter: 0110b
Receiver4
Mask: 1000b
Filter: 0001b
Message Filtering
Main Principle
Receiver2
Mask: 1000b
Filter: 1110b
Receiver1
Mask: 1001b
Filter: 1111b
Transmitter
ID: 1000b
X
X
Receiver4
Mask: 1000b
Filter: 0001b
Receiver3
Mask: 0000b
Filter: 0110b
Receiver2
Mask: 1111b
Filter: 1110b
Receiver1
Mask: 1001b
Filter: 1111b
Transmitter
ID: 1110b
X
X
Receiver3
Mask: 0000b
Filter: 0110b
Receiver4
Mask: 1000b
Filter: 0001b
59
Web Resources
60