Vehicle-mounted ECU diagnosis fault code testing method and system
By adding software fault test codes to the CAN interface module and fault diagnosis module of the on-board ECU, automatic injection and testing of fault codes are realized, solving the problem of low efficiency and high error rate of manual fault code transmission in the existing technology, and efficient and accurate fault code testing is achieved.
Patent Information
- Application Number
- CN202411830179.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, the number of internal fault codes corresponding to OEMs is large and needs to be sent manually, which has low efficiency and high error rate.
Provide a method and system for testing fault codes for diagnosis of on-board ECUs. By creating a software fault test case set, software fault test codes are added to the CAN interface module and fault diagnosis module of on-board ECU, and the fault codes are injected into the ECU, simulating the fault recovery process and generating a response message.
It realizes fast injection and automatic testing of fault codes, which is simple and convenient to use, accurate testing, and reduces the error rate.
Smart Images

Figure CN119644998A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of automobile software fault testing, and in particular relates to a vehicle-mounted ECU diagnostic fault code testing method and system. Background Art
[0002] DTC (Diagnostic Communication) is one of the important functions of the vehicle control system. It obtains the vehicle fault code through communication between the diagnostic instrument and the vehicle, and then determines the time and specific cause of the fault.
[0003] When a fault occurs in the vehicle's ECU, it will automatically record the fault and use protective measures to start an alternative program to maintain system operation. At the same time, the ECU can store the fault problem in the form of code in the computer or display the fault information on the dashboard and keep it on for a long time for repair personnel to read it using professional equipment.
[0004] As automobile functions and configurations become increasingly rich, the number of on-board ECUs is also increasing, and the interactions between on-board ECUs through the bus are becoming more frequent. When the normally received bus signal on an on-board ECU is lost or invalid, the on-board ECU will record and report the problem in the form of a diagnostic trouble code according to the rules. Under single-node conditions, it is necessary to simulate related bus faults and perform logical rationality tests on the network DTCs recorded by the ECU.
[0005] In the prior art, there are a large number of internal fault codes corresponding to OEMs (original equipment manufacturers), which need to be sent manually, with low efficiency and high error rate. Summary of the invention
[0006] The purpose of the present invention is to provide a vehicle-mounted ECU diagnostic fault code testing method and system to solve the problem in the prior art that there are a large number of internal fault codes corresponding to OEMs, which need to be sent manually, have low efficiency and high error rate.
[0007] To this end, the present invention provides a vehicle-mounted ECU diagnostic fault code testing method and system, comprising the following steps:
[0008] Create software failure test case suite;
[0009] Add software fault test code to the CAN interface module and fault diagnosis module in the vehicle ECU;
[0010] Inject the data in the software fault test case set into the vehicle ECU through the software fault test code to complete the fault injection;
[0011] Simulate the fault recovery process and generate response messages.
[0012] Preferably, the creation of a software fault test case set includes an OEM diagnostic questionnaire, an internal diagnostic questionnaire, a fault level, and whether a fault light is on.
[0013] Preferably, the step of injecting the data in the software fault test case set into the vehicle-mounted ECU through the software fault test code to complete the fault injection includes:
[0014] Traverse the OEM internal fault numbers in the OEM diagnostic questionnaire and clear historical faults;
[0015] Traverse the fault codes in the internal diagnostic questionnaire, execute the software fault test code, and input the fault codes into the fault diagnosis module.
[0016] Preferably, the executing software fault test code and inputting the fault code into the fault diagnosis module comprises:
[0017] When the CAN interface module detects that the CanID meets the conditions, the CAN interface module changes the flag bit to enable the fault diagnosis module to receive the current fault;
[0018] The fault diagnosis module performs fault detection periodically and determines whether the fault code is passed or failed when a fault code is received.
[0019] Preferably, the simulating the fault recovery process and generating test data includes:
[0020] The fault diagnosis module simulates the fault recovery process, tests the fault handling and recovery capabilities, and generates response messages.
[0021] Preferably, the software fault test code is cleared after the simulated fault recovery process is completed.
[0022] Preferably, a test conclusion is drawn based on the response message and recorded in a software fault test case set to form a test report.
[0023] Preferably, the test results in the test report are evaluated for accuracy.
[0024] Preferably, the evaluating the accuracy of the test results in the test report includes: verifying the test results against expected results and expected logical mechanisms to evaluate the accuracy of the test results.
[0025] A vehicle-mounted ECU diagnostic fault code testing system, used to implement a vehicle-mounted ECU diagnostic fault code testing method, comprising:
[0026] CAN interface module, used to control the connection or disconnection of the CAN bus interface;
[0027] Fault diagnosis module, which communicates with external systems via the CAN bus to perform fault simulation, fault code reading and clearing;
[0028] A storage module, used for storing data;
[0029] Fault injection setting module, used to set fault code parameters and environment variables.
[0030] Beneficial effects:
[0031] 1. The present invention provides a method and system for testing diagnostic fault codes of an on-vehicle ECU. The method does not require modification of the operating logic of the source code. The fault code is injected into the on-vehicle ECU through the software fault test code to complete rapid fault injection and automatic testing. The method is simple and convenient to use and the test is accurate.
[0032] 2. The software fault test code changes the flag bit of the CAN interface module according to the CanID, so that the fault diagnosis module can receive the fault code and determine whether it fails or passes according to the identifier of the fault code, thereby realizing the detection and analysis of the fault. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 The present invention is a method flow chart of a vehicle-mounted ECU diagnostic fault code testing method.
[0035] Figure 2 The system structure diagram of a vehicle-mounted ECU diagnostic fault code testing system in the present invention. DETAILED DESCRIPTION
[0036] The content of the present invention can be more easily understood by selecting the following detailed description of the preferred implementation method of the present invention and the embodiments included. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those of ordinary skill in the art to which the present invention belongs. When there is a conflict, the definition in this specification shall prevail.
[0037] Embodiment 1:
[0038] like Figure 1 As shown, this embodiment provides a vehicle ECU diagnostic fault code testing method and system, including the following steps:
[0039] S1. Create a software fault test case set;
[0040] The software fault test case set is created including the OEM diagnostic questionnaire, the internal diagnostic questionnaire, the fault level and whether the fault is on. The OEM diagnostic questionnaire contains the OEM internal fault number, the internal diagnostic questionnaire contains the fault code, and the fault level is the fault level of the fault code, such as Class A fault or Class B fault.
[0041] S2. Add software fault test code to the CAN interface module and fault diagnosis module in the vehicle ECU;
[0042] S21. Add a software fault code in the CAN interface module to control the flag bit of the CAN interface module as a basis for the fault diagnosis module to receive the fault code.
[0043] When the CAN interface module detects that the CanID meets the conditions, the CAN interface module changes the flag bit so that the fault diagnosis module receives the current fault;
[0044] In this embodiment, the following code is added to the CAN interface module:
[0045] if(Mailbox->CanId == 0x7B3)
[0046] {
[0047] uint8 DEMTestData[8]={0,0,0,0,0,0,0,0};
[0048] PduInfoType DEMTestPdu;
[0049] {
[0050] DEMEventNoUpdateFlag = 1;
[0051] DEMtestEventNo_0=PduInfoPtr->SduDataPtr[0];
[0052] DEMtestEventNo_1=PduInfoPtr->SduDataPtr[1];
[0053] DEMtestEventNo=(((uint16)DEMtestEventNo_0<<8))+DEMtestEventNo_1;
[0054] DEMEventFail1PASS0=PduInfoPtr->SduDataPtr[3];
[0055] }
[0056] Among them, the if statement is used to determine whether CanID is equal to 0x7B3. If the condition is met, the subsequent code is executed to change the flag bit so that the fault diagnosis module can receive the fault code.
[0057] Here, CanID is not forced to be a fixed value. In this embodiment, the subsequent global variables of the entire project are changed as little as possible, so the CAN_RX_ID_EOL of the EOL development frame ID is selected for testing. S3. Inject the data in the software fault test case set into the vehicle ECU through the software fault test code to complete the fault injection;
[0058] The local variables DEMTestData and DEMTestPdu represent an array containing 8 uint8 elements initialized to zero and an instance of the PduInfoType type, respectively, which are used in subsequent codes.
[0059] The code in the if block sets variables based on the data in PduInfoPtr->SduDataPtr, which contains the signal data received via the CAN bus; its purpose is to change the flag DEMEventNoUpdateFlag to 1 so that the fault diagnosis module can receive the fault code.
[0060] S22, the fault diagnosis module periodically performs fault detection, and when a fault code is received, determines whether the fault code is passed or failed.
[0061] In this embodiment, the following code is added to the fault diagnosis module:
[0062] uint16 DEMtestEventNo;
[0063] uint8 DEMEventNoUpdateFlag;
[0064] uint8 DEMEventFail1PASS0;
[0065] void Mainfunction_Fault_Detect1ms(void)
[0066] {
[0067] if(PowerSupplyNormal()==1U&&(DEMtestEventNo<=DTCID_Internal_MaxNum))
[0068] {
[0069] DEM_FltDtctCntr(DEMtestEventNo,DEMEventFail1PASS0,0U);
[0070] }
[0071] else
[0072] {
[0073] }
[0074] }
[0075] Among them, void Mainfunction_Fault_Detect1ms means that the fault detection function is executed every 1 millisecond;
[0076] DEMtestEventNo represents the identifier of the fault code, and the DEMEventFail1PASS0 flag indicates whether the diagnostic event failed (1) or passed (0), which determines the MonitorStatus parameter passed to DEM_FltDtctCntr. When MonitorStatus is MonStatHold, the value passed to DEM_FltDtctCntr is 0U.
[0077] S3, injecting the data in the software fault test case set into the vehicle ECU through the software fault test code to complete the fault injection;
[0078] S31, traverse the OEM internal fault numbers in the OEM diagnosis questionnaire, and clear the historical faults; first initialize the historical faults through the OEM internal fault numbers.
[0079] S32, traversing the fault codes in the internal diagnosis questionnaire, executing the software fault test code, and inputting the fault codes into the fault diagnosis module.
[0080] S4. Simulate the fault recovery process and generate a response message.
[0081] The fault diagnosis module simulates the fault recovery process, tests the fault handling and recovery capabilities, and generates response messages.
[0082] S5. After the simulated fault recovery process is completed, the software fault test code is cleared. After the test is completed, the software fault test code can be cleared without affecting the operation of the software code of the vehicle-mounted ECU itself.
[0083] S6. Draw a test conclusion based on the response message and record it in the software fault test case set to form a test report.
[0084] The test conclusion is recorded in the test report in the form of a chart or a log message.
[0085] S7. Evaluate the accuracy of the test results in the test report.
[0086] Evaluating the accuracy of the test results in the test report includes: cross-checking the test results with the expected results and the expected logical mechanism, and evaluating the accuracy of the test results.
[0087] like Figure 2 As shown, a vehicle-mounted ECU diagnostic fault code testing system is used to implement the vehicle-mounted ECU diagnostic fault code testing method, comprising:
[0088] CAN interface module, used to control the connection or disconnection of the CAN bus interface;
[0089] Fault diagnosis module, which communicates with external systems via CAN bus and is used to perform fault simulation, read and clear fault codes;
[0090] A storage module, used for storing data;
[0091] Fault injection setting module, used to set fault code parameters and environment variables.
[0092] It also includes a host computer, which is a computer or device that controls or monitors the vehicle-mounted ECU. In this embodiment, the host computer is a diagnostic instrument that exchanges diagnostic data with the vehicle-mounted ECU.
[0093] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A vehicle-mounted ECU diagnostic fault code testing method, characterized in that: The steps include: Create software failure test case suite; Add software fault test code to the CAN interface module and fault diagnosis module in the vehicle ECU; Inject the data in the software fault test case set into the vehicle ECU through the software fault test code to complete the fault injection; Simulate the fault recovery process and generate response messages.
2. A vehicle-mounted ECU diagnostic fault code testing method according to claim 1, characterized in that: The software fault test case set is created to include an OEM diagnostic questionnaire, an internal diagnostic questionnaire, a fault level, and whether a fault light is on.
3. A vehicle-mounted ECU diagnostic fault code testing method according to claim 2, characterized in that: The method of injecting the data in the software fault test case set into the vehicle ECU through the software fault test code to complete the fault injection includes: Traverse the OEM internal fault numbers in the OEM diagnostic questionnaire and clear historical faults; Traverse the fault codes in the internal diagnostic questionnaire, execute the software fault test code, and input the fault codes into the fault diagnosis module.
4. A vehicle-mounted ECU diagnostic fault code testing method according to claim 3, characterized in that: The executing software fault test code and inputting the fault code into the fault diagnosis module comprises: When the CAN interface module detects that the CanID meets the conditions, the CAN interface module changes the flag bit to enable the fault diagnosis module to receive the current fault; The fault diagnosis module performs fault detection periodically and determines whether the fault code is passed or failed when a fault code is received.
5. A vehicle-mounted ECU diagnostic fault code testing method according to claim 4, characterized in that: The simulating fault recovery process and generating test data comprises: The fault diagnosis module simulates the fault recovery process, tests the fault handling and recovery capabilities, and generates response messages.
6. A vehicle-mounted ECU diagnostic fault code testing method according to claim 1, characterized in that: Clear the software fault test code after the simulated fault recovery process is completed.
7. A vehicle-mounted ECU diagnostic fault code testing method according to claim 1, characterized in that: The test conclusion is drawn based on the response message and recorded in the software fault test case set to form a test report.
8. A vehicle-mounted ECU diagnostic fault code testing method according to claim 7, characterized in that: Evaluate the accuracy of test results in test reports.
9. A vehicle-mounted ECU diagnostic fault code testing method according to claim 8, characterized in that: The evaluating the accuracy of the test results in the test report includes: verifying the test results with expected results and expected logical mechanisms to evaluate the accuracy of the test results.
10. A vehicle-mounted ECU diagnostic fault code test system, characterized in that: A vehicle-mounted ECU diagnostic fault code testing method for implementing any one of claims 1 to 9, comprising: CAN interface module, used to control the connection or disconnection of the CAN bus interface; Fault diagnosis module, which communicates with external systems via the CAN bus to perform fault simulation, fault code reading and clearing; A storage module, used for storing data; Fault injection setting module, used to set fault code parameters and environment variables.