You are on page 1of 44

Controller Area Network

part 2
We will talk about:

• Error handling
• Performance
• CAN physical layer
• CAN hardware
Controller Area Network

Error handling
CAN communication
Every node receive any message
The transmitter listens while transmitting

Every node participate in error procedures


CAN Error Detection

•Bit value check by


transmitter.
•Stuff rule check
•Frame check
•15 bit redundancy check
•Acknowledgement check
CAN Error types

•Bit error
•Stuff error
•Form error
•CRC error
•Acknowledgement error

Modern CAN controllers makes it possible to


read error counters and error type
Error Signalling
When a bit, stuff, form or acknowledgement error is
detected, an Error Flag is started at the next bit

1 11 2 18 1 2 4 0 - 64 15 1 1 1 7 3

When a CRC error is detected, an Error


Flag is started at the bit following the ACK
delimiter
A dominant bit detected as the last End Of Frame
bit: The transmitter will signalize an error but the
receivers will accept the message
0 Active Error Frame
Error counter < 128
1

Active Error
Flag Error Delimiter

Module 1 Error Detected


6 8
Bit-stuffing error detected
Module 2 (alt. fixed form error of ACK FIELD
or End of Frame)

Bus Line

min 6, max 12 bits Inter- Bus Idle


mission
Typ 17 - 23, max 29
0
Passive Error Frame
Error counter > 127
1

Passive Error Suspend


Flag Error Delimiter Transmission

Module 1 Module free to transmit

6 8 8

Module 2 Bitstuffing error detected

Bus Line

Inter- Bus Idle


mission
Error counter rules
Transmitter Receiver
TEC REC
added added
Detection of by Exeption Detection of by Exeption
Reading rec bits Error Bit error
At transmission of 8 while transm 1 during transm
an error frame passive error flag of active error
flag
ACK error when
error passive Dom bit as first bit
after transm active 8
Rec stuff bit read error flag
as dom during
arbitration Bit error while transm.
active error flag 8
Bit error while transm.
active error flag 8
14 consecutive dom
14 consecutive dom bits at active error 8
8
bits at active error
8 consecutive dom bits at
8 consecutive dom bits passive error flagr 8
8
at passive error
Succesful reception -1 If > 127, set to a
Succesful transmisson -1 value 119 -127.
Error
Init
States

error
active Normal mode request
and 128 occurrences of
11 consecutive rec bits

REC < 128


and
TEC < 128

error bus
passive TEC > 255 off
11 consecutive rec bits = ACK delim + EOF + Interm
Error delimiter + Intermission
0 Stuff Bit
But sometimes only 2!
1 Stuff Bit (In case of a stuff bit interpreted as a
data bit and vice versa)

Original sequence

2 Stuffed sequence

3 Disturbed bus

4 Destuffed sequence
Same length and CRC sum, but only 2 false bits!
No error flags - No errors

• A poor bus
– lots of detected errors means means an
undetectable error-combination might slip
through
• A healthy bus
– no detectable errors means a very low
probability for undetectable error-
combinations to occur
Local Errors most common

One undetected error in


hundred years at 1Mb/s
Overload Frame
Error counters not increased
0 1
Overload
Flag Overload Delimiter
No CAN Controller generates this!
Module 1
6 8
Fixed form error (last bit in EOF or first two bits
Module 2 in Intermission) ⇒ Overload condition Overload
Frame

Bus Line

EOF Inter- Inter- Bus Idle


mission mission
Controller Area Network
CAN message

11 or 29 bits
Arbitration

CAN Id/ DLC =How many bytes


Priority 4bits

Std Data Frame


Data is NOT information
Data is turned into information by a
Higher Layer Protocol
King's Letter
Information
City Form
address number

Envelope
CAN Id
CAN has min. 11 to max. 93 bits
that can be used for data transfer
-29 -19

Std
0 11+n × 8 63 0≤n≤8

-29 -1

0 29+n×8
63
Ext
Compressed Envelope
-29 -24 -1

Identifier Data

32 different pieces of 24 bit information

-29 -12 -1

Identifier Data

131072 different pieces of 12 bit information


CAN Ext. ID used for data transfer

-29 -23 -11 -3

Identifier Value Time segment


Sensor ID
CAN has no identifier!

•CAN ID field plus byte(s) in Data field as


identification simplifies scheduling and saves
memory
•Data in CAN ID field save bandwidth
•CAN Controllers can be used as coprocessors
when CAN ID field contains data
Bandwidth of Std. CAN channel

Complete 11 bit Messages with no data


Update 1 Mb/s 250 kb/s 100 kb/s 50 kb/s
1 ms 18 4 1 0
5 ms 90 22 9 4
15 ms 272 68 27 13
50 ms 909 227 90 45

A Std. CAN message with no data has max. length of


55 bit including intermission space.
Bandwidth of Std. CAN channel
Complete Messages with 9 - 16 bit data
Update 1 Mb/s 250 kb/s 100 kb/s 50 kb/s
1 ms 13 3 1 0
5 ms 67 16 6 3
15 ms 202 50 20 10
50 ms 675 168 67 33

A Std. CAN message with 2 byte data has max. length


