Design of Aging Test System Based on Automobile CAN Bus

Publisher:幸福花开Latest update time:2011-09-07 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction
The reliable operation and excellent performance of electronic equipment used in automobiles are related to the life safety of drivers. Before leaving the factory, automotive electronic equipment requires a long-term aging test on the internal circuit board of the equipment to detect whether the circuit board still works normally under high temperature environment and various input signal conditions. Only circuit boards that have passed the aging test can leave the factory. Due to the huge number of circuit boards that need aging tests, the system is required to be able to perform aging tests on many circuit boards at the same time, so this aging test system is designed. The entire aging test consists of 1 communication module, 10 test modules, 1 temperature control module and microcomputer software. The system structure diagram of this aging detection system is shown in Figure 1.



Figure 1 System Structure In this system, each detection module can detect up to 10 circuit boards at the same time, and there are 10 detection modules in total. Therefore, the entire system can detect 100 circuit boards at the same time in one aging detection process. The detection module sends the detection data to the communication module through CAN communication, and the communication module sends it to the host computer through serial communication. The host computer software parses the detection data, determines the working status of the tested circuit board, displays the working status of each tested circuit board, stores the detection data of each tested circuit board, and generates historical reports. The host computer software also provides the operator with a good and convenient human-computer interaction interface, through which the operator can set the system aging time, temperature and test mode.

1 Communication module design


The communication module is at the core of the aging system. It completes two tasks: on the one hand, it communicates with the host computer through serial asynchronous communication, receives control commands sent by the user through the host computer, and sends detection data to the host computer. On the other hand, it communicates with 10 detection modules and 1 temperature control module through CAN communication, sends commands to the detection equipment and collects data. The hardware system block diagram of the communication module is shown in Figure 2.


1.1 Hardware Design

The communication module uses C8051F040 as the core. C8051F040 has many advantages. 1. It uses a high-speed 8051 microcontroller core and pipeline structure. The execution time of most instructions is one or two system clock cycles.

2. It has 4352 bytes of internal RAM and 64K bytes of FLASH, which can meet the storage space needs of most application designs without the need for external memory, thus simplifying system design.

3. Configure multiple ports, such as SPI, SMBus and UART.

4. C8051F040 has a built-in standard CAN controller, which can communicate as long as an external CAN communication interface chip is connected, making it easy to implement CAN bus communication and improve communication reliability.

Since C8051F040 integrates a CAN controller, an external CAN bus transceiver is required to realize CAN bus communication. Commonly used CAN bus transceivers include Philips' PCA82C250 transceiver and high-speed TJA1050 transceiver. This design uses the TJA1050 high-speed CAN transceiver, which has the characteristics of low electromagnetic radiation, short circuit protection, and no effect on the bus when not powered on. In order to further improve the anti-interference ability of the system, the CAN controller pins CANTX and CANRX of C8051F040 are not directly connected to the transceiver TJA1050, but are connected to the TJA1050 through an isolation circuit composed of a high-speed optical coupler 6N137, so that the electrical isolation of each node on the CAN bus can be well achieved. Although adding an isolation circuit increases the complexity of the node, it improves the stability and security of the node. In addition, to avoid signal reflection, which may reduce the reliability and anti-interference ability of communication or even make communication impossible, two 120-ohm bus impedance matching resistors are required at both ends of the CAN bus. Since the port voltage of C8051F040 is 3.3V, the level conversion chip used in the serial communication circuit is MAX3232.


1.2 Software Design


1.2.1 Serial Communication Programming

On the one hand, the communication module receives commands from the host computer through serial communication. The main commands are start, stop and parameter setting commands. Users can set different parameters for the system through parameter setting commands to ensure the correct aging. On the other hand, the detected data is sent to the host computer through serial communication. To simplify the design, the serial communication between the communication module and the host computer adopts a fixed-length information frame format. One frame of information includes a frame header, valid data or command, CRC16 check bit, etc. The communication module receives information from the host computer through interrupts. In the interrupt service program, after receiving a frame header, it starts to receive the following bytes of information. After the CRC16 check is valid, it is considered to be a valid information frame. The information frame is parsed according to the agreed serial communication protocol, and the valid commands are taken out. Every time the communication module receives a valid command frame, it sends a frame of response information to the host computer. To ensure correct communication, the host computer software adopts a timeout mechanism for communication. If the host computer sends a


