CAN (Controller Area Network) was first proposed by the German company Bosch, and is the most popular and commonly used bus in the automotive controller area network. Its main features are: CAN bus is a multi-master bus, each node can actively send information to other nodes on the network at any time, regardless of master and slave, flexible communication; CAN bus adopts unique non-destructive bus arbitration technology , 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 is a CRC and other verification measures, the data error rate is extremely low, a node can be automatically disconnected from the bus if there is a serious error, and other operations on the bus will not be affected; the CAN bus has only 2 wires, and the new node can be directly hung on the system when the system is expanded. On the bus, so there are few lines, the system is easy to expand, and the modification is flexible; the transmission speed of the CAN bus is fast, and the maximum transmission rate can reach 1 Mb/s when the transmission distance is less than 40 m. The application of CAN bus can not only simplify the wiring harness, realize sensor sharing, reduce the system cost, but also greatly reduce the failure rate of the vehicle. The application of CAN bus in automobiles is the development trend of modern automobile technology.
2. Application of CAN bus in automobile
At present, the network connection in the car mainly uses two CAN buses, one is the high-speed CAN bus of the drive system with a rate of 500 kb/s, and the other is the low-speed CAN bus of the body system with a rate of 100 kb/s. The main connection objects of the CAN of the drive system are the engine controller (ECU), ASR and ABS controller, airbag controller, combination instrument, etc., which have the same basic characteristics and are all systems directly related to vehicle driving. The main connection objects of the CAN of the body system are the central control door locks, power windows, rear view mirrors and interior lights of more than 4 doors. In addition to the above two CAN buses, some advanced cars also have a third CAN bus, which is mainly connected to satellite navigation and intelligent communication systems.
In foreign countries, especially in Europe, CAN has become an indispensable device in modern cars. CAN bus technology is becoming more and more mature, and its applications are becoming more and more widely used. Mercedes-Benz, BMW, Volkswagen, Volvo, Renault and other cars use CAN as a controller networking technology. Domestic research on CAN bus has just started, so far there is no more successful application. However, my country attaches great importance to the research and development of vehicle local area network bus technology. Recently, the relevant state departments have made clear regulations on the application of CAN bus in luxury buses. It is believed that the introduction of this policy will greatly promote the research, development and application of automotive CAN bus by relevant enterprises and scientific research units. This paper discusses the design of the lamp node in the CAN bus system of the bus body, which belongs to the node design on the low-speed CAN bus.
3. SCM and its CAN bus module
NEC is the world’s second largest manufacturer of automotive microcontrollers after Freescale. Due to its relatively late promotion in China, domestic enterprises do not use it much. CAN bus module is a peripheral of μPD780822 microcontroller and is a complete CAN controller. It can meet the requirements of the body CAN bus network. In addition to the basic functions of CAN, it also includes some unique functions, such as time synchronization function, programmable CAN bus wake-up and CPU wake-up function, programmable low-level reset function when the bus is closed, etc. Access to the CAN bus is divided into control/status register access and transmit/receive buffer access.
The information frames sent by the CAN controller are divided into two types: sending data frames and sending remote frames. There are two transmit buffers, one of 16 bytes and one of 8 bytes. The 16-byte buffer can store data frames in two formats, standard frame and extended frame, and the 8-byte buffer can be used to store the data to be sent. When sending a data frame, after the data is written to the sending buffer, if the corresponding sending request bit is enabled, the data is sent to the CAN bus, and the data of the data frame can be set to 1 to 8 bytes by software. The format of the data frame is shown in Figure 1.
When the CAN controller receives a message, it first compares the identifier of the received message with the identifier of the corresponding buffer, and only messages with the same identifier can be received. The CAN module of μPD780822 single-chip microcomputer has 2 independent transmit buffers, and the 2 buffers share a 16-byte data area to store CAN frames with a maximum of 8 bytes of data. The structure of the sending area and the receiving area is similar. When the flag bit and the control bit are not set to be dedicated to CAN, the CPU can use it as a common data storage area.
The controller has 16 receiving buffers, and the buffer area used for receiving information frames is determined by the information quantity register (MCNT). Information received from the bus is stored directly in the transmit buffer. Receive buffers that are not used in work can be used by the CPU as normal RAM. Each receive buffer has its programmable interrupt enable bits.
4. Network structure and nodes
The bus body CAN system includes the main control node, lighting node, air conditioning node, door node and instrument node, etc., as shown in Figure 2. Among them, the headlight node control includes front left and right profile lights, front left and right position lights, front left and right distress warning lights, front left and right parking lights, left and right headlight high beams, left and right front lights There are 16 control units including low beam, front left and right fog lights and front left and right turn signals. Rear lamp node control includes rear left and right marker lamps, rear left and right turn lamps, rear left and right brake lamps, rear left and right position lamps, rear left and right fog lamps and rear left and right reversing lamps 12 control units. The master control node mainly receives some switch input signals from the driver. The instrument node mainly controls the direction, water temperature, oil pressure, brake, door, lights, ABS/ARS and defrost and other indicators and control instruments by receiving data on the bus to Display vehicle speed, engine speed, water temperature, fuel, Values such as oil, voltage, stepper motor, etc. The air-conditioning node controls the on-off of the air-conditioning and the setting of the temperature in the car. The door and mirror nodes control the door solenoid valve switch, mirror adjustment switch, and mirror heating switch. Safety nodes monitor power to the ABS and ECAS.
5. Hardware circuit design
The hardware structure of the lighting node is shown in Figure 3, which includes a lighting control module and a CAN interface module. Lighting control module consists of TLP521-4 photoelectric isolator and BTS442, BTS740 smart switches.
TLP521-4 is a 4-channel optoelectronic isolator, and 8 TLP521-4 form 32-channel optoelectronic isolation, which connects the signal transmitted to the switch and switch feedback with the single-chip microcomputer. BTS442 is a single output intelligent switch (PROFET) produced by Infineon Company, which has the advantages of allowing larger transient current (above 140 A) and wider temperature range (-55℃～+150℃). Circuit control switch to control 6 high-current loads such as headlights and fog lights. BTS740 is a 4-way output intelligent switch produced by lnfineon Company. The output of the 2-way is used as the 1-way, so that it can pass a large instantaneous current. 5 BTS740s form 10 control switches to control the remaining small current loads. Both BTS442 and BTS740 have diagnostic feedback function. If there is an error, a low-level signal will appear on the 4th pin of BTS442 and the 4th and 8th pins of BTS740, and the signal will be connected to the single-chip microcomputer through the photoelectric isolator , to realize the endpoint detection function, and feed back to the instrument node through the CAN information frame. The hardware CAN interface module is the same for all nodes, including light nodes. Since this single-chip microcomputer has CAN bus module, it does not need a special CAN controller. The single-chip microcomputer does not have a CAN transceiver, and needs an external 82C250 transceiver and a 6N137 photoelectric isolator in the middle. The hardware interface circuit of single chip microcomputer, photoelectric isolator and CAN transceiver is shown in Figure 4.
6. Node software design
The node software flow is shown in Figure 5. The program adopts the query method. After the node is initialized and reported to work normally, it will remain in the query state until the light control command sent by the main control node reaches the light node. The diagnostic feedback function of the switch detects whether the corresponding switch is normal. If it is normal, send the corresponding control command to the corresponding high/low-side switch, and then return to the query state. If it is not normal, send the abnormal information frame of the corresponding endpoint to the meter node, and continue to detect the corresponding endpoint.
The node initialization is mainly the initialization of the single-chip microcomputer, including the initialization of the port and the CAN control module. The MCU port initialization mainly resets the I/O ports used. The initialization of the CAN module is mainly to set the special function registers used, mainly including the protocol mode, the acceptance filtering method, the CAN communication rate and the setting of the interrupt register. Write the acceptance code and acceptance mask code to the acceptance code register and acceptance mask register.
The software design of CAN bus mainly includes the initialization of CAN nodes, data sending and receiving procedures, mastering the design of these three modules, basically completed the software design of CAN communication.
Although this node is designed to control the lights of buses, it can also be used as a reference for other nodes, especially the hardware interface part of the CAN bus, which can be used in other CAN network nodes in buses, and can even be used in CAN in other non-automotive fields. On the network, such as industrial automation and other fields.
The Links: SKKD105F12 CM300HA-12H