Design of CAN network in automobile based on microcontroller MC9S12DP256 and MC33989 chip

With the increasing number of vehicle electrical equipment, from engine control to transmission system control, from driving, braking, steering system control to safety assurance system and instrument alarm system, from power management to various types of comfort improvement Efforts are made to make the vehicle electrical system form a complex large system, and this system is centralized in the cab control. In addition, with the development of ITS in recent years, the emergence of new Electronic communication products represented by 3G (GPS, GIS and GSM) has put forward higher requirements for the integrated wiring of automobiles and the sharing and interaction of information.

Authors: Guo Chuansheng; Pan Ming; Yu Xin

With the increasing number of vehicle electrical equipment, from engine control to transmission system control, from driving, braking, steering system control to safety assurance system and instrument alarm system, from power management to various types of comfort improvement Efforts are made to make the vehicle electrical system form a complex large system, and this system is centralized in the cab control. In addition, with the development of ITS in recent years, the emergence of new electronic communication products represented by 3G (GPS, GIS and GSM) has put forward higher requirements for the integrated wiring of automobiles and the sharing and interaction of information.

From the perspective of wiring, most of the traditional electrical systems use a single point-to-point communication method, and there is little connection between them, which inevitably requires a huge wiring system. According to statistics, in a high-end car using the traditional wiring method, the wire length can reach 2 000 m, and the electrical nodes can reach 1 500, and according to statistics, this number doubles about every 10 years, which aggravates the thick wiring harness. Conflict with the limited space available in the car. Regardless of material cost or work efficiency, traditional wiring methods will not be able to adapt to the development of automobiles.

From the point of view of information sharing, typical modern control units include electronically controlled fuel injection system, electronically controlled transmission system, anti-lock braking system (ABS), anti-skid control system (ASR), exhaust gas recirculation control, cruise system and air conditioning system . In order to meet the real-time requirements of each subsystem, it is necessary to share the public data of the car, such as engine speed, wheel speed, accelerator pedal position, etc., but the real-time requirements of each control unit are due to the data update rate and control cycle. different and different. This requires that its data switching network is based on the priority competition mode, and itself has a higher communication rate. CAN bus is designed to meet these requirements.

1 Introduction to CAN

In order to solve many control and data exchange problems in modern vehicles, German Bosch company has developed a CAN (Controller Area Network) field bus communication structure. The CAN bus hardware connection is simple, and has good reliability, real-time performance and cost performance. CAN bus can meet the needs of modern automation communication, and has become the most active branch in the field of industrial data bus communication. Its main features are:

① The CAN bus is a multi-master bus, and each node can actively send information to other nodes on the network at any time, regardless of the master and slave, and the communication is flexible;

② The CAN bus adopts a unique non-destructive bus arbitration technology, and the node with high priority transmits data first, which can meet the real-time requirements;

③ CAN bus has the functions of point-to-point, point-to-multipoint and global broadcast data transmission;

④ The number of valid bytes per frame on the CAN bus is at most 8, and there are CRC and other verification measures. The data error rate is extremely low. If a node has a serious error, it can automatically leave the bus, and other operations on the bus will not work Affected;

⑤ The CAN bus has only two wires. When the system is expanded, the new node can be directly hung on the bus, so there are fewer wires, the system is easy to expand, and the modification is flexible;

⑥ CAN bus transmission speed is fast, when the transmission distance is less than 40 m, the maximum transmission rate can reach 1 Mb/s;

⑦ The number of nodes on the CAN bus mainly depends on the bus driver circuit. In the CAN2.0B standard, its message identifier is almost unlimited.

In a word, CAN bus has the characteristics of strong real-time performance, high reliability, fast communication rate, simple structure, good interoperability, perfect error handling mechanism, high flexibility and low price of bus protocol.

2 Overall scheme design

2.1 Design of CAN network inside the car

It is precisely because the CAN bus has the incomparable advantages of these other communication methods that it becomes an ideal bus for the electric vehicle control system.

Typical electronic control units of modern automobiles mainly include main controller, engine control system, suspension control system, anti-lock brake control system (ABS), traction control system, ASR control system, instrument management system, fault diagnosis system, central Door lock system, seat adjustment system, light control system, etc. All these sub-control systems are connected to form a real-time control system – after the command is sent, it must be guaranteed to be responded within a certain period of time, otherwise, a major accident may occur. This requires the CAN communication network on the car to have a higher baud rate setting. In addition, during the actual operation of the car, a large amount of real-time data exchange is required between many nodes. If all the nodes of the entire car are connected to a CAN network, and many nodes communicate through a CAN bus, and the information management configuration is slightly improper, it is easy to cause the bus load to be too large, resulting in a decrease in the real-time response speed of the system. This is not allowed in a real-time system. Therefore, after analyzing the real-time performance of each node on the car, according to the real-time performance requirements of each node, three CAN communication networks with different rates of high, medium and low speeds are designed. The nodes with strict real-time requirements are formed into a high-speed CAN communication network, other nodes with relatively low real-time requirements are formed into a medium-speed CAN communication network, and the remaining nodes with less stringent real-time requirements are formed into a low-speed CAN communication network. And set up a gateway to connect the three communication networks with different rates to realize data sharing among all nodes. The CAN communication network topology of the whole car is shown in Figure 1.

Design of CAN network in automobile based on microcontroller MC9S12DP256 and MC33989 chip
Figure 1 Topology diagram of automotive CAN bus network 0

