CAN bus communication technology and embedded real-time operating system are the key technologies in the research and development of new energy vehicles. Compared with traditional vehicles, new energy vehicles have added components such as motors and power batteries. In order to obtain excellent driving mileage or extremely low exhaust pollutant emissions, it is necessary to pass the motor controller, power battery management system, and vehicle control system. Power battery, drive motor, etc. for coordinated control. Coordinated control signal communication between controllers is transmitted through CAN communication. At the same time, multiple real-time control tasks are running in different controllers, and the scheduling of these tasks is realized by the embedded real-time operating system.
Introduction to CAN protocol
CAN is a controller area network launched by Bosch and Intel and other companies for modern automotive applications. CAN bus technology was originally used in the communication of microcontrollers in the automotive environment. Exchange information to form an automotive electronic control network, such as embedding CAN control modules in engine control systems, transmission controllers and instrumentation systems. Because CAN has the advantages of high speed, high reliability, strong real-time and low cost, it has been widely used in many fields such as transportation, industrial automation, control equipment, medical equipment and environment, building control and so on. CAN bus is one of the most widely used field buses in the world.
1.1 Overview of CAN Protocol
In 1986, Bosch proposed the CAN bus concept at the Society of Automotive Engineers (SAE) conference, marking the birth of CAN. In 1987, Intel launched the first CAN control chip 82526, which was the first hardware implementation of CAN. Subsequently, Philips Semiconductors also launched 82C200, and the application of CAN bus began to develop rapidly.
In order to facilitate promotion and consider compatibility, the standardization of CAN has become an urgent need. In the early 1990s, Bosch CAN specification (V2.0), in September 1991, Philips Semiconductors formulated and released the CAN technical specification (V2.0), including two parts A and B, of which part A regulates V1. The CAN message format in version 2, part B specifies the standard and extended message formats. In the same year, CAN was first implemented in automobiles by Mercedes-Benz.
In 1993, the International Organization for Standardization (ISO) officially promulgated ISO11898-1993 to further standardize and standardize CAN. In 1994, the American Society of Automotive Engineers and its subsidiary Truck and Bus Control and Communication Sub-Association chose CAN as the basis to formulate the American National Standard SAE J1939.
In 1995, ISO formulated and released the low-speed network standard 1SO11519-2-1995 with error handling mode. In the following time, the standardization of CAN has been continuously advancing.
1.2 Features of CAN protocol
The initial design and later standardization and standardization work of CAN bus refer to the application characteristics of automobiles, and it can effectively support serial communication of distributed control and real-time control. Compared with other buses, the data communication of CAN bus has outstanding reliability, real-time and flexibility. Its main features are as follows.
(1) It can work in a multi-master mode, any node on the network can actively send information to other nodes on the network at any time, and regardless of master-slave, the communication mode is flexible, and no node information such as addresses is required.
(2) The node information on the network is divided into different priorities, which can meet different real-time requirements. Data with high priority can be transmitted within 134μs at most.
(3) Using the non-destructive bit arbitration bus structure mechanism, when two nodes transmit information to the network at the same time, the node with low priority actively stops data transmission, while the node with high priority can continue to transmit data without being affected. Thus, the bus conflict arbitration time is greatly saved.
(4) It can transmit and receive data in several ways such as point-to-point, point-to-multipoint (group) and global broadcast.
(5) The direct communication distance of CAN can be up to 10km when the rate is below 5kb/s: the communication rate can be up to 1Mbls, the communication distance is up to 40m at this time, and the number of nodes can be up to 110.
(6) The message adopts the short data frame structure, the transmission time is short, the probability of being disturbed is low, and the data error rate is guaranteed to be extremely low. Each frame of CAN information has a cyclic redundancy check (CRC) and various regular error detection measures, which have an excellent error detection effect.
(7) The CAN node has the function of automatically shutting down the output in the case of serious errors, cutting off its connection with the bus, so that the operations of other nodes on the bus are not affected.
(8) The communication medium can be twisted pair, coaxial cable and optical fiber. Generally, cheap twisted pair can be used without special requirements.
(9) CAN bus has high cost performance. It has simple structure, few communication lines, easy purchase of devices, easy mastery of development technology, and can make full use of existing single-chip development tools.