part 2 - universitat de valència · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13...

44
Controller Area Network part 2

Upload: others

Post on 25-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Controller Area Network

part 2

Page 2: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

We will talk about:

• Error handling• Performance• CAN physical layer• CAN hardware

Page 3: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Controller Area Network

Error handling

Page 4: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN communicationEvery node receive any message

The transmitter listens while transmitting

Every node participate in error procedures

Page 5: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN Error Detection

•Bit value check by transmitter.•Stuff rule check•Frame check•15 bit redundancy check•Acknowledgement check

Page 6: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN Error types

Modern CAN controllers makes it possible to read error counters and error type

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

Page 7: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Error Signalling

When a CRC error is detected, an ErrorFlag is started at the bit following the ACKdelimiter

1 11 4 0 - 64 15 1 7 318 12 1 2 1

When a bit, stuff, form or acknowledgement error isdetected, an Error Flag is started at the next bit

A dominant bit detected as the last End Of Framebit: The transmitter will signalize an error but thereceivers will accept the message

Page 8: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

0

1

Typ 17 - 23, max 29

6 8

Flag Error Delimiter

Module 1

Module 2

Bus Line

Error Detected

Bit-stuffing error detected

Active Error

(alt. fixed form error of ACK FIELDor End of Frame)

Bus Idle

Error counter < 128

min 6, max 12 bits Inter-mission

Active Error Frame

Page 9: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

0

1

6 8

Flag Error Delimiter

Module 1

Module 2

Bus Line

Bitstuffing error detected

Passive Error

Bus Idle

Error counter > 127

Inter-mission

Module free to transmit

SuspendTransmission

8

Passive Error Frame

Page 10: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Error counter rulesTransmitter

Detection of

8

Bit error while transm. active error flag 8

14 consecutive dombits at active error 8

8 consecutive dom bitsat passive error 8

Succesful transmisson -1

Reading rec bitswhile transmpassive error flag

ACK error whenerror passive

Rec stuff bit readas dom duringarbitration

TECadded

by

At transmission ofan error frame

Exeption Detection of

Error 1

8

Bit error while transm. active error flag 8

14 consecutive dombits at active error 8

8 consecutive dom bits atpassive error flagr 8

Dom bit as first bitafter transm activeerror flag

Succesful reception -1

Bit errorduring transmof active errorflag

If > 127, set to avalue 119 -127.

RECaddedby Exeption

Receiver

Page 11: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Error States

erroractive

errorpassive

busoff

REC < 128and

TEC < 128

TEC > 255

Normal mode requestand 128 occurrences of11 consecutive rec bits

11 consecutive rec bits = ACK delim + EOF + Interm Error delimiter + Intermission

Init

Page 12: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

0

1

Stuff Bit

Stuff BitBut sometimes only 2!

Original sequence

Stuffed sequence

Disturbed bus

Destuffed sequenceSame length and CRC sum, but only 2 false bits!

2

3

4

(In case of a stuff bit interpreted as adata bit and vice versa)

Page 13: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

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

Page 14: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Local Errors most common

One undetected error inhundred years at 1Mb/s

Page 15: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Overload Frame

6 8

0 1

Flag Overload Delimiter

Module 1

Module 2

Bus Line

Overload

Bus Idle

Error counters not increased

Inter-mission

EOF Inter-mission

No CAN Controller generates this!

Fixed form error (last bit in EOF or first two bits in Intermission) ⇒ Overload condition Overload Frame

Page 16: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Controller Area Network

Page 17: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN message

Std Data Frame

CAN Id/Priority

11 or 29 bitsArbitration

DLC4bits

=How many bytes

Page 18: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Information

Envelope

King's Letter

Data is turned into information by a

Cityaddress

Formnumber

CAN Id

Higher Layer Protocol

Data is NOT information

Page 19: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN has min. 11 to max. 93 bits that can be used for data transfer

-29 -19

0 63

-29 -1

0 63Std

Ext

11+n × 8 0 ≤ n ≤ 8

29+n×8

Page 20: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Compressed Envelope-29 -24 -1

-29 -12 -1

32 different pieces of 24 bit information

131072 different pieces of 12 bit information

DataIdentifier

Identifier Data

Page 21: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN Ext. ID used for data transfer

-3-11-23

Identifier Value Time segment

-29

Sensor ID

Page 22: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

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

Page 23: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Bandwidth of Std. CAN channel

Complete 11 bit Messages with no dataUpdate 1 Mb/s 250 kb/s 100 kb/s 50 kb/s1 ms 18 4 1 05 ms 90 22 9 415 ms 272 68 27 1350 ms 909 227 90 45

A Std. CAN message with no data has max. length of 55 bit including intermission space.

