Everything You Should Know About CAN Bus
Many driver friends and friends in the industrial control circle have heard the word "CAN bus". Today, let's take a look at why the CAN bus is so popular?
CAN bus, also known as Controller Area Network (Controller Area Network), is a serial communication protocol bus for real-time applications. It can use twisted pair to transmit signals and is one of the most widely used field buses in the world. . The CAN protocol is used to communicate between various components in a car, replacing expensive and bulky power distribution wiring harnesses. The wide use of CAN protocol makes it quickly extend to automation control and industrial fields.
Features of the CAN protocol include complete serial data communication, real-time support, transmission rates up to 1Mb/s, 11-bit addressing and error detection capabilities.
History of CAN bus
The controller area network CAN belongs to the field bus category, which is a serial communication network that effectively supports the distributed control system. A serial communication bus specially developed for the automotive industry by German Bosch in the 1980s has become more and more popular due to its high performance, high reliability and the ability to detect any errors that occur. Applied to many fields.
With the wide application of CAN bus in various industries and fields, stricter requirements have been put forward for its communication format. In 1991, the CAN bus technical specification (Version2.0) was formulated and released. This technical specification includes two parts, A and B. Among them, 2.0A gives the standard format of CAN message, and 2.0B gives two formats of standard and extended.
The American Society of Automotive Engineers SAE proposed the J1939 protocol in 2000, which has since become a common standard for controller area networks in trucks and passenger cars. The traditional CAN is triggered based on events, and the uncertainty of information transmission time and priority inversion are its inherent defects. These flaws are relatively insignificant when messages are transmitted on the bus infrequently; however, as the frequency of transmission increases, performance degrades dramatically.
In order to meet the ever-increasing demands of real-time performance and transmission message density for automotive control, it is necessary to improve the real-time performance of the CAN bus. Therefore, the combination of traditional CAN and time-triggered mechanism produces TTCAN (Time-Triggered CAN), and ISO11898-4 has included TTCAN. The difference between the TTCAN bus and the traditional CAN bus system is that different messages on the bus define different time slots (Timer Slot).
How the CAN bus works
The CAN bus uses a serial data transmission method, which can run on a twisted pair of 40m at a rate of 1Mb/s, or use an optical cable to connect, and the bus protocol supports multiple master controllers on this bus. When a node (station) on the CAN bus sends data, it is broadcast to all nodes in the network in the form of a message. For each node, whether or not the data is sent to itself, it is received. The 11-bit characters at the beginning of each group of messages are identifiers, which define the priority of the messages. This message format is called a content-oriented addressing scheme. Identifiers are unique in the same system, and it is impossible for two stations to send messages with the same identifier. This configuration is important when several stations are competing for bus reads at the same time.
CAN bus characteristics
1. Message The data on the bus is sent in different message formats, but the length is limited. When the bus is idle, any node on the network can send messages.
2. Information routing In CAN, the node does not use any message about system configuration, such as station address, and the receiving node determines whether to receive this frame of information according to the characteristics of the message itself.
3. Identifier It refers to the characteristic identifier of the message to be transmitted. It does not give the address of the target node, but the characteristic of the message itself. Information is broadcast on the network and can be received by all nodes.
Recommended by LinkedIn
4. Data consistency It should be ensured that the message is received by all nodes in CAN at the same time or not received at the same time, which is realized with the function of error handling and resynchronization.
5. CAN systems with different bit transmission rates have different speeds, but in a given system, the bit transmission rate is unique and fixed.
6. Priority The identifier in the message for sending data determines the priority of the message occupying the bus. The smaller the identifier, the higher the priority.
7. Remote data request By sending a remote frame, a node that needs data requests another node to send the corresponding data. The data frame transmitted by the responding node is named by the same identifier as the remote frame requesting the data.
Features of CAN bus
1. Strong real-time performance, long transmission distance, strong anti-electromagnetic interference ability, and low cost;
2. It adopts two-wire serial communication mode, which has strong error detection ability and can work in high noise interference environment;
3. With priority and arbitration functions, multiple control modules are connected to the bus through the CAN controller;
4. It can decide to receive or block the message according to the ID of the message;
5. Reliable error handling and error detection mechanism;
6. After the information sent is damaged, it can be automatically re-sent;
7. The node has the function of automatically exiting the bus when the error is serious;
8. The message does not contain the source address or destination address, and only uses the identifier to indicate the function and priority information.
CAN has formed an international standard and has been recognized as one of the most promising fieldbuses.