Unformatted text preview:

Controller Area NetworkMarco Di NataleScuola Superiore S. Anna- Pisa, ItalyCAN busController Area Network– Publicly available standard [1] http://www.semiconductors.bosch.de/pdf/can2spec.pdfSerial data bus developed by Bosch in the 80s– Support for broadcast and multicast comm– Low cost–Deterministic resolution of the contention–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 signallingCAN busPurpose 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 –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 (worst-case, stochastic, simulation-based)CAN busA CAN-based system System Appl.SWMiddlewareApplicationPeripheral HWSystem SWDevice driversRTOSMiddlewareFirmware(MAC layer implementation)TX buffers(TXobjects)typically 1 to 32RX buffers(RXobjects)typically 1 to 32CAN busCAN 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 contentIDENTIFIER 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 nodeCAN busFrame typesDATA FRAME• Carries regular dataREMOTE FRAME• Used to request the transmission of a DATA FRAME with the same IDERROR FRAME ERROR FRAME • Transmitted by any unit detecting a bus errorOVERLOAD FRAME• Used to force a time interval in between frame transmissionsCAN busDATA FRAMECAN busDATA FRAMEStart 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 bitIdentifier – 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 RTR–remote transmission request, dominant for REQUEST frames, recessive for DATA framesCONTROL – (see figure) maximum data length is 8 (bytes) other values are not usedCAN busDATA FRAME (conitinued)Data – 0 to 8 bytes of dataCRC – 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 recessiveEND OF FRAME – seven recessive bitsBit 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 busSome considerations …111+129+360-6415+1 2 3SOF Arbitration Control Data CRC ACK EOF7Protocol overhead(minimum with no stuffing)64/111 = 0.576 data efficiency (73.4% protocol overhead)Worst case frame length34 bits subject to stuffing64 + (64 + 34)/4 + 47 = 111 + 24 = 135CAN busArbitrationAll nodes are synchronized on the SOF bitThe bus behaves as a wired-AND (wired-OR)An example …001010110100111101001000111110110Id = 0x15a Id = 0x3d2 Id = 0x1f60010101101001111010010001111101100000sof00 1 001 1011 010110101 0CAN busThe type of arbitration implies that the bit time is at least twice the propagation latency on the busThis defines a relation between the maximum bus length and the transmission speed. The available values are Bit rate Bus length1 Mbit/s25 mnode Atime1 Mbit/s25 m800 kbit/s 50 m500 kbit/s 100 m250 kbit/s 250 m125 kbit/s 500 m50 kbit/s 1000 m20 kbit/s 2500 m10 kbit/s 5000 mnode Bnode A starts transmitting a bitnode B overwritesnode A reads the effect of changes by BMinimum bit timetimeCAN busBit timeThe bit edge lies hereTwice the propagation delayCompensate edge phase errorsCAN busError and fault containmentThere are 5 types of errorBIT ERRORThe sender monitors the bus. If the value found on the bus is different from the one that is sent, then a BIT ERROR is detectedSTUFF ERRORDetected if 6 consecutive bits of the same type are foundDetected if 6 consecutive bits of the same type are foundCRC ERRORDetected by the receiver if the received CRC field does not match the computed valueFORM ERRORDetected when a fixed format field contains unexpected valuesACKNOWLEDGEMENT ERRORDetected by the transmitter if a dominant value is not found in the ack slotCAN busA 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 FRAMECAN busAn ERROR FRAME is simply the superposition of ERROR FLAGS from different nodes, plus an ERROR DELIMITERThere are two types of error flags:An ACTIVE ERROR flag consists of 6 consecutive dominant bitsA PASSIVE ERROR flag consists of 6 consecutive recessive bitsThe superposition of all the error flags goes from 6 to 12 bitsThe error delimiter consists of 8 recessive bitsThe error delimiter consists of 8 recessive bitsCAN busFault containmentEach node can be in 3 states:Error activeError passive: limited error signalling and transmission featuresBus off: cannot influence the busEach node has two counters:TRANSMIT ERROR COUNT: 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 messageCAN busFault containmentEach node can be in 3 states:Error activeError passive: limited error signalling and transmission featuresBus off: cannot influence the bus≥≥≥≥error activeerror passivebus offTRANSMIT ERROR COUNT


View Full Document

Berkeley ELENG C249A - Controller Area Network

Documents in this Course
Load more
Download Controller Area Network
Our administrator received your request to download this document. We will send you the file to your email shortly.
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 2 2 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?