Due to the asynchronous speed of receiving and processing commands by the communication module, in order to ensure that each command sent by the host computer is executed, the valid command needs to be placed at the end of the command cache queue. The command cache queue adopts a ring structure, and the received valid commands are placed at the end of the queue, and the main program takes out a command from the head of the command cache queue for post-processing. In order to facilitate the storage or access of a command from the command cache queue, a two-dimensional array structure is used when implementing the command cache queue, that is, each element of the array is a valid command of a fixed length. By selecting an appropriate queue length, it can be ensured that the command cache queue will not overflow during normal operation. In this design, the data structure of the command cache queue is as follows:

unsigned char s_queue[QUEUE_LEN][CMD_PACK_LEN];
unsigned char s_front;
unsigned char s_rear;} [page]

When the communication module sends the detection data to the host computer, it assembles a complete set of detection data into an information frame according to the agreed serial communication protocol. To simplify the design, the information frame is sent in a query mode instead of an interrupt mode. To reduce the waiting time of C8051F040, the baud rate of serial communication is 57600bps in combination with the clock frequency of C8051F040. After field testing, serial communication at this baud rate did not cause communication errors.


1.2.2 CAN communication program design


The communication module is connected to 10 detection modules and 1 temperature control module through the CAN bus. Theoretically, on the CAN bus, any detection module can send detected data to the communication module, and the communication control board module can send commands to 10 detection modules at the same time. The data frame sent on the CAN bus carries an ID field. The value of the ID field determines the priority of each data frame. The smaller the ID value of the data frame, the higher the priority of the data frame. At the same time, different nodes on the CAN bus cannot send data frames with the same ID value. Otherwise, communication errors will occur. In this design, a fixed ID value is assigned to each detection module, which can be regarded as the address number of the device. In this way, the data frames sent by different devices have different priorities. This leads to a problem: if each detection module is allowed to actively send data frames to the communication module, the data frames with larger ID values ​​will not be sent due to low priority. In addition, the design of each detection module also uses C8051F040 as the control core, which completes signal detection on the one hand and completes CAN communication with the communication module on the other.

There are 32 buffers inside the CAN controller of C8051F040, each buffer is 8 bytes, and each buffer needs to be assigned a fixed ID value. Each buffer can be set as a send buffer or a receive buffer. When a buffer is set as a send buffer, the data frame has an ID value at the bottom layer. When the buffer is set as a receive buffer, only data frames with the same ID value on the CAN bus are received.


In the design, the 32 buffers and ID values ​​of the CAN controller of the communication module are assigned as follows: the 1st to 10th buffers are sending buffers, and the corresponding ID values ​​are 21 to 30. The 1st buffer is used to send data frames to the 1st detection module, and so on. The 10th buffer is used to send data frames to the 10th detection module. The 11th buffer is a sending buffer, and the corresponding ID value is 31, which is used to send data frames to the temperature control module. The 20th to 30th buffers are receiving buffers, and the corresponding ID values ​​are 50 to 60. Correspondingly, the 1st buffer in the 32 buffers of the CAN controller of the 10 detection modules is a receiving buffer, and the corresponding ID values ​​are 21 to 30 respectively. The 2nd to 11th buffers are all sending buffers, and the corresponding ID values ​​are 50 to 60. That is, the CAN data frames sent by the 10 detection modules have the same ID value. The reason for adopting the above allocation is that each detection module detects 10 circuit boards under test at the same time, and 10 data frames are sent to the communication module at the same time each time. Prerequisite: 10 detection modules cannot send data to the communication module at the same time.


