Development of automotive CAN bus data recorder

1 Introduction

This article refers to the address: http://

Since the 1980s, with the continuous development of automotive electronics technology, there are more and more electronic control units on automobiles, such as electronic fuel injection devices, anti-lock braking devices (ABS), airbag devices, and electronically controlled door and window devices. And active suspension and more. In this case, if the traditional point-to-point parallel wiring method is still adopted, the number of wires on the car will increase sharply, the wiring becomes more and more difficult, the wire quality accounts for more and more the quality of the whole vehicle, and the complicated circuit is also reduced. The reliability of the car increases the difficulty of maintenance. In order to meet the rapidly increasing application needs of automotive electronic equipment, the controller area network CAN came into being. At present, in the field of automotive design, CAN has almost become a technical means that must be adopted, especially in Europe, such as BENZ, BMW, etc., using CAN bus to realize the internal control system of the vehicle and each detection and execution. Inter-agency data communication [1]. The car CAN bus data recorder can collect the CAN CAN bus data information in real time. Its development is of great significance for familiarizing and mastering the communication protocol and information content of the car CAN bus, and for the application research of automobile fault repair and automotive network technology.

2, CAN bus introduction

CAN is the abbreviation of Controller Area Network, which was developed by Bosch and several semiconductor manufacturers in Germany. CAN bus is a serial multi-master controller LAN bus. It has high network security, communication reliability and real-time performance, and is simple and practical, and the network cost is low. It is especially suitable for automotive computer control systems and industrial environments with harsh ambient temperatures, strong electromagnetic radiation and high vibration. The CAN bus can effectively support distributed control or real-time control. The communication medium of the bus can be twisted pair, coaxial cable or fiber [2-3]. Its main features are as follows:

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

• The CAN bus uses a unique non-destructive bus arbitration technology, and high-priority nodes preferentially transmit data, so the real-time performance is good;

• CAN bus has the function of transmitting data in point-to-point, point-to-multipoint and global broadcast;

• CAN bus adopts short frame structure, the maximum number of valid bytes per frame is up to 8, the data transmission time is short, and there are CRC and other verification measures, and the data error rate is extremely low;

• When a node on the CAN bus has a serious error, it can automatically leave the bus, and other operations on the bus are not affected;

• When the CAN bus system is expanded, the new node can be directly hung on the bus, so the wiring is small, the system is easy to expand, and the modification is flexible;

• The maximum transmission rate of the CAN bus can reach 1Mb/s, and the direct communication distance can reach up to 10km (the rate is below 5kbps);

• The number of nodes on the CAN bus depends on the bus driver circuit. Up to 110 in standard frames (11-bit message identifiers) and unlimited in extended frames (29-bit message identifiers).

3, CAN bus data recorder hardware design

When the CAN bus data logger is working, it should be connected to the CAN bus of the car to become a CAN node to collect CAN data information. The system hardware structure adopts the circuit structure shown in FIG. The core modules are described below.

11.jpg

Figure 1 Block diagram of CAN bus data logger

(1) Main control module (MCU)

The main control module of this system adopts AT89C52 of ATMEL company. It is a low-power, high-performance 8-bit CMOS microcontroller with 8KB of flash memory and is fully compatible with industry standard MCS-51 instruction systems and pins. The superiority of the AT89 series is that its on-chip flash memory can be programmed and erased 1000 times, and the data is not easily lost, and the data can be stored for 10 years.

(2) Data storage circuit

The CAN bus data transmission rate is high, and the single-chip microcomputer has a slow operation speed and heavy tasks. To ensure that data is not lost during data acquisition, the microcontroller externally expands the data memory. When the CAN module receives a frame of data on the CAN bus of the car and causes the MCU to interrupt, the interrupt service routine stores the received data to the external data memory and immediately interrupts the return. The cumbersome work of processing and displaying the data is completed in the main program. . In this way, the integrity and real-time performance of CAN bus data reception is ensured.

(3) Human machine interface module

