An automated test method for on-board diagnosis based on CAN bus

Through the automated testing method based on the CAN bus, the efficiency and accuracy problems in the vehicle system network fault diagnosis test are solved, the automated testing and report generation of multiple diagnosis types are realized, a variety of hardware is supported, and the testing cost and time are saved.

CN118337648BActive Publication Date: 2024-09-24CHANGZHOU XINGYU AUTOMOTIVE LIGHTING SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410751580.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-24
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

Existing in-vehicle system network fault diagnosis and testing methods are inefficient, especially in terms of node loss diagnosis and check code calculation. There are accuracy and efficiency problems, and different automation codes need to be written for different hardware, resulting in a waste of test costs and time.

Method used

Using the automated test method based on the CAN bus, the automated test system performs node loss diagnosis, checksum verification failure and CRC verification failure testing, generates test reports, and supports a variety of CAN test tools to achieve fully automated testing and reduce manual calculations. and code porting.

Benefits of technology

It achieves accurate testing of the triggering time of node loss diagnosis, with the error controlled within 20ms, quickly calculates the check code, and generates detailed test reports, saving testers time and costs, and supports a variety of hardware with high compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118337648B
    Figure CN118337648B
Patent Text Reader

Abstract

The present invention discloses an on-board diagnostic automation test method based on CAN bus, which belongs to the field of on-board system network fault diagnosis test, and comprises: step S1, a test PC runs an automated test system executable file to complete test preparation; step S2, a node loss diagnosis test, a checksum verification failure diagnosis test and a CRC verification failure diagnosis test are performed; step S3, a test report is generated. The present invention provides an on-board diagnostic automation test method based on CAN bus, which is compatible with a variety of CAN test tools, can perform node loss diagnosis precise trigger time verification, perform CRC and checksum verification code calculation, automatically generate test results and mark the cause of the error, and form a test report. Fully automated testing is performed, which greatly saves the time of testers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an on-board diagnosis automatic test method based on a CAN bus, and belongs to the field of on-board system network fault diagnosis test. Background Art

[0002] At present, when testing the vehicle system network fault diagnosis code, in addition to the types that require external hardware triggers such as high and low voltage, the vehicle diagnosis can also be divided into three types according to the trigger type: 1. Node loss, 2. Verification failure (checksum verification or CRC verification), 3. Fault location 1. For the diagnosis type of fault location 1, when the bit representing the fault = 1, it means that the current fault is triggered, and when the bit representing the fault = 0, it means that there is no such fault. During the test, you only need to directly set the value of the corresponding bit in the CAN signal to trigger and recover the fault, and there is no trigger time limit, which is the most convenient for testing. For the diagnosis type of node loss, there are currently three existing test schemes: first, artificial manufacturing on the test bench, directly plugging and unplugging the hardware for simulation; second, using CAN tools to manually simulate the test device to send fault information; third, using automated test benches to trigger and verify the diagnosis. For the type of verification failure, the existing solution is that the tester manually gives the correct or incorrect signal verification code to trigger and recover the fault. Regardless of the type of verification, it is necessary to use CAN tools to send and receive signals and read and analyze diagnostic commands.

[0003] For the diagnosis and verification of node loss, the existing test solutions have their own shortcomings. The first one is to directly simulate the hardware by plugging and unplugging. Although it can correctly simulate the triggering and recovery of the fault, there are problems with the inaccuracy of the fault triggering time verification (for example, the triggering time of some faults is 500ms, and it is impossible to accurately verify it by manual triggering). At this time, automated testing is required, and this manual operation is easy to cause damage to the test device; the second one is to use CAN tools for manual simulation, which is inefficient; the third one is the automated test bench. The current bench test technology only focuses on the correct triggering and recovery of the diagnosis, does not accurately verify the diagnostic triggering time, and does not pay attention to the verification type of diagnosis. Compared with the test requirements, there are certain deficiencies.

[0004] For the verification failure type, although the tester can calculate the correct and incorrect check codes for verification, it takes a lot of time. If the test system of the present invention is used, the calculation time of the tester is greatly reduced. The automated code will calculate the correct check code based on the value of the current signal, and then send the signal to complete the fault simulation test.

[0005] In the existing automated testing environment, when using different hardware for testing, different programming languages ​​are required to write automated codes and different software-specific methods are required to send and receive signals (for example, CANOE uses CAPL, Vspy uses the code design that comes with the tool, and TSMaster uses C or Python). If the hardware is replaced, it will also take a lot of effort to transplant the automated code.

