EECS 373 Controller Area Networks Samuel Haberl Russell Kuczwara Senyuan Zhong.

21
EECS 373 Controller Area Networks Samuel Haberl Russell Kuczwara Senyuan Zhong

Transcript of EECS 373 Controller Area Networks Samuel Haberl Russell Kuczwara Senyuan Zhong.

EECS 373Controller Area Networks

Samuel HaberlRussell KuczwaraSenyuan Zhong

Presentation Outline

CAN history and basics

CAN standard message frame & arbitration

Error checking & noise protection

CAN implementation

Application strengths

http://goo.gl/Ktm1BY

CAN History

Developed by Bosch in 1983

Presented at SAE Conference in Detroit in 1986

Designed for automotive uses

Allows multiple controllers and sensors to communicate

2008: all US vehicles required to implement CAN for OBD

Multiple CAN implementations and variations

Where is CAN Used?

Automotive industry

Electronic control units (ECUs)

Sensors and switches

Multimedia systems

Factory automation

Low-cost machinery and electronics

Michigan Hybrid Racing Electric Drive System

Photo credit: Sam Haberl

CAN Basics

Multi-master, broadcast serial bus

Real Time Arbitration

Robust error-checking and noise protection

No extra wires for clock or arbitration

Cheap

http://www.aa1car.com/library/can_systems.htm

Masters and Targets Each node can be a master and a target

Arbitration field indicates message type

Nodes listen to messages that they care about

Addresses composed of dominant and recessive bits

0 – Dominant, 1 – Recessive

Lowest address (0x000) is most dominant

http://goo.gl/NafrtG

Standard Message Frame

Start of frame

Arbitration (identifier)

Control (data length, reserved bits)

Data field

CRC (cyclical redundancy check)

ACK (acknowledgement field)

End of frame

Intermission (time between frames)

Image from http://www.softing.com/home/en/industrial-automation/products/can-bus/more-can-bus/data-frame.php?navanchor=3010395

11 or 29 Bit

Arbitration

http://electronicdesign.com/Files/29/9131/Figure_02.gif

11 or 29 Bit

Error Checking

Form Errors

Proper message formatting is enforced

Bit Errors

Transmitter detects wrong bit while transmitting.

CRC Checksum Errors

Checksum calculated, compared to transmitted checksum

Acknowledgement Errors

ACK field must be set dominant by a receiving node

Bit stuffing Errors

Any time there are 5 of the same bits, one opposite bit sent

Error triggered by 6 identical bits

Error Handling

Any node on the bus can raise an “Error frame.” Holds bus dominant for 6 bits

Other nodes realize this is wrong, raise their error frames

Node that was transmitting re-sends message

Each node keeps individual error count Node goes into “passive” mode at 127 errors

Node removes itself from bus after 255 errorsImage from http://www.softing.com/home/en/industrial-automation/products/can-bus/more-can-bus/error-handling/active-error-frame.php?

navanchor=3010501

Timing

http://goo.gl/nUry9c

No bus clock signal, each node has its own clock

Each bit is divided into four sections

Synchronization, Propagation, Phase 1, Phase 2

Bit sampled between phase 1 and 2

Receiving nodes synchronize by adjusting phases

CAN Implementations Variants

CAN architecture can be implemented in many different approaches

Standards for single-wire, twisted pair, four-wire

Twisted-pair CAN is most commonly used

Twisted pair uses CAN_H and CAN_L signals

No additional wires needed

Signal generated by transceiver, not by processor

http://www.networkcablinglosangeles.com/wp-content/themes/networkcablinglosangeles/images/unshielded_cable.jpg

Electrical Noise Lots of Noise in Automotive Application

Only getting worse with more automation for luxury

http://upload.wikimedia.org/wikipedia/commons/0/0a/3phase-electric-motor-1.18.png

Differential Signals

Two-Wire differential signal

Value represented by difference between wires, not the absolute value of one wire

Difference creates immunity to noise

1 0 ? 00

From Master to Bus (2-Wire Implementation)

http://goo.gl/RPHJ8R

Processor uses logic-level signal Signals sent over 2-wire bus Use transceiver as bridge

Full Message Example

Sends the message with identifier 00000010100 Sends One Byte with value “1” 15 bit CRC field Bit Stuffing is handled by can transceivers and is not

visible

A CAN Bus For Everyone

Allows multiple bitrates and buses

Bitrates affect robustness and bus length

1 Mbit/s – High-priority

i.e. Airbags

10 kbit/s – Low-priority

i.e. Audio System changes (volume, audio source)

Multiple CAN Bus Example

http://goo.gl/UFsVd1

Application Strengths

Arbitration with no delay or extra wires

High-priority devices don’t wait

No extra weight or cost from wires

Robust error correction

Faulty nodes remove themselves from bus

Minimizes need for software correction

Noise immunity from twisted pair CAN

Inexpensive

56 cents @ 2,500 qty for SN65HVD1040DR CAN Transceiver (DigiKey)

References

Robert Bosch GmbH http://esd.cs.ucr.edu/webres/can20.pdf

KVaser CAN Solutions http://www.kvaser.com/en/about-can/the-can-protocol.html

Dearborn Group Technologies http://www.dgtech.com/images/primer.pdf

Softing CAN Bus Products http://www.softing.com/home/en/industrial-automation/products/can-bus/ind

ex.php?navanchor=3010024

Vector CANtech http://vector.com/vi_controller_area_network_en.html?gclid

=CNOAroPo47oCFdFDMgod9GsAIw&et_rp=1

Questions?