Page 24: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Bandwidth of Std. CAN channel

Complete Messages with 9 - 16 bit dataUpdate 1 Mb/s 250 kb/s 100 kb/s 50 kb/s1 ms 13 3 1 05 ms 67 16 6 315 ms 202 50 20 1050 ms 675 168 67 33

A Std. CAN message with 2 byte data has max. length of 74 bit including intermission space.

Page 25: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Bandwidth of Std. CAN channel

Complete Messages with 57 - 64 bit dataUpdate 1 Mb/s 250 kb/s 100 kb/s 50 kb/s1 ms 7 1 0 05 ms 37 9 3 115 ms 111 27 11 550 ms 373 93 37 18

A Std. CAN message with 8 byte data has max. length of 134 bit including intermission space.

Page 26: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Bandwidth of Ext. CAN channel

Complete 29 bit Messages with no dataUpdate 1 Mb/s 250 kb/s 100 kb/s 50 kb/s1 ms 12 3 1 05 ms 61 15 6 315 ms 185 46 18 950 ms 617 154 61 30

An Ext.. CAN message with no data has max. length of 81 bit including intermission space.

Page 27: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Bandwidth of Ext. CAN channel

Complete Messages with 9 - 16 bit dataUpdate 1 Mb/s 250 kb/s 100 kb/s 50 kb/s1 ms 10 2 1 05 ms 50 12 5 215 ms 150 37 15 750 ms 500 125 50 25

An Ext. CAN message with 2 byte data has max. length of 100 bit including intermission space.

Page 28: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Bandwidth of Ext. CAN channel

Complete Messages with 57 - 64 bit dataUpdate 1 Mb/s 250 kb/s 100 kb/s 50 kb/s1 ms 6 1 0 05 ms 31 7 3 115 ms 93 23 9 450 ms 312 78 31 15

An Ext. CAN message with 8 byte data has max. length of 160 bit including intermission space.

Page 29: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN Message

Arbitrationfield

11 or 29 bit

11 - 93 useful bits in 47 -160 bitpackets on the bus

0 - 8 byte

Page 30: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

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).

Page 31: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Information that has to be defined at a node before

transmission takes place:

•Bit length•Sampling point and SJW•Higher Layer Protocol•Physical address

Page 32: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Controller Area Network

Page 33: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN physical layer

•Twisted pair bus-ISO 11898, DeviceNet, SDS, etc.

•Single wire bus•Optical passive star•Optical active star

Page 34: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN Drivers

• High Speed ISO 11898 drivers– TJA1050– 82C251– 82C250– CF150– MTC3054– SN75LBC031– UC5350– Si9200

• Low Speed and fault tolerant drivers– 82C252– TJA1053– TJA 1054– TLE6252G

• Truck and trailer– B10011S

Page 35: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

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.

Page 36: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN Drivers

Schematic of Philips 82c251

Page 37: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN Drivers

Schematic of Philips TJA 1054

Page 38: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

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.

Page 39: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

CAN physical layerCANHUG

• Unshielded Twisted pair bus– Impedance 85 - 120 - 140 – Termination 118 - 120 - 130

• Bus Driver– Philips 82C251

Page 40: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Recessive State Voltages

Diff. output- 500 - 0 - 50 mV

CAN_H2.0 - 2.5 - 3.0 V

CAN_L2.0 - 2.5 - 3.0 V

2.0V3.0V

CAN_H < CAN_L

Page 41: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Dominant State Voltages

Diff. input0.9 - 5.0 V

Diff. output1.5 - 3.0 V

CAN_H2.75 - 3.5 - 4.5 V

CAN_L0.5 - 1.5 - 2.25 V

1.5V

3.5V

CAN_H >> CAN_L

Page 42: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Physical bit representation

Time

CAN_H

CAN_L

Vdiff

Vdiff

Recessive DominantRecessive

Page 43: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Always terminate the bus

GoodGood DangerousDangerous UselessUseless

Page 44: part 2 - Universitat de València · 2003-02-10 · 1 ms 18 4 1 0 5 ms 90 22 9 4 15 ms 272 68 27 13 50 ms 909 227 90 45 ... •Sampling point and SJW •Higher Layer Protocol •Physical

Maximum Bus LengthBuslength

Bit ratekbit/s

Nom bit timeµs

25 m

50 m100 m

250 m

500 m650 m1 km

2.5 km5 km

1000

500250

125100502010

800

1

1.25

2

48

102050

100

Comments

In-out delays 210 ns

In-out delays 300 ns(incl 2x40 ns optocoupl)

In-out delays 450 ns(incl 2x100 ns optocoupl)

Propagation delay 5 ns/m10 ns delay = 2m