EECS 373 Controller Area Networks Samuel Haberl Russell Kuczwara Senyuan Zhong
Presentation Outline CAN history and basics CAN standard message frame & arbitration Error checking & noise protection CAN implementation Application strengths
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 tm
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
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 11 or 29 Bit
Arbitration 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 errors Image from frame.php?navanchor=
Timing 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 content/themes/networkcablinglosangeles/images/unshielded_cable.jpg
Electrical Noise Lots of Noise in Automotive Application Only getting worse with more automation for luxury
Differential Signals Two-Wire differential signal Value represented by difference between wires, not the absolute value of one wire Difference creates immunity to noise 10? 00
From Master to Bus (2-Wire Implementation) Processor uses logic-level signal Signals sent over 2-wire bus Use transceiver as bridge
Full Message Example Sends the message with identifier 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
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 2,500 qty for SN65HVD1040DR CAN Transceiver (DigiKey)
References Robert Bosch GmbH KVaser CAN Solutions Dearborn Group Technologies Softing CAN Bus Products bus/index.php?navanchor= bus/index.php?navanchor= Vector CANtech GsAIw&et_rp=1 GsAIw&et_rp=1
Questions?