“As a window for communication between the vehicle and the driver, the car instrument is responsible for providing the driver with the task of providing vehicle operating conditions in real time. Automotive instrumentation is one of the focuses of automotive electronics application research in vehicles. With the promotion of the Euro III emission standard in China, the engine and the bus-type digital instrument that communicate with the Euro III emission standard with a controller area network (CAN) bus interface are also gradually expanding the market. With the development of vehicle bus technology, automotive digital instruments with CAN bus interface are widely used.
Authors: Fu Yixuan, Wang Jian
As a window for communication between the vehicle and the driver, the car instrument is responsible for providing the driver with the task of providing vehicle operating conditions in real time. Automotive instrumentation is one of the focuses of automotive electronics application research in vehicles. With the promotion of the Euro III emission standard in China, the engine and the bus-type digital instrument that communicate with the Euro III emission standard with a controller area network (CAN) bus interface are also gradually expanding the market. With the development of vehicle bus technology, automotive digital instruments with CAN bus interface are widely used. The application layer SAE J1939 protocol is currently the most widely used CAN bus application layer protocol in the domestic automotive industry.
The car digital instrument based on CAN bus proposed here uses CAN bus to make it a part of the body network, and follows the SAE J1939 protocol to read the engine speed, water temperature and other information. Taking into account the actual condition of the vehicle, the car digital instrument can also receive and Display signals such as vehicle speed, fuel volume, oil pressure, and brake air pressure from sensors, providing drivers with real-time vehicle conditions.
2 Introduction to SAE J1939 protocol
The SAE J1939 protocol is a vehicle network serial communication and control protocol released by the American Society of Automotive Engineers (SAE (Society of Automotive Engineer)) with CAN2.0B as the network core protocol. The SAE J1939 protocol uses the CAN data frame to encapsulate its data information, and encodes the 29-bit identifier of the CAN extended frame to form a unique encoding system as a vehicle communication standard. The protocol clearly specifies the address configuration, naming, communication method and message sending priority of the ECU inside the car, and details the specific ECU communication content inside the car. Realize high-speed data transmission between vehicle Electronic devices, reduce the number of lines, and maximize the use of the superior performance of the CAN bus.
2.1 SAE J1939 message format
The SAE J1939 data frame is based on PDU (Protocol Data Unit) and consists of priority (P), reserved bit (R), data page (DP), PDU format (PF), PDU detail (PS), source address ( SA) and data field (Date Field) and other 7 fields. The PDUs other than the data field correspond to the 29-bit identifier of the CAN extended frame, and the corresponding relationship is listed in Table 1. where PS is an 8-bit segment whose definition depends on the PF value. If the PF value is less than 240, PS is the destination address (DA). If the PF value is between 240 and 255, the PS is group extension (GE).
2.2 SAE J1939 application layer
The application layer defines each parameter used in the SAE J1939 protocol in detail, including data length, data type, result, range, and parameter group number (PGN). These parameters are divided into control parameters, powertrain status parameters, powertrain control parameters, powertrain configuration parameters, information parameters, and information status parameters. SAE J1939 uses the parameter group number (PGN) as the unique label for a parameter group. The tag includes: reserved bits (R), data pages (DP), PDU format field (PF 8 bits) and group extension field (GE 8 bits). In addition, when the PF value is less than 240, the PGN low byte position is 0. Each parameter in the parameter group can be represented by ASCII code, and its state quantity can be represented by at least two bits. Alphanumeric data is transmitted MSB first, and other parameters consisting of two or more data bytes are transmitted LSB first. In addition, the parameter group attribute is also defined in detail in the application layer. The parameter group attribute includes: priority, update rate, protocol data unit format of the parameter group, parameter group number, data parameter number of the parameter group and its position in the parameter group.
3 Design of car digital instrument system based on CAN bus
3.1 Hardware circuit design
The car digital instrument system consists of modules such as signal acquisition and processing display, as shown in Figure l. By dividing the voltage of the analog signal, filtering and shaping the pulse signal, the CAN bus signal is sent to the central processing unit through the transceiver, and then the processed signal is controlled by the stepping motor controller to control the stepping motor to drive the LCD display. The signal acquisition module includes CAN bus data acquisition and sensor data acquisition. In the actual vehicle environment, the system design follows the SAE J1939 protocol to obtain the engine speed, water temperature and fault codes on the CAN bus, while other information including vehicle speed, oil quantity, oil pressure, and brake air pressure are obtained from the corresponding sensors in analog and Read in the form of pulse quantity. The vehicle speed signal is obtained by measuring the pulse signal of the vehicle speed sensor, and the signal of the fuel quantity sensor is directly sent to the A/D converter in the central processing unit after being divided into pressure.
Figure 2 shows the signal acquisition module circuit. In the figure, a general-purpose CAN transceiver CTM825lT with isolation is used to receive the CAN bus signal. CTM8251T integrates all the necessary CAN isolation and CAN transceivers, which can realize the transceiver and isolation functions of CAN nodes, thus replacing the traditional design with optocouplers, DC-DC isolation, CAN transceivers and other components with isolation functions. CAN transceiver circuit. The module circuit can convert the logic level of the CAN controller to the differential level of the CAN bus, and has the isolation function of DC 2 500 V. The circuit design of the module is small in size and high in integration, and can replace traditional CAN bus transceivers such as PCA82C25l and its peripheral circuits, thereby reducing system design costs. The sensor analog signal is transmitted to the central processing unit through voltage division. The two components VD40 and C40 in the figure can provide overvoltage protection to the pins of the microcontroller LM3S2948.
The LM3S2948 type microcontroller completes the signal processing. It is a microcontroller based on ARM CortexM3 core, using 32-bit RISC, embedded CAN controller, A/D converter, analog comparator, I2C interface and other functional modules, which greatly reduces the cost of peripheral circuit design. The LM3S2948 microcontroller has the characteristics of fast operation speed, low power consumption, small size and low price. The CAN controller module of LM3S2948 supports the CAN 2.0B protocol and the message transmission of the extended frame in accordance with the SAE J1939 protocol. Its transmission rate can be programmed to be set to 1 Mb/s. These characteristics fully meet the application requirements of the CAN bus car digital instrument. . The shift register 74HC595 is used to realize the serial input and output of the signal, and the stepper motor driver VID6606 is used to drive the needle. Each VID6606 can drive four stepper motors at the same time. Input the pulse sequence F (SCX) at its frequency control terminal, then the output terminal can be controlled to make the output shaft of the stepping motor rotate in micro-steps, each pulse rotates 1/12° corresponding to the output shaft of the motor, and the maximum angular velocity can reach 600°/ s, to meet the requirements of high precision and fast response for automotive instrumentation instructions. The needle is driven by a stepping motor VID-29. Figure 3 is the VID6606 drive instrument circuit. The LCD driver adopts PCF8566, which integrates the necessary functional circuits of the LCD driver. Can directly drive any static LCD or LCD with 4 back poles up to 24 segments. The signal sent by the central processing unit is first amplified by the PCF8566T power, and then sent to the LCD screen F2000LCD for display.
3.2 Software Design
The car digital instrument system software is written by IAR programming and debugging software. The software is connected with the JTAG port of LM3S2948 through the LM-LINK debugging emulator to realize online emulation debugging.
The data receiving and processing software first initializes the system clock, CAN node, LCD liquid crystal screen, stepping motor, etc., and enables CAN interrupt, and sets the CAN mask code and acceptance code. The specific steps of initializing the CAN node: ① Encapsulate the relevant information of the CAN node, and create a software CAN node structure pointer pCAN_Node_info; ② Initialize the CAN controller; ③ Interrupt the CAN controller; ④ Set the CAN node reception filter. After initialization, the CAN bus and other sensor signals are read. Control the stepper motor and the LCD screen to display the processed data. Wait for the CAN bus reception interrupt to be generated, and judge whether the bus data meets the masking condition, that is, compare the received 29-bit identifier message bit by bit with the acceptance code and mask code value, and the mask code is used to locate the relevant bit (0=relevant, 1=not related). Only the relevant bits in the identifier are the same as the corresponding bits of the acceptance code, the system will receive the message. If the mask conditions are met, the data is read from the register and stored in the buffer area, and then the engine speed, water temperature and fault code information are judged and calculated according to the SAE J1939 protocol, and transmitted to the stepper motor and LCD screen for display. For example: the received data is: OCF00400 XX XX XX 4F 55 XX XX XX (XX is any data), if the acceptance code is set to Ox00000000 and the mask code is 0xlFFFFFFF, the message will be received. According to SAEJl939-71 agreement, this message is: PGN61444 an electronic engine controller. Therefore, it can be obtained that the 4th and 5th bytes are the engine speed, and follow the transmission mode of low order and high order, then engine speed = original number × resolution + offset = 21 831 × 0.125 + 0 = 2 728.875 r/m. In the same way, the required values of other automobile instruments can be calculated. Fig. 4 is the flow chart of CAN bus data receiving procedure.
On the basis of studying the automobile CAN bus communication protocol and SAE J1939 protocol, the design of automobile digital instrument system based on CAN bus is realized. The system design utilizes the functions of LM3S2948, CTM8251, VID6606 and other devices to minimize the cost of peripheral circuits. The car’s digital instrument system works stably and has good performance, and is currently undergoing a loading test. With the promotion of Euro III emission standards in China, digital instruments based on CAN bus will surely enter a new stage of rapid development.