of 74 bit including intermission space.
Bandwidth of Std. CAN channel
Complete Messages with 57 - 64 bit data
Update 1 Mb/s 250 kb/s 100 kb/s 50 kb/s
1 ms 7 1 0 0
5 ms 37 9 3 1
15 ms 111 27 11 5
50 ms 373 93 37 18

A Std. CAN message with 8 byte data has max. length


of 134 bit including intermission space.
Bandwidth of Ext. CAN channel
Complete 29 bit Messages with no data
Update 1 Mb/s 250 kb/s 100 kb/s 50 kb/s
1 ms 12 3 1 0
5 ms 61 15 6 3
15 ms 185 46 18 9
50 ms 617 154 61 30

An Ext.. CAN message with no data has max. length


of 81 bit including intermission space.
Bandwidth of Ext. CAN channel
Complete Messages with 9 - 16 bit data
Update 1 Mb/s 250 kb/s 100 kb/s 50 kb/s
1 ms 10 2 1 0
5 ms 50 12 5 2
15 ms 150 37 15 7
50 ms 500 125 50 25

An Ext. CAN message with 2 byte data has max. length


of 100 bit including intermission space.
Bandwidth of Ext. CAN channel
Complete Messages with 57 - 64 bit data
Update 1 Mb/s 250 kb/s 100 kb/s 50 kb/s
1 ms 6 1 0 0
5 ms 31 7 3 1
15 ms 93 23 9 4
50 ms 312 78 31 15

An Ext. CAN message with 8 byte data has max. length


of 160 bit including intermission space.
CAN Message

11 - 93 useful bits in 47 -160 bit


packets on the bus

11 or 29 bit 0 - 8 byte

Arbitration
field
CAN Real-time Performance
•Repetition rate 10 ms, time resolution 1 ms
-Rather straight forward
•Repetition rate 1 ms, time resolution 100 µs
-Careful scheduling, careful programming.
-A Global Clock helpful
• Repetition rate 100µs, time resolution 10 µs
-A Global Clock necessary.
-A priori knowledge of process behaviour.
-Cyclic Software.
-Oversampling technique required
• Time resolution 1 µs
- Judged as the ultimate limit (CAN v2.0).
Information that has to be
defined at a node before
transmission takes place:
•Bit length
•Sampling point and SJW
•Higher Layer Protocol
•Physical address
Controller Area Network
CAN physical layer

•Twisted pair bus


-ISO 11898, DeviceNet, SDS, etc.
•Single wire bus
•Optical passive star
•Optical active star
CAN Drivers

• High Speed ISO • Low Speed and fault


11898 drivers tolerant drivers
– TJA1050 – 82C252
– 82C251 – TJA1053
– 82C250 – TJA 1054
– CF150 – TLE6252G
– MTC3054 • Truck and trailer
– SN75LBC031 – B10011S
– UC5350
– Si9200
CAN Drivers
• All mentioned drivers work with two
differential wires with a reference to ground
level
• At bus transmission 125 kBit/s, the fault
tolerant units may work with:
– One of the CAN wires shorted to ground
– One of the CAN wires shorted to power supply
– The two CAN wires shorted together
• “Truck and trailer” communicates on 24V bus-
lines, at 250 kBits/s maximum.
– Can switch to single-wire mode if a wiring failure
should occur.
CAN Drivers

Schematic of Philips 82c251


CAN Drivers

Schematic of Philips TJA 1054


CAN Bus Wires
• Two wire fault tolerant drivers
– Used in automotive body electronics.
• Two wires, ISO 11898 standard
– Solution included in the CAN protocol standard, HW part
• Single wire, J2411 standard
– Is used by GM.
• Truck and trailer, ISO WD 11992-1
– Will be used by truck manufacturers in harsh environments.
• Solutions with discrete components
– Used in old designs.
– Used if no standard driver is available.
– Seem to be replaced by standard drivers, because it is hard and
expensive to test out such design.
CAN physical layer
CANHUG
• Unshielded Twisted pair bus
– Impedance 85 - 120 - 140
– Termination 118 - 120 - 130
• Bus Driver
– Philips 82C251
Recessive State Voltages

CAN_H < CAN_L

CAN_H
2.0 - 2.5 - 3.0 V
3.0V
2.0V CAN_L
2.0 - 2.5 - 3.0 VDiff. output
- 500 - 0 - 50 mV
Dominant State Voltages
CAN_H >> CAN_L
Diff. input
0.9 - 5.0 V

CAN_H Diff. output


2.75 - 3.5 - 4.5 V 1.5 - 3.0 V
3.5V

1.5V CAN_L
0.5 - 1.5 - 2.25 V
Physical bit representation

Vdiff CAN_H

Vdiff
CAN_L

Recessive DominantRecessive

Time
Always terminate the bus

Good Dangerous Useless


Maximum
Nom
Bus Length
bit time
Bus Bit rate Comments
µs
length kbit/s
25 m 1000 1 In-out delays 210 ns
50 m 800 1.25
100 m 500 2 In-out delays 300 ns
(incl 2x40 ns optocoupl)
250 m 250 4
500 m 125 8 In-out delays 450 ns
(incl 2x100 ns optocoupl)
650 m 100 10
1 km 50 20
50 Propagation delay 5 ns/m
2.5 km 20 10 ns delay = 2m
5 km 10 100

You might also like