The CAN bus data logger uses OCMJ5×10B Chinese liquid crystal display module to display information and received data. The module contains dot matrix national standard simplified Chinese characters and ASCII code, which can realize text display. Its user hardware interface uses REQ/BUSY handshake protocol, which is simple and reliable. BUSY is active high, indicating that OCMJ is busy and cannot accept commands; when BUSY=0, it indicates that OCMJ is idle [4]. At the same time, when REQ=1, the OCMJ is notified to process the data on the current data line. The system uses the single-chip microcomputer P1.6 and P1.7 as the communication port with the REQ and BUSY of the liquid crystal display module.

This system mainly has settings, increase and decrease buttons. Key input is realized by using single chip microcomputer P1.0-P1.2.

(4) Communication module

The CAN bus data received by the CAN bus data recorder can be displayed in real time on the liquid crystal display, or can be transmitted to the host computer for display or data processing and data analysis by using the serial communication interface. The system uses the level conversion chip MAX232 to realize the serial data communication between the single chip and the PC.

(5) CAN module

The CAN controller used in this system is SJA1000. SJA1000 is a CAN controller manufactured by PHILIPS that supports both CAN 2.0B and CAN 2.0A. The CAN transceiver used with the SJA1000 is the PCA82C250, which is a CAN controller and physical bus interface chip from PHILIPS that provides differential transmission and reception to the bus. It is fully compatible with the ISO 11898 standard and has three different modes of operation: high speed, slope control and standby, which can be selected according to the actual situation. The basic method of CAN module bus controller and bus driver connection is shown in Figure 2. In order to enhance the anti-interference ability of the CAN bus node, the SJA1000 is connected to the 82C250 through the high-speed optocoupler 6N137, which is a good way to achieve electrical isolation between the system and the car CAN bus [5]. The power supply is isolated using a low power power isolation module. Although these parts increase the complexity of the interface circuit, they improve the stability and security of the system.

The interface between the 82C250 and the CAN bus also uses certain safety and anti-interference measures. The CANC and CANL pins of the 82C250 are each connected to the CAN bus through a 5Ω resistor. The resistors can be used to limit the current and protect the 82C250 from overcurrent. The 30pF capacitor connected between CANH and CANL and ground can filter high frequency interference on the bus and improve the ability to prevent electromagnetic radiation. The lightning protection tube can eliminate transient interference between input and ground. The RS pin of the 82C250 is connected with a slope resistor. The size of the resistor can be adjusted according to the bus speed, generally between 16 and 140 kΩ.

22.jpg

Figure 2 CAN bus controller, bus driver circuit connection diagram

4, CAN bus data recorder software design

CAN bus data logger software design requirements are simple, practical, efficient, and easy to expand. The system program is mainly composed of a main module, a CAN bus controller initialization module, and an interrupt processing module. The main module mainly completes tasks such as initialization of the microcontroller, key value processing, and data display. Among them, the key value processing mainly changes the CAN data receiving baud rate according to the key value; the data display is to display the CAN bus data stored in the external data memory frame by frame.

The CAN bus controller initialization module is used for the initialization of the SJA 1000 bus controller [6]. For example, set the command register (CR) to open receive, error, overload interrupt, set the reset request bit; set the acceptance code register (ACR) and acceptance mask register (AMR); set the output control register to select the output mode and establish the output driver configuration. Wait. For CAN bus data message reception, the acceptance filter is set by writing to ACR and AMR. If a message passes the test of the acceptance filter and the receive buffer has space, the complete message can be received correctly. Passing the filter test means that the message identification code height 8 bits (ID.10~ID.3) and the acceptance code bits (AC.7~AC.0) must be equal, and these bits are the acceptance mask bits (AM. The corresponding bits of 7~AM.0) are masked. That is, if one of the following two equations is satisfied, the message is received.

(ID.10 to ID. 3) = (AC.7 to AC. 0) (1)

(AM.7~AM .0)=11111111B (2)

The purpose of the CAN bus data logger is to receive all messages of the CAN bus data, so the AMR register initialization setting should satisfy equation (2).

The interrupt module identifies different interrupt sources by judging the states of the IR registers and performs corresponding processing. For the receive interrupt, the data received by the receive buffer should be stored in the external data memory, and the interrupt should be immediately jumped out to perform the processing of the main program or wait for the reception of the next frame of data to be interrupted, thereby avoiding the loss of the message.