[0006] During the entire project cycle, regression testing, bug verification, debugging, and version iteration testing will be performed many times. If the existing technology bench is used for verification, the tester will be required to repeat all the previous operations, which is time-consuming. In addition, the calculation of the check code is prone to errors. If the signal value changes, the workload brought by the check code calculation will gradually increase. Summary of the invention

[0007] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide an automated on-board diagnostic test method based on the CAN bus, which is compatible with a variety of CAN test tools, can verify the precise trigger time of node loss diagnosis, calculate CRC and checksum verification codes, automatically generate test results and mark the causes of errors, and form a test report. Fully automated testing can be performed, greatly saving the time of testers.

[0008] In order to solve the above technical problems, the technical solution of the present invention is:

[0009] A vehicle-mounted diagnostic automation test method based on a CAN bus, comprising:

[0010] Step S1, the test PC runs the automated test system executable file to complete the test preparation;

[0011] Step S2, performing a node loss diagnostic test, a checksum verification failure diagnostic test, and a CRC verification failure diagnostic test;

[0012] Step S3: Generate a test report.

[0013] Furthermore, in step S1, the test PC runs the automated test system executable file to complete the test preparation, which specifically includes the following steps:

[0014] Select the currently used hardware in the automated test system interface and connect the hardware. If no relevant hardware information can be detected, an error prompt box will pop up and the test will end.

[0015] After the hardware is connected successfully, read the current network diagnostic fault code library file, select the diagnostic name to be tested, and start the test.

[0016] Furthermore, in step S2, the node loss diagnosis test specifically includes the following steps:

[0017] Traverse all nodes to test lost diagnosis, first stop sending the fault trigger signal corresponding to the current test diagnosis, wait for 5 seconds and then read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis is a historical fault, the test result is recorded as NG;

[0018] If the current test diagnosis status is the current fault, send a frame of CAN signal corresponding to the current test diagnosis, wait for the fault trigger time minus 20ms, read the current test module diagnosis status, if the current test diagnosis is not detected or the current test diagnosis status is the current fault, the test result is recorded as NG;

[0019] If the current test diagnosis status is a historical fault, continue to wait for 20ms until the diagnosis trigger time domain value is reached, and read the current test module diagnosis status again. If the current test diagnosis is not detected or the current test diagnosis is a historical fault, the test result is recorded as NG;

[0020] If the current test diagnosis status is current fault, the test result is recorded as OK, and the actual diagnosis detection time is recorded.

[0021] Further, in step S2, the checksum verification failure diagnosis test specifically includes the following steps:

[0022] Traverse all the checksum verification failure diagnoses for the test, calculate the correct checksum value based on the value of the first 7 bytes of the current test diagnosis signal, and fill it into the 8th byte of the current test diagnosis signal, periodically and continuously send 5 frames of CAN signals with correct checksum verification codes, read the current diagnosis status of the test module, if the current test diagnosis status is current fault, the test result is recorded as NG;

[0023] If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, 5 frames of CAN signals with checksum errors are sent periodically and continuously; the current test module diagnosis status is read. If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, the test result is recorded as NG;

[0024] If the current test diagnosis status is detected as a current fault, 5 frames of CAN signals with correct checksum codes will continue to be sent periodically to read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis status is a current fault, the test result will be recorded as NG.

[0025] If the current test diagnosis status is detected as a historical fault, the test result is recorded as OK.

[0026] Further, in step S2, the CRC check failure diagnosis test specifically includes the following steps:

[0027] Traverse all CRC check failure diagnoses, calculate the CRC check value of the CAN signal corresponding to the current diagnostic code according to the CRC check rule defined for each message in the project, periodically send 5 frames of CAN signals with correct CRC check values, read the current diagnostic status of the test module, if the current test diagnostic status is current fault, the test result is recorded as NG;

[0028] If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, 5 frames of CAN signals with CRC check value errors are sent periodically and continuously; the current test module diagnosis status is read, if the current test diagnosis is not detected or the current test diagnosis status is a historical fault, the test result is recorded as NG;

[0029] If the current test diagnosis status is detected as a current fault, 5 frames of CAN signals with correct CRC check values ​​will continue to be sent periodically to read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis status is a current fault, the test result will be recorded as NG.