The communication between the communication control board and the detection module adopts the master-slave response communication mode. During the working process, the communication module takes a command from the head of the serial port command buffer queue, performs protocol conversion, and assembles it into an 8-byte CAN information frame. The last byte value is set to the CRC8 check value of the first 7 bytes. Although the CAN bus itself has CRC check, it can improve the reliability of communication by checking it again at the application layer.

The communication module sends the CAN information frame through the first buffer inside the CAN, so that the first detection module on the CAN bus receives the information frame, and the detection module verifies the information frame. If it passes the verification, it further parses the information frame. If it is a parameter setting command, the detection device extracts the parameters therein and then sends an information frame to the communication module as a response. If it is a read data command, the parameters of the 10 tested circuit boards are assembled into 10 CAN data frames, which are respectively sent out through the 2nd to 11th buffers of the CAN buffer of the detection device. The 10 data frames are only received by the communication module on the bus and are placed in the 20th to 30th buffers respectively. The communication module sends this information to the host computer through the serial port. In the same way, the communication module completes CAN communication with the other 9 detection modules and 1 temperature control module, realizing the setting of commands and the acquisition of test information.

2 Design of detection module


The 10 detection modules of the aging system are exactly the same and perform the same functions. Based on the analysis of the characteristics of the circuit board under test, the detection module is designed to implement the detection method and process. The detection module first detects whether the circuit board under test has a short circuit fault or an open circuit fault. If the circuit board under test is found to have an open circuit fault or an open circuit fault, no further detection is performed and the fault information is sent during the communication process with the communication module. If the circuit under test does not have a short circuit fault or an open circuit fault, the detection module adds the rated working voltage and an effective excitation signal to the circuit board under test to make the circuit board under test work normally, and then detects the waveform type and frequency of the output signal of the circuit board under test, and determines whether the circuit board under test has other faults according to the set detection algorithm. During the test process of more than 100 hours, the temperature of the test environment can change continuously or automatically according to the user's settings, and the input excitation signal provided by the detection module adopts a variety of combinations.

3 Temperature control module design


During the aging process, the aged circuit board is placed in a closed cabinet. The temperature in the cabinet is kept within a certain range to simulate the temperature of the actual working environment of the circuit board. The temperature control module receives the information frame sent by the communication module through the CAN bus, parses the information frame, and obtains the temperature value to be set by the user. The temperature control module detects the cabinet temperature and controls whether the heating device is heated or not, so that the cabinet temperature reaches the temperature set by the user.


The temperature detection is completed by DS18B20, and 4 DS18B20 are set in the temperature control module. The 4 measured temperature values ​​are arithmetic averaged as the temperature value in the aging cabinet. The relay output of the temperature control module is connected to the heating rod and the exhaust fan. The PID control algorithm is used to make the temperature in the cabinet reach the user-set temperature. 4 Design of the host computer software The host computer software is designed using VC++ 6.0, and the serial port communication part is completed using Windows API functions. Using API functions to process serial ports is flexible and efficient. The host computer software displays in real time whether each circuit board under test is working normally and the current temperature and aging time of the aging cabinet, and also provides functions such as historical data query and parameter setting.

5 Conclusion


This aging test system uses CAN bus as the main communication method of the system, and adopts a modular structure to facilitate the design and debugging of the system. At the same time, each module is hung on the CAN bus, which is easy to implement and expand the system. This system has been applied in production, meeting the design requirements, and the operation effect is stable and good. This system has generated economic benefits of nearly 300,000 yuan.
The author's innovation: The detection module and communication module of this aging system use CAN bus for communication, and the communication is stable and high-speed; the entire system adopts a three-layer structure of detection module-communication module-host computer, which realizes the detection of large quantities of tested circuit boards.

If no response information is received from the communication module within a certain period of time after the frame command, the command information is sent again. If no response information is received for three consecutive times, it can be considered that there is a communication failure, and an alarm message will be generated to prompt the user to handle it.

Reference address:Design of Aging Test System Based on Automobile CAN Bus

Previous article:Research on floating vehicle traffic information collection system based on 3G technology
Next article:Principle and Application of New Digital Temperature Sensor ADT75

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号