Controller Area Network (CAN) is a multicast shared serial bus standard, originally developed in the 1980s by Robert Bosch GmbH, for connecting electronic control units (ECUs). CAN was specifically designed to be robust in electromagnetically noisy environments and can utilize a differential balanced line like RS-485. It can be even more robust against noise if twisted pair wire is used. Although initially created for automotive purposes (as a vehicle bus), nowadays it is used in many embedded control applications (e.g., industrial) that may be subject to noise.
Bit rates up to 1 Mbit/s are possible at networks length below 40 m. Decreasing the bit rate allows longer network distances (e.g. 125 kbit/s at 500 m).
The CAN data link layer protocol is standardized in ISO 11898-1 (2003). This standard describes mainly the data link layer — composed of the Logical Link Control (LLC) sublayer and the Media Access Control (MAC) sublayer — and some aspects of the physical layer of the ISO/OSI Reference Model. All the other protocol layers are left to the network designer's choice.
| Truth tables for dominant/recessive and logical AND | |||||||||
| | |||||||||
| dominant | recessive | |
| dominant | dominant | dominant |
| recessive | dominant | recessive |
| 0 | 1 | |
| 0 | 0 | 0 |
| 1 | 0 | 1 |
So, if you are transmitting a recessive bit, and someone sends a dominant bit, you see a dominant bit, and you know there was a collision. (All other collisions are invisible.) The way this works is that a dominant bit is asserted by creating a voltage across the wires while a recessive bit is simply not asserted on the bus. If anyone sets a voltage difference, everyone sees it, hence, dominant.
Commonly when used with a differential bus, a Carrier Sense Multiple Access/Bitwise Arbitration (CSMA/BA) scheme is implemented: if two or more devices start transmitting at the same time, there is a priority based arbitration scheme to decide which one will be granted permission to continue transmitting.
During arbitration, each transmitting node monitors the bus state and compares the received bit with the transmitted bit. If a dominant bit is received when a recessive bit is transmitted then the node stops transmitting (i.e., it lost arbitration). Arbitration is performed during the transmission of the identifier field. Each node starting to transmit at the same time sends an ID with dominant as binary 0, starting from the high bit. As soon as their ID is a larger number (lower priority) they'll be sending 1 (recessive) and see 0 (dominant), so they back off. At the end of ID transmission, all nodes bar one have backed off, and the highest priority message gets through unimpeded.
CAN has four frame types:
The CAN standard requires the implementation must accept the base frame format and may accept the extended frame format, but must tolerate the extended frame format.
| Field name | Length (bits) | Purpose |
|---|---|---|
| Start-of-frame | 1 | Denotes the start of frame transmission |
| Identifier | 11 | A (unique) identifier for the data |
| Remote transmission request (RTR) | 1 | Must be dominant |
| Identifier extension bit (IDE) | 1 | Must be dominant |
| Reserved bit (r0) | 1 | Reserved bit (it must be set to dominant, but accepted as either dominant or recessive) |
| Data length code (DLC) | 4 | Number of bytes of data (0-8 bytes) |
| Data field | 0-8 bytes | Data to be transmitted (length dictated by DLC field) |
| CRC | 15 | Cyclic redundancy check |
| CRC delimiter | 1 | Must be recessive |
| ACK slot | 1 | Transmitter sends recessive and any receiver can assert a dominant |
| ACK delimiter | 1 | Must be recessive |
| End-of-frame (EOF) | 7 | Must be recessive |
One restriction placed on the identifier is that the first 7 bits cannot be all recessive bits.
| Field name | Length (bits) | Purpose |
|---|---|---|
| Start-of-frame | 1 | Denotes the start of frame transmission |
| Identifier A | 11 | First part of the (unique) identifier for the data |
| Substitute remote request (SRR) | 1 | Must be recessive |
| Identifier extension bit (IDE) | 1 | Must be recessive |
| Identifier B | 18 | Second part of the (unique) identifier for the data |
| Remote transmission request (RTR) | 1 | Must be dominant |
| Reserved bits (r0, r1) | 2 | Reserved bits (it must be set dominant, but accepted as either dominant or recessive) |
| Data length code (DLC) | 4 | Number of bytes of data (0-8 bytes) |
| Data field | 0-8 bytes | Data to be transmitted (length dictated by DLC field) |
| CRC | 15 | Cyclic redundancy check |
| CRC delimiter | 1 | Must be recessive |
| ACK slot | 1 | Transmitter sends recessive and any receiver can assert a dominant |
| ACK delimiter | 1 | Must be recessive |
| End-of-frame (EOF) | 7 | Must be recessive |
The two identifier fields (A & B) combined form a 29-bit identifier.
The first field is given by the superposition of ERROR FLAGS contributed from different stations. The following second field is the ERROR DELIMITER.
ISO 11898-2 uses a two-wire balanced signaling scheme. It is the most used physical layer in car powertrain applications and industrial control networks.
The ISO 11898-4 standard defines the time-triggered communication on CAN (TTCAN). It is based on the CAN data link layer protocol providing a system clock for the scheduling of messages.
Controller Area Network | CAN bus | Controller area network | Controller Area Network | Controller Area Network | Controller Area Network | Controller Area Network | Controller Area Network | Controller Area Network | CAN-väylä | CAN-buss
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Controller Area Network".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world