1. CAN History
Bosch originally developed the Controller Area Network in 1985 for in-vehicle networks. In the past automotive manufacturers connected electronic devices in vehicles using point-to-point wiring system. Manufactures began using more and more electronics in vehicles, which resulted in bulky wire harnesses that were heavy and expensive. They, then, replaced dedicated wiring with in-vehicle networks, which reduced wiring cost, complexity, and weight.
2. CAN Benefits
Low-Cost, Lightweight Network
CAN provides an inexpensive, durable network that helps multiple CAN devices communicate with one another. An advantage to this is that electronic control units (ECUs) can have a single CAN interface rather than analog and digital inputs to every device in the system. This decreases overall cost and weight automobiles.
Broadcast Communication
Each of the devices on the network has a CAN controller chip and is therefore intelligent. All devices on the network see all transmitted messages. Each device can decide if a message is relevant or if it should e filtered This structure allows modifications to CAN networks with minimal impact. Additional non-transmitting nodes can be added without modification to the network.
Priority
Every message has a priority, so if two nodes try to send messages simultaneously, the one with the higher priority gets transmitted and the one with the lower priority gets postponed. This arbitration is non-destructive and results in non-interrupted transmission of the highest priority message. This also allows networks to meet deterministic timing constraints.
Error Capabilities
The CAN specification includes a Cyclic Redundancy Code (CRC) to perform error checking on each frame's contents. Frames with errors are disregarded by all nodes, and an error frame can be transmitted to signal the error to the network. Global and local errors are differentiated by the controller, and if too many errors are detected, individual nodes can stop transmitting errors or disconnect itself from the network completely.
3. CAN Terminology
CAN devices send data across the CAN network in packets called frames. A CAN frame consists of the following sections.
- SOF (Start of Frame) indicates the beginning of a message with a dominant(logic 0) bit.
- Arbitration ID identifies the message and indicates the message's priority. Frames come in two formats - standard, which uses an 11-bit arbitration ID, and extended, which uses a 29-bit arbitration ID.
- IDE (identifier extension) bit allows differentiation between standard and extended frames.
- RTR (remote transmission request) bit serves to differentiate a remote frame from a data frame A dominant (logic 0) RTR bit indicates a data frame. A recessive (logic 1) RTR bit indicates a remote frame.
- DLC (data length code) indicates the number of bytes the data field contains.
- Data Field contains 0 to 8 bytes of data.
- CRC (cyclic redundancy check) contains 15-bit cyclic redundancy check code and a recessive delimiter bit. The CRC field is used for error detection.
- ACK (ACKnowledgement) slot - any CAN controller that correctly receives the message sends an ACK bit at the end of the message. The transmitting node checks for the presence of the ACK bit on the bus on the bus and reattempts transmission if no acknowledge is detected.
- CAN signal - an individual piece of data contained within the CAN frame data filed.
4. CAN Database files
CAN database files are text files that contain scaling information for CAN frames and signal definition. For each signal, CAN database define rules for conversion to engineering units. The following data is stored in databases.
- Channel name
- Location (start bit) and size(number of bit) of the channel within a given message
- Byte order (Intel/Motorola)
- Data type (signed, unsigned, and IEEE float)
- Scaling and units string
- Range
- Default value
- Comment
5. How CAN communication works
As stated earlier, CAN is a peer-to-peer network. This means that there is no master that controls when individual nodes have access to read and write data on the CAN bus. When a CAN node is ready to transmit data, it checks to see if the bus is busy and then simply writes a CAN frame onto the network. The CAN frames that are transmitted do not contain addresses of either the transmitting node or any of the intended receiving node(s). Instead, an arbitration ID that is unique throughout the network labels the frame All nodes on the CAN network receive the CAN frame, and, depending on the arbitration ID of that transmitted ID of that transmitted frame, each CAN node on the network decides whether to accept the frame.
If multiple nodes try to transmit a message onto the CAN bus at the same time, the node with the highest priority (lowest arbitration ID) automatically gets bus access. Lower-priority nodes must wait until the bus becomes available before trying to transmit again.