Whether the CAN bus data logger can smoothly receive CAN data, the design of the initialization module program is the key. Due to the modular programming method, the system program has high efficiency and flexible use, which is beneficial to the upgrade of intelligent measurement and control nodes.

5, CAN bus data recorder application examples

The popular car system CAN-BUS commonly has a comfortable CAN bus, a power CAN bus, etc., taking the comfort system CAN bus as an example to illustrate the use of the CAN bus data logger. The comfort system CAN data transfer has five functions [7]: central door lock, power window, light switch, mirror heating and self-diagnosis function. Before data acquisition, first determine the data transmission baud rate, connect the CAN-L cable to the digital storage oscilloscope, and observe the voltage signal on the CAN-L on the oscilloscope as shown in Figure 3.

33.jpg

Figure 3 CAN-L voltage signal

As can be seen from the figure, the bit time is 16.0 μs, and the bit rate can be calculated as follows:

33x.jpg

Use the button to set the baud rate of the CAN bus data logger. Connect the recorder test terminals to the CAN-H and CAN-L lines of the CAN bus of the comfort system respectively, and turn on the ignition switch. The received data is shown in Table 1.

Table 1 Data received when the ignition switch is turned on

1.jpg

It can be seen from Table 1 that the car comfort system based on CAN bus has the following characteristics:

1. The first position of the IDs of the five nodes is 1, so the comfort system communication data is non-real-time data;

2. The order of the five node IDs from small to large is the central control unit, the left front gating unit, the right front gating unit, the left rear gating unit, and the right rear gating unit. The priority of the network is also the same;

3. The central control unit and the left front gating unit have more control objects, the data length code is 5, the right front gating unit data length code is 3, and the others are 2;

The CAN bus data logger can be used to further collect and analyze other CAN bus data.

6 Conclusion

The portable car CAN bus data recorder has many outstanding advantages: it is suitable for use in the automotive sports environment; it adopts the modular design of general components and software; it can collect the CAN bus data of the car in real time, and the test shows that the system has high working stability. The collected data can be uploaded to the PC through the serial communication interface of the instrument [8], and the data processing and analysis can be completed by using the analysis software of the PC, and the function will be more powerful.

references

[1] Gabriel Leen, Dond Heffernam, and Alan Dunne. Digital Networks in the Automotive Vehicle [J], IEEE Computing & Control Engineering journa1, 1999, (10) 6.

[2] Rao Yuntao, Zou Jijun, Zheng Yongwei. Principle and Application Technology of Fieldbus CAN[M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2003:22-34

[3] Zou Kuanming. CAN bus principle and application system design [M]. Beijing: Beijing Airlines and Aeronautics University Press. 1996: 30-34

[4] Jinpeng Technology Co., Ltd. OCMJ Chinese module LCD display instruction manual [Z]

[5]Liu Wei. Application of Independent CAN Device SJA1000[J]. Journal of Nanjing Institute of Technology, 2002(1): 33-34

[6]Lü Decai, Ma Feng. Principle and Application of CAN Bus Controller SJA1000[J].Electrical Measurement & Instrumentation,2002(4):57-58

[7] Zhu Jianfeng, Li Guozhong. Principle and Maintenance of Common Cars CAN-BUS [M]. Beijing: Mechanical Industry Press, 2006: 100-102

[8] Wang Jie, Su Donglin, Wang Bingqi. Design of CAN Recorder[J]. Electronic Measurement Technology, 2006(1): 14-15

Outdoor Power Supply(1200W 1120Wh)

Outdoor power supply, also known as portable energy storage battery, is a device that uses high energy density lithium-ion battery pack as a means of energy storage to provide power supply for users when they are unable to access power. Outdoor power supply can provide power support for almost all electrical equipment. It has larger capacity, supports 220V AC output, USB fast charging output, vehicle cigarette lighter output port, DC output port, lighting flashlight, and even wireless charger and other functions, so as to provide users with more ways of power security as far as possible.

energy storage, power supply, lithium-ion battery, portable lithium battery, DC AC output

Wolong Electric Group Zhejiang Dengta Power Source Co.,Ltd , https://www.wldtbattery.com