[0030] If the current test diagnosis status is detected as a historical fault, the test result is recorded as OK.

[0031] Further, in step S3, generating a test report specifically includes the following steps:

[0032] After the three types of diagnostic code tests are completed, a CSV file and corresponding sheet pages are generated;

[0033] Each diagnostic information is written in a row of the sheet page. If the test result is OK, the current cell color is set to green; if the test result is NG, the current cell color is set to red.

[0034] After all diagnostic information is written, close the CSV file and end the test.

[0035] Further, the automated testing system comprises:

[0036] A test PC, wherein the test PC is used to run the host computer software and the CAN software in a WINDOWS system and enable an automated script, perform various types of on-board diagnostic tests through the automated script, and view the generated test report;

[0037] A CAN tool, wherein the CAN tool is used for sending and receiving CAN signals and diagnostic commands;

[0038] A test module, which is used for triggering and restoring on-board diagnosis and transmitting test data back;

[0039] A regulated power supply is used to supply power to the test module.

[0040] By adopting the above technical solution, the present invention has the following beneficial effects:

[0041] 1. The present invention does not need to rely too much on hardware resources. It only needs to select the currently used hardware in the test system interface to perform normal testing. It does not need to write test scripts in multiple different languages ​​due to hardware changes and porting test codes, thus saving testing costs. It supports three types of hardware: CANoe, Vspy and TSMaster, and has high compatibility.

[0042] 2. The present invention can accurately test the trigger time of node loss diagnosis, and the error is controlled within 20ms.

[0043] 3. The present invention will not be restricted by changes in signal values ​​when calculating the check code, and can quickly calculate correct and incorrect check codes in real time based on the current signal value.

[0044] 4. The present invention can automatically generate a test report and mark the cause of the error. The tester only needs to analyze the NG items, saving the test cost.

[0045] 5. The present invention can perform single or multiple diagnostic verifications according to current test requirements, and the interface operation is intuitive and simple. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A flow chart of an on-board diagnostic automation test method based on a CAN bus of the present invention;

[0047] Figure 2 This is an example diagram of a test report of the present invention;

[0048] Figure 3 It is a principle block diagram of the automatic testing system of the present invention. DETAILED DESCRIPTION

[0049] In order to make the contents of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments in conjunction with the accompanying drawings.

[0050] like Figure 1 As shown, this embodiment provides an on-board diagnostic automation test method based on a CAN bus, which includes:

[0051] Step S1, the test PC runs the automated test system executable file to complete the test preparation;

[0052] Step S2, performing a node loss diagnostic test, a checksum verification failure diagnostic test, and a CRC verification failure diagnostic test;

[0053] Step S3: Generate a test report.

[0054] In step S1 of this embodiment, the test PC runs the automated test system executable file to complete the test preparation, which specifically includes the following steps:

[0055] Select the currently used hardware in the automated test system interface and connect the hardware. If no relevant hardware information can be detected, an error prompt box will pop up and the test will end.

[0056] After the hardware is connected successfully, read the current network diagnostic fault code library file, and the corresponding interface will display all the diagnostic names in the corresponding configuration files. Select the diagnostic name to be tested and start the test.

[0057] In step S2 of this embodiment, the node loss diagnosis test specifically includes the following steps:

[0058] Traverse all the node loss diagnoses for the test, first stop sending the fault trigger signal corresponding to the current test diagnosis, wait for 5 seconds (in normal projects, the node loss fault trigger time is 500ms~4000ms, and the waiting time can be adjusted in special cases), read the current test module diagnosis status, if the current test diagnosis is not detected or the current test diagnosis is a historical fault, the test result is recorded as NG, and the error log information is written;

[0059] If the current test diagnosis status is the current fault, send a frame of CAN signal corresponding to the current test diagnosis, wait for the fault trigger time minus 20ms (due to hardware loss, transmission delay and other reasons, the actual fault trigger detection time will have some errors. Through a large number of test verifications, 20ms before the fault trigger time is the most stable detection time. Usually the detection time error required by the project is ±10%. Based on the minimum trigger time of 500ms, the error of 20ms is within the allowable range of the project. For example: the specified trigger time is 500ms, which means that it is detected once at 480ms.), read the current test module diagnosis status, if the current test diagnosis is not detected or the current test diagnosis status is the current fault, the test result is recorded as NG, and the error log information is written;

