General information
Modern vehicles use several CAN busses (Controller Area Network) between modules / control units of various systems and controllers of the vehicle's actuators.
CAN communication procedure
B - Sensor 1; CAN - Data bus; M - Executive elements I-III (servo mechanisms); N - Control units/controllers IV
The bus is full duplex (or just duplex), i.e. any device connected to it can simultaneously receive and transmit messages.
The signal from the sensitive element of the corresponding information (sensor) enters the nearest control unit, which processes it and transfers it to the CAN data bus.
Any control unit connected to the CAN data bus can read this signal, calculate the parameters of the control action based on it, and control the functioning of the corresponding actuator.
Advantages
With the usual cable connection of electrical and electronic devices, each control unit is directly connected to all sensors and actuators from which it receives measurements or which it controls.
The complication of the control system leads to excessive length or multiple cable lines.
Compared to standard cabling, the data bus provides:
- Reducing the number of cables. The wires from the sensors are pulled only to the nearest control unit, which converts the measured values into a data packet and transfers the latter to the CAN bus;
- Any control unit can control the actuator, which receives the corresponding data packet via the CAN bus, and on its basis calculates the value of the control action;
- Improvement of electromagnetic compatibility;
- Reducing the number of plug connections and reducing the number of contact outputs on control units;
- Weight loss;
- Reducing the number of sensors, because single sensor signals (e.g. from the coolant temperature sensor) can be used by various systems;
- Improving diagnostic capabilities. Because single sensor signals (e.g. speed signal) are used by different systems, then if a fault message is issued by all systems using this signal, the sensor or control unit that processes its signals is usually faulty. If the error message comes from only one system, although this signal is used by other systems, then the cause of the malfunction is most often in the processing control unit or servomechanism;
- High data rate - up to 1 Mbit/s possible with a maximum line length of 40 m. At present, Mercedes-Benz vehicles have data transfer rates from 83 Kbit/s to 500 Kbit/s;
- Several messages can be transmitted in turn on the same line.
The CAN data bus consists of a two-wire wire made in the form of a twisted pair. All devices connected to this line (device control units).
Data transfer is carried out with duplication on both wires, and the logical levels of the data bus are mirrored (that is, if a logic zero level is transmitted on one wire (0), then on the other wire - the level of a logical unit (1), and vice versa).
The two-wire transmission scheme is used for two reasons: for error control and as a basis for reliability.
If a voltage peak occurs on only one wire, for example due to EMC problems (EMC), then receivers can identify this as an error and ignore this spike.
In the event of a short circuit or break in one of the two wires of the CAN bus, thanks to the integrated software and hardware reliability system, switching to the single-wire operation mode is carried out. A damaged transmission line is no longer used.
Order and format transmitted and received by users (subscribers) messages is defined in the communication protocol.
The essential distinguishing feature of the CAN data bus compared to other bus systems based on the principle of subscriber addressing is message-related addressing.
This means that each message transmitted on the bus is assigned its permanent address (identifier), marking the content of this message (e.g.: coolant temperature). The CAN data bus protocol allows up to 2048 different messages to be transmitted, with addresses 2033 to 2048 being permanently assigned.
The amount of data in one message on the CAN bus is 8 bytes.
The receiver unit processes only those messages that are stored in its own identification list (acceptance control).
Data packets can only be transmitted if the CAN exchange bus is free (i.e., if after the last packet an interval of 3 bits followed, and none of the control units starts transmitting the next message). In this case, the logical level of the data bus must be recessive (logical «1»).
If several control units start transmitting messages at the same time, then the priority principle comes into force, according to which the message with the highest priority will be transmitted first without losing time or bits (arbitration of access requests to the common data bus).
Each control unit that loses the right to arbitrate will automatically switch to receive and retry to send its message as soon as the data bus is free again.
In addition to data packets, when exchanging information, packets of requests for certain messages on the CAN data bus are also used - the control unit that is able to provide the requested information responds to such a request.
Data transfer format
In normal transfer mode, packets of the following configurations are used:
- Data Frame (message frame) for transmitting messages on the CAN data bus (e.g.: coolant temperature);
- Remote Frame (request frame) to request messages on the CAN data bus from another control unit;
- Error Frame (error frame), - all connected control units are notified that an error has occurred and the last message on the CAN data bus is invalid.
The CAN data bus protocol supports two different message frame formats that differ only in the length of the identifier: Standard and Extended.
At present, Daimler Chrysler vehicle control system communication systems use only the standard format.
Frame format
Each frame of messages transmitted over the CAN bus consists of seven consecutive fields:
- Start of Frame (start bit): Marks the beginning of the message and synchronizes all modules;
- Arbitration Field (arbitration field): This field consists of an 11-bit identifier (addresses) in and one control bit (Remote Transmission Request-Bit), marking the frame as a Data Frame (data frame) or as Remote Frame (remote request frame);
- Control Field (control bits): 6-bit control field contains the defining IDE bit (Identifier Extension Bit), used to recognize the type of format being used (standard or extended), a reserved bit for subsequent extensions and, - in the last 4 bits, - information about the number of data bytes embedded in the Data Field (see below);
- Data Field (data): The data field can contain from 0 to 8 bytes of data, - transmission of messages on the CAN bus with a length of 0 bytes is used to synchronize distributed processes;
- CRC Field (control field): CRC field (Cyclic-Redundancy-Check Field) contains 16 bits and serves for control recognition of errors during transmission;
- ACK Field (confirmation of receipt): ACK field (Acknowledgement Field) contains an acknowledgment signal for all receiver units that received a message via the CAN bus without errors;
- End of Frame (end of frame): Marks the end of the frame;
- Intermission (interval): Interval between two adjacent data frames. The length of the interval must be at least 3 bits, after which any of the control units can start transmitting the next packet;
- IDLE (rest mode): If no control unit transmits messages, then the CAN bus remains in idle mode (expectations) until the start of the next packet.
Priorities
In order to process data in real time, it must be possible to transfer them quickly.
This not only requires a link with a high physical data rate, but also requires that a common CAN bus be quickly provided if several control units need to send messages at the same time.
In order to distinguish between the messages transmitted on the CAN data bus according to the degree of urgency, different priorities are provided for individual messages.
The ignition timing, for example, has the highest priority, the slip values are medium, and the outside air temperature is the lowest.
The priority with which a message is transmitted on the CAN bus is determined by the identifier (address field) the corresponding message.
An identifier corresponding to a smaller binary number has a higher priority, and vice versa.
The CAN data bus protocol is based on two logical states: The bits are either «recessive» (logical «1»), or «dominant» (logical «0»). If a dominant bit is transmitted by at least one module, then recessive bits transmitted by other modules are overwritten.
Example
Arbitration example
First control unit (N I) loses arbitration from the 3rd bit
Third control unit (N III) loses arbitration from the 7th bit
Second control unit (N II) retains the right to access the CAN data bus and can transmit its message
If several control units start data transfer at the same time, then the conflict of access to the common data bus is resolved by «bitwise arbitration of shared resource requests» with the appropriate identifiers.
When transmitting the identifier field, the transmitter checks after each bit whether it still has the right to transmit, or whether another control unit is already transmitting a message with a higher priority on the bus.
If the recessive bit transmitted by the first transmitter unit is overwritten by the dominant bit of another transmitter unit, then the first transmitter unit loses its right to transmit (arbitration) and becomes a receiver block.
Other control units will only attempt to transmit their messages on the CAN data bus when it is free again. In this case, the right to transmit will again be granted in accordance with the priority of the message on the CAN data bus.
Error recognition
Interference can lead to errors in data transmission. Such transmission errors should be recognized and corrected. The CAN data bus protocol distinguishes between two levels of error recognition:
- Mechanisms at the Data Frame level (data frame);
- Bit level mechanisms.
Mechanisms at the Data Frame level
Cyclic-Redundancy-Check
Based on the message transmitted via the CAN data bus, the transmitter calculates the control bits that are transmitted together with the data packet in the field «CRC Field» (checksums). The receiver unit recalculates these control bits on the basis of the message received on the CAN data bus and compares them with the control bits received with this message.
Frame Check
This mechanism checks the structure of the transmitted block (frame), that is, bit fields with a given fixed format and frame length are rechecked.
Errors detected by Frame Check are marked as format errors.
Bit level mechanisms
Monitoring
Each module, when transmitting a message, monitors the logical level of the CAN data bus and determines the differences between the transmitted and received bits. This ensures reliable recognition of global and local bit errors that occur in the transmitter unit.
Bit Stuffing
In each frame of data between the field «Start of Frame» and the end of the field «CRC Field» there should be no more than 5 consecutive bits with the same polarity.
After each sequence of 5 identical bits, the block transmitter adds one bit with opposite polarity to the bit stream.
Receiver units clear these bits after receiving a message on the CAN data bus.
Troubleshooting
If any CAN data bus module detects an error, it interrupts the current data transfer process by sending an error message. The error message consists of 6 dominant bits.
Thanks to the error message, all control units connected to the CAN data bus are notified of a local error that has occurred and, accordingly, ignore the previously transmitted message.
After a short pause, all control units will again be able to send messages on the CAN data bus, with the message with the highest priority being sent first again.
The control unit whose message on the CAN data bus caused the error also starts retransmitting its message (automatic repeat request function).
CAN bus types
Different CAN buses are used for different control areas. They differ from each other in data transfer speed.
CAN baud rate area «engine and running gear» (CAN-C) is 125 Kbps, and the CAN data bus «Salon» (CAN-B) due to the smaller number of especially urgent messages, it is designed for a data transfer rate of only 83 Kbps.
The exchange of data between the two bus systems takes place via so-called «gateways», i.e. control units connected to both data buses.
Fiber optic D2B (Digital Daten-Bus) data applied to area «Audio/Communication/Navigation». A fiber optic cable can transmit a significantly larger amount of information than a bus with a copper cable.
CAN-C bus «Engine and Chassis»
A so-called data bus terminating resistor with a resistance of 120 Ω is installed on each side of the terminal control unit and is connected between both data bus wires.
The engine compartment CAN data bus is only active when the ignition is on.
More than 7 control units can be connected to the CAN-C bus.
CAN-B bus «Salon»
Some control units connected to the passenger compartment CAN data bus are activated regardless of the ignition being switched on (e.g. single lock system).
Therefore, the passenger compartment CAN data bus must be operational even when the ignition is switched off, which means that the possibility of transmitting data packets must be ensured even when the ignition is switched off.
In order to reduce the quiescent current consumption as much as possible, the CAN data bus, in the absence of data necessary for transmission, switches to passive standby mode, and is activated again only the next time it is accessed.
If in the passive standby mode of the passenger compartment CAN data bus, any control unit (e.g. single lock control module) transmits a message through it, then only the main system module receives it (electronic ignition switch, EZS/EIS). The EZS module stores this message in memory and sends an activation signal (Wake-up) to all control units connected to the CAN-B bus.
When activated, the EZS checks for all CAN databus users and then transmits the previously stored message.
More than 20 control units can be connected to the CAN-B bus.