The five nodes of engine control system, suspension control system, anti-lock brake control system (ABS), traction control system, and ASR control system are the core components of automobile operation and have strict time response requirements. Therefore, these five nodes are A high-speed CAN communication network is formed, and the communication baud rate is set to 500 bps. Instrument management system, fault diagnosis system, etc. have relatively low requirements on real-time performance, so these nodes form a medium-speed CAN communication network, and the communication baud rate is set to 128 bps. The central door lock system, seat adjustment system, and headlight control system are not very strict in real-time requirements. They form a low-speed communication network, and the communication baud rate is set to 30 bps. The two gateways bridge high, medium and low speed buses to exchange data with each node. Through the intelligent processing of the data information to be transmitted between the CAN buses, the gateway can ensure that only certain types of specific information can be transmitted between the networks.

2.2 Device Selection

The CAN network inside the car is mainly composed of two parts: the CAN node facing the underlying ECU and the gateway for realizing high and low speed network data sharing and network management. In order to reduce the development cycle, a mid-range microprocessor MC9S12DP256 with CAN module from Motorola is selected; the CAN transceiver and power supply system are implemented with MC33989.

The microcontroller MC9S12DP256 is a mid-range chip in high-speed, high-performance 5.0 V Flash memory products based on 16-bit HCS12 CPU and 0.25 μm microelectronics technology. Its high performance-price ratio makes it very suitable for some mid-to-high-end automotive electronic control systems; at the same time, its simpler background development model (BDM) further reduces development costs, making on-site development and system upgrades more convenient.

Motorola’s system-on-chip (SBC) MC33989 has two power rectifiers designed to provide power for the MCU and peripheral devices. This intelligent semiconductor device provides all the necessary system voltages and has a low noise 200 mA rectifier inside to power the MCU subsystem. In addition, there is a means of controlling external pass transistors to power peripherals. This external pass transistor allows the secondary power supply to be adjusted to meet the power dissipation constraints required for each particular application. The secondary power supply can also cut off the power supply of the selected peripheral devices according to the requirements, so as to achieve the purpose of reducing power consumption.

In addition to providing system power, a 1 Mb CAN transceiver is integrated inside the SBC. The transceiver features master control status timeout detection, internal thermal protection, and short-circuit protection at the CAN-H and CAN-L inputs. Inside the transceiver, the CAN-H and CAN-L input terminals are also protected for jumping, reverse battery connection, and short-circuiting to the power supply or ground.

Four high-voltage wake-up inputs enable the device to have a powerful wake-up function. These wake-up inputs can withstand a maximum voltage of 40 V. The pull-up source for the input can be generated on-chip. Since only the pull-up source can be used to detect the change of the switch input at any time, the power consumption can be better reduced. The device also features periodic wake-up. In addition, SBC also provides reset adjustment and low-voltage detection functions for MCU.

2.3 Hardware circuit design of CAN node

In order to facilitate debugging and demonstration, the node modules include CAN interface, RS232 interface and liquid crystal Display. In the debugging process, the liquid crystal display is used to display the local data and the data received through the CAN bus visually, and the RS232 interface can be used to establish communication with the PC if necessary.

The core chip of the node is the microprocessor MC9S12DP256, which is mainly responsible for CAN initialization, data processing and monitoring data transmission.

MC33989 in Fig. 2 is the interface between CAN controller and physical layer bus. The device can provide differential transmission capability and differential reception capability for the bus, and has the function of resisting instantaneous interference in the automotive environment and protecting the bus. In addition to this, it also provides power to the MCU and peripheral devices. The block diagram of the CAN node is shown in Figure 2.

Design of CAN network in automobile based on microcontroller MC9S12DP256 and MC33989 chip
Figure 2 Block diagram of CAN node

2.4 Hardware circuit design of CAN gateway

The main function of the gateway is to coordinate the sharing of data between various networks, and is responsible for the communication between each node. Its hardware structure is very similar to that of the CAN node. Since it is responsible for data sharing between high-speed and low-speed networks, it must be bridged between the two networks at the same time. The hardware block diagram of the CAN bus gateway is shown in Figure 3.

Design of CAN network in automobile based on microcontroller MC9S12DP256 and MC33989 chip
Figure 3 Hardware block diagram of CAN bus gateway

The microprocessor MC9S12DP256 has 5 CAN modules, two of which are used here: one is connected to the low-speed network through MC33989 to realize the communication with the low-speed network; the other is connected to the high-speed network through the MC33989 to realize the communication between the high-speed and low-speed networks and management of the network.

2.5 Software design of CAN network communication system

The function that this design needs to realize is that each node sends and receives data, the gateway can realize the conversion of data, and realize the communication between high-speed and low-speed networks. During the experiment, two networks with different rates are assumed, and the data refresh period is a low-speed network of 10 ms and a high-speed network of 5 ms, respectively. The software design is written by KEIL C. The main program completes data processing and sending and receiving, and the interrupt program is responsible for data acquisition. The main program consists of three parts: CAN bus data sending and receiving, liquid crystal display control, and data frame analysis. Judging the reception or transmission of data by interruption, according to the difference of high and low speed, a new set of data is sent at regular intervals (5 ms or 10 ms). The communication program flow is shown in Figure 4.Figure 4 Communication program flow conclusion

Epilogue

In order to give full play to the role of ECU in vehicle control, the CAN communication network provides conditions for global optimization. Experiments have proved that CAN bus has the following advantages: 1. Free networking and strong scalability; 2. Automatic error definition, which simplifies the operation of the electronic control unit for communication; 3. The priority can be determined according to the data content to solve the real-time problem of communication.

In addition, the CAN network is also used by many industrial control systems, especially the occasions with high transmission rate and high requirements on real-time and reliability, so the CAN bus will have broad application prospects.

The Links:   BSM30GP60 QM30TF-HB

Bookmark the permalink.

Comments are closed.