Controller Area Network (CAN, Controller Area Network) is a serial communication protocol bus for real-time applications that can use twisted-pair wires to transmit signals, and is one of the most widely used fieldbuses in the world.The CAN protocol is used to communicate between a variety of different components in an automobile as a replacement for expensive and bulky power distribution wiring harnesses. The protocol's robustness extends its use to other automation and industrial applications.Features of the CAN protocol include serial data communication with integrity, real-time support, transmission rates up to 1Mb/s, and 11-bit addressing and error-checking capabilities.
CAN bus features
(1) message (Message) 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 a message.
(2) Information Routing(Information Routing) In CAN, the nodes do not use any message about the system configuration, such as station address, by the receiving node based on the characteristics of the message itself to determine whether to receive this frame of information. Therefore, when expanding the system, it is not necessary to change the software and hardware of the application layer as well as any node, and nodes can be added directly in CAN.
(3) Identifier (Identifier) The message to be transmitted has a characteristic identifier (a field for data frames and remote frames), which gives not the address of the target node, but the characteristics of the message itself. The message is sent over the network as a broadcast and can be received by all nodes. The node determines whether to receive this frame by using the identifier.
(4) Data consistency should ensure that the message is received by all nodes at the same time or not at all at the same time in the CAN, which is achieved in conjunction with error handling and resynchronization functions.
(5) Bit transfer rate varies from one CAN system to another, but is unique and fixed for a given system.
(6) Priority The priority of the bus occupied by a message is determined by the identifier in the message sending the data. 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.
(8) Arbitration) Any node can send a message to the bus as long as the bus is idle. If two or more nodes send messages at the same time, a bus access collision is caused. This collision can be resolved by bit-by-bit arbitration using identifiers. The mechanism of arbitration ensures that neither messages nor time are lost. When data frames and remote frames with the same identifier are sent at the same time, the data frames take precedence over the remote frames. During arbitration, each transmitter compares the level of the transmit bit with the level of the monitored bus. If the levels are the same, the unit can continue to transmit, but if it is transmitting a "hidden" level and monitoring a "dominant" level, then the unit loses arbitration and must exit the transmit state.
(9) Bus state The bus has two states, "explicit" and "implicit", "explicit" corresponds to logic "0", "implicit" corresponds to logic "0", "implicit" corresponds to logic "0", "implicit" corresponds to logic "0". Explicit" corresponds to logic "0" and "implicit" corresponds to logic "1". The "explicit" state and the "implicit" state are the same as the "explicit" state, so the two nodes send "0" and "1" at the same time. "CAN bus adopts binary non-return-to-zero (NRZ) encoding, so the bus is either "0" or "1". ", or "1" on the bus. But the CAN protocol does not specifically define the exact implementation of these two states.
(10) Fault Definition (Confinement) CAN nodes can distinguish between faults caused by transient disturbances and permanent faults. Faulty nodes are shut down.
(11) Answer Receiver nodes give answers to correctly received messages and mark inconsistent messages.
(12) The maximum CAN communication distance is 10 kilometers (at a rate of 5 Kbps), or the maximum communication rate is 1 Mbps (at a distance of 40 meters).
(13) The number of nodes on the CAN bus can be up to 110. Communication medium can be selected from twisted pair, coaxial cable, optical fiber.
(14) The message is a short frame structure, the short transmission time makes it low probability of interference, CAN has a good checksum mechanism, which ensure the reliability of CAN communication.
Characteristics of CAN-bus
(1) has the advantages of real-time, long transmission distance, strong resistance to electromagnetic interference, low cost and so on;
(2) the use of two-wire serial communication, error detection capability, can work in a high-noise interference environment;
(3) with priority and arbitration functions, multiple control modules through the CAN controller CAN-bus, forming a multi-master local network;
(4) can be decided to receive or block the message according to the ID of the message;
(5) reliable error handling and error detection mechanism;
(6) can automatically retransmit the information sent after it has been corrupted;
(7) nodes have the function of automatically withdrawing from the bus in the case of serious errors;
(8) the nodes have the function;
(8) the message does not contain the source or destination address, and only use flags to indicate the function information, priority information.