[0060] If the current test diagnosis status is a historical fault, continue to wait for 20ms until the diagnosis trigger time domain value is reached, and read the current test module diagnosis status again. If the current test diagnosis is not detected or the current test diagnosis is a historical fault, the test result is recorded as NG and the error log information is written;

[0061] If the current test diagnosis status is current fault, the test result is recorded as OK, and the actual diagnosis detection time is recorded (the actual diagnosis trigger time is the last current diagnosis reading time - the single frame CAN signal time sent in the middle).

[0062] In step S2 of this embodiment, the checksum verification failure diagnosis test specifically includes the following steps:

[0063] Traverse all the checksum verification failure diagnoses for the test, calculate the correct checksum value according to the value of the first 7 bytes of the current test diagnosis signal (the 7th byte is the rolling counter, which needs 0-15 cycles of accumulation), and fill it into the 8th byte of the current test diagnosis signal, and periodically send 5 frames of CAN signals with correct checksum verification codes (the checksum verification failure condition defined in the current project is that the checksum error of the continuous reception of xxx messages is ≥5 frames, and the fault recovery condition is that the correct checksum value of the continuous reception of xxx messages is ≥5 frames. If the subsequent project has different requirements, modify the code, or add the domain value of the number of transmissions and receptions in the configuration file), read the current diagnosis status of the test module, if the current test diagnosis status is the current fault, the test result is recorded as NG, and the error information is recorded;

[0064] If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, 5 frames of CAN signals with checksum errors are sent periodically and continuously; the current test module diagnosis status is read. If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, the test result is recorded as NG and the error information is recorded;

[0065] If the current test diagnosis status is detected as a current fault, 5 frames of CAN signals with correct checksum codes will continue to be sent periodically to read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis status is a current fault, the test result will be recorded as NG and the error information will be recorded.

[0066] If the current test diagnosis status is detected as a historical fault, the test result is recorded as OK.

[0067] In step S2 of this embodiment, the CRC check failure diagnosis test specifically includes the following steps:

[0068] Traverse all CRC check failure diagnoses, calculate the CRC check value of the CAN signal corresponding to the current diagnostic code according to the CRC check rule defined for each message in the project, periodically and continuously send 5 frames of CAN signals with correct CRC check values, read the current diagnostic status of the test module, if the current test diagnostic status is the current fault, the test result is recorded as NG, and the error information is recorded;

[0069] If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, 5 frames of CAN signals with CRC check value errors are sent periodically and continuously; the current test module diagnosis status is read. If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, the test result is recorded as NG and the error information is recorded;

[0070] If the current test diagnosis status is detected as a current fault, 5 frames of CAN signals with correct CRC check values ​​will continue to be sent periodically to read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis status is a current fault, the test result will be recorded as NG and the error information will be recorded.

[0071] If the current test diagnosis status is detected as a historical fault, the test result is recorded as OK.

[0072] In step S3 of this embodiment, generating a test report specifically includes the following steps:

[0073] After the three types of diagnostic code tests are completed, a CSV file and corresponding sheet pages are generated;

[0074] Each diagnostic information is written in a row of the sheet page. If the test result is OK, the current cell color is set to green; if the test result is NG, the current cell color is set to red.

[0075] After all diagnostic information is written, close the csv file and end the test. The final test report is as follows: Figure 2 shown.

[0076] like Figure 3 As shown, the automated testing system of this embodiment includes:

[0077] Test PC: The test PC is used to run the host computer software and CAN software in the WINDOWS system and enable the developed automation scripts. It can perform various types of on-board diagnostic tests through the automation scripts and view the generated test reports.

[0078] CAN tool: CAN tool is used to send and receive CAN signals and diagnostic commands. The hardware is compatible with CANoe, Vspy and TSMaster.

[0079] Test module: The test module is used for triggering and recovering on-board diagnosis and transmitting test data back;

[0080] The regulated power supply is used to supply power to the test module.

[0081] The specific embodiments described above further illustrate the technical problems, technical solutions and beneficial effects solved by the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An automated on-board diagnostic test method based on CAN bus, It is characterized in that It includes: Step S1, the test PC runs the automated test system executable file to complete the test preparation; Step S2, performing a node loss diagnostic test, a checksum verification failure diagnostic test, and a CRC verification failure diagnostic test; Step S3, generating a test report; In step S2, the node loss diagnosis test specifically includes the following steps: Traverse all nodes to test lost diagnosis, first stop sending the fault trigger signal corresponding to the current test diagnosis, wait for 5 seconds and then read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis is a historical fault, the test result is recorded as NG; If the current test diagnosis status is the current fault, send a frame of CAN signal corresponding to the current test diagnosis, wait for the fault trigger time minus 20ms, read the current test module diagnosis status, if the current test diagnosis is not detected or the current test diagnosis status is the current fault, the test result is recorded as NG; If the current test diagnosis status is a historical fault, continue to wait for 20ms until the diagnosis trigger time domain value is reached, and read the current test module diagnosis status again. If the current test diagnosis is not detected or the current test diagnosis is a historical fault, the test result is recorded as NG; If the current test diagnosis status is current fault, the test result is recorded as OK, and the actual diagnosis detection time is recorded.

2. The CAN bus-based on-board diagnostic automated testing method according to claim 1, It is characterized in that In step S1, the test PC runs the automated test system executable file to complete the test preparation, which specifically includes the following steps: Select the currently used hardware in the automated test system interface and connect the hardware. If no relevant hardware information can be detected, an error prompt box will pop up and the test will end. After the hardware is connected successfully, read the current network diagnostic fault code library file, select the diagnostic name to be tested, and start the test.

3. The on-board diagnostic automation test method based on CAN bus according to claim 1, It is characterized in that In step S2, the checksum verification failure diagnosis test specifically includes the following steps: Traverse all the checksum verification failure diagnoses for the test, calculate the correct checksum value based on the value of the first 7 bytes of the current test diagnosis signal, and fill it into the 8th byte of the current test diagnosis signal, periodically and continuously send 5 frames of CAN signals with correct checksum verification codes, read the current diagnosis status of the test module, if the current test diagnosis status is current fault, the test result is recorded as NG; If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, 5 frames of CAN signals with checksum errors are sent periodically and continuously; the current test module diagnosis status is read. If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, the test result is recorded as NG; If the current test diagnosis status is detected as a current fault, 5 frames of CAN signals with correct checksum codes will continue to be sent periodically to read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis status is a current fault, the test result will be recorded as NG. If the current test diagnosis status is detected as a historical fault, the test result is recorded as OK.

4. The on-board diagnostic automation test method based on CAN bus according to claim 1, It is characterized in that In step S2, the CRC check failure diagnosis test specifically includes the following steps: Traverse all CRC check failure diagnoses, calculate the CRC check value of the CAN signal corresponding to the current diagnostic code according to the CRC check rule defined for each message in the project, periodically send 5 frames of CAN signals with correct CRC check values, read the current diagnostic status of the test module, if the current test diagnostic status is current fault, the test result is recorded as NG; If the current test diagnosis is not detected or the current test diagnosis status is a historical fault, 5 frames of CAN signals with CRC check value errors are sent periodically and continuously; the current test module diagnosis status is read, if the current test diagnosis is not detected or the current test diagnosis status is a historical fault, the test result is recorded as NG; If the current test diagnosis status is detected as a current fault, 5 frames of CAN signals with correct CRC check values ​​will continue to be sent periodically to read the current test module diagnosis status. If the current test diagnosis is not detected or the current test diagnosis status is a current fault, the test result will be recorded as NG. If the current test diagnosis status is detected as a historical fault, the test result is recorded as OK.

5. The on-board diagnostic automation test method based on CAN bus according to claim 1, It is characterized in that In step S3, generating a test report specifically includes the following steps: After the three types of diagnostic code tests are completed, a CSV file and corresponding sheet pages are generated; Each diagnostic information is written in a row of the sheet page. If the test result is OK, the current cell color is set to green. If the test result is recorded as NG, set the current cell color to red; After all diagnostic information is written, close the CSV file and end the test.

6. The CAN bus-based on-board diagnostic automated testing method according to claim 1, It is characterized in that The automated testing system comprises: A test PC, wherein the test PC is used to run the host computer software and the CAN software in a WINDOWS system and enable an automated script, perform various types of on-board diagnostic tests through the automated script, and view the generated test reports; A CAN tool, wherein the CAN tool is used for sending and receiving CAN signals and diagnostic commands; A test module, which is used for triggering and restoring on-board diagnosis and transmitting test data back; A regulated power supply is used to supply power to the test module.