Unformatted text preview:

Controller Area Network Marco Di Natale Scuola Superiore S Anna Pisa Italy CAN bus Controller Area Network Publicly available standard 1 http www semiconductors bosch de pdf can2spec pdf Serial data bus developed by Bosch in the 80s Support for broadcast and multicast comm Low cost Deterministic resolution of the contention Priority based arbitration Automotive standard but used also in automation factory control avionics and medical equipment Simple 2 differential copper wire connection Speed of up to 1Mb s Error detection and signalling CAN bus Purpose of this Lesson Yet another communication protocol standard Develop time analysis for real time messages Study the effect on timing of multiple layers HW and SW Understand how firmware can affect the time determinism and spoil the priority assignment Understand how device drivers and middleware layers influence the timing behavior Present multiple views for the time analysis worstcase stochastic simulation based CAN bus A CAN based system Appl SW Application Middleware System SW Device drivers Peripheral HW TX buffers TXobjects typically 1 to 32 RTOS RX buffers RXobjects typically 1 to 32 Firmware MAC layer implementation CAN bus CAN standard MAC protocol Fixed format messages with limited size CAN communication does not require node or system configuration information addresses Flexibility a node can be added at any time Message delivery and routing the content is identified by an IDENTIFIER field defining the message content Multicast all messages are received by all nodes that can filter messages based on their IDs Data Consistency A message is accepted by all nodes or by no node CAN bus Frame types DATA FRAME Carries regular data REMOTE FRAME Used to request the transmission of a DATA FRAME with the same ID ERROR FRAME Transmitted by any unit detecting a bus error OVERLOAD FRAME Used to force a time interval in between frame transmissions CAN bus DATA FRAME CAN bus DATA FRAME Start of frame 1 dominant bit A frame can only start when the bus is IDLE All stations synchronize to the leading edge of the SOF bit Identifier 11 or 29 in version 2 0 bits In order from most significant to least significant The 7 most significant bits cannot be all recessive RTR remote transmission request dominant for REQUEST frames recessive for DATA frames CONTROL see figure maximum data length is 8 bytes other values are not used CAN bus DATA FRAME conitinued Data 0 to 8 bytes of data CRC 15 CRC bits plus one CRC delimiter bit recessive ACK two bits SLOT DELIMITER all stations receiving the message correctly CRC check set the SLOT to dominant the transmitter transmits a recessive The DELIMITER is recessive END OF FRAME seven recessive bits Bit stuffing any sequence of 5 bits of the same type requires the addition of an opposite type bit by the TRANSMITTER and removal from the receiver CAN bus Some considerations 1 SOF 11 1 29 3 Arbitration 6 0 64 15 1 2 Control Data CRC ACK 3 7 EOF Worst case frame length 34 bits subject to stuffing 64 64 34 4 47 111 24 135 Protocol overhead minimum with no stuffing 64 111 0 576 data efficiency 73 4 protocol overhead CAN bus Arbitration All nodes are synchronized on the SOF bit The bus behaves as a wired AND wired OR An example Id 0x15a Id 0x3d2 Id 0x1f6 00101011010 0 0 1 0 1011010 01111010010 01 00111110110 0011 sof 0001010 CAN bus The type of arbitration implies that the bit time is at least twice the propagation latency on the bus This defines a relation between the maximum bus length and the transmission speed The available values are Minimum bit time time node A node A starts transmitting a bit node B overwrites node A reads the effect of changes by B node B Bit rate Bus length 1 Mbit s 25 m 800 kbit s 50 m 500 kbit s 100 m 250 kbit s 250 m 125 kbit s 500 m 50 kbit s 1000 m 20 kbit s 2500 m 10 kbit s 5000 m CAN bus Bit time The bit edge lies here Twice the propagation delay Compensate edge phase errors CAN bus Error and fault containment There are 5 types of error BIT ERROR The sender monitors the bus If the value found on the bus is different from the one that is sent then a BIT ERROR is detected STUFF ERROR Detected if 6 consecutive bits of the same type are found CRC ERROR Detected by the receiver if the received CRC field does not match the computed value FORM ERROR Detected when a fixed format field contains unexpected values ACKNOWLEDGEMENT ERROR Detected by the transmitter if a dominant value is not found in the ack slot CAN bus A station detecting an error transmits an ERROR FLAG For BIT STUFF FORM ACKNOWLEDGEMENT errors it is sent in the immediately following bit For CRC it is sent after the ACK DELIMITER The ERROR FLAG is part of an ERROR FRAME CAN bus An ERROR FRAME is simply the superposition of ERROR FLAGS from different nodes plus an ERROR DELIMITER There are two types of error flags An ACTIVE ERROR flag consists of 6 consecutive dominant bits A PASSIVE ERROR flag consists of 6 consecutive recessive bits The superposition of all the error flags goes from 6 to 12 bits The error delimiter consists of 8 recessive bits CAN bus Fault containment Each node can be in 3 states Error active Error passive limited error signalling and transmission features Bus off cannot influence the bus Each node has two counters TRANSMIT ERROR COUNT increased list by 8 when the transmitter detects an error decreased by 1 after the successful transmission of a message unless it is 0 RECEIVE ERROR COUNT increased list by 1 when the node detects an error by 8 if it detects a dominant bit as the first bit after sending an error flag decreased if between 1 and 127 by 1 if 127 set back to a value between 119 and 127 after successful reception of a message CAN bus Fault containment Each node can be in 3 states Error active Error passive limited error signalling and transmission features Bus off cannot influence the bus TRANSMIT ERROR COUNT 128 or RECEIVE ERROR COUNT 128 error passive TRANSMIT ERROR COUNT 256 error active TRANSMIT ERROR COUNT 127 and RECEIVE ERROR COUNT 127 TRANSMIT ERROR COUNT 0 and RECEIVE ERROR COUNT 0 and bus off CAN bus Error detection Possible problems on the last but one bit 7 CAN misbehavior is possible because of the different error detection mechanisms at the transmitter and receiver sites A message is valid for the transmitter is there is no error until the end of the frame A message is valid for the receiver is there is no error until the last but one bit of the frame last bit is do not care If the


View Full Document

Berkeley ELENG C249A - Controller Area Network

Documents in this Course
Load more
Loading Unlocking...
Login

Join to view Controller Area Network and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Controller Area Network and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?