Test method and test device of controller CAN interface, electronic equipment and medium

By generating and utilizing the mapping file of the controller CAN signal-internal variables, the controller local area network testing environment and calibration measurement engineering are automatically tested, and the controller CAN interface testing efficiency in the existing technology is solved, efficient and accurate automated testing is achieved, and testing quality and production efficiency are improved.

CN119854187AActive Publication Date: 2025-04-18SAIC MOTOR
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311346677.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-17
Publication Date
2025-04-18
Estimated Expiration
2043-10-17

AI Technical Summary

Technical Problem

In the prior art, the testing method of the controller CAN interface is relatively low in testing, requiring manual handwriting of code, debugging code, and designing test cases, resulting in large programming and debugging workload, low testing efficiency and error-prone.

Method used

By obtaining the controller's CAN signal database file and internal variable information, a mapping file of CAN signal-internal variables is generated, and a script suitable for the controller's local area network testing environment and calibration measurement engineering is generated based on the mapping file. These scripts are used for input and output testing, and the assignment and analysis are performed on the CAN bus in an automated manner to determine whether the input and output transmission links of the controller are normal.

Benefits of technology

Automatic testing of the controller CAN interface is realized, saving labor costs, improving production efficiency, avoiding misoperation and abnormal omissions caused by manual operations, and ensuring the quality of the test. At the same time, the number of actual vehicle road tests is reduced, the development time is shortened, the cost is reduced, and the software quality of the controller and the safety of the entire vehicle are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854187A_ABST
    Figure CN119854187A_ABST
Patent Text Reader

Abstract

The invention provides a controller CAN interface test method and device, electronic equipment and a medium, and the method comprises an input test and an output test. The input test comprises the steps of generating a first script and a second script; and assigning a value on the CAN bus by using the first script as a test case, analyzing an internal signal generated by the controller according to an assignment result by using the second script as a verification script, and judging whether an input transmission link of the controller is normal or not according to an analysis result and the assignment result. The output test comprises the steps of generating a first script and a second script; the second script is used as a test case to assign a value to an internal signal of the controller, the first script is used as a verification script, a signal generated by the CAN bus according to an assignment result sent by the controller is analyzed on the CAN bus, and whether an output transmission link of the controller is normal or not is judged according to an analysis result and the assignment result. According to the scheme, the automatic test of the controller CAN interface is realized, and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic testing, and in particular to a test method, a test device, an electronic device and a medium for a controller CAN interface. Background Art

[0002] With the improvement of intelligence in all walks of life, there are more and more control units and their functions are becoming more and more complex. At present, the signal interaction and communication between various control units, especially between on-board controllers in the automotive field, are mainly realized through CAN (Controller Area Network). Therefore, the test of the controller CAN interface is an important part of the controller development process and testing. In addition, as the integration of various functional software in the controller becomes higher and higher, the amount of tested code and the number of tested CAN signals have increased by dozens of times. Therefore, how to quickly and automatically test CAN interface signals with high quality is urgently needed.

[0003] Currently, the interface test based on CAN bus communication requires testers to manually write codes, manually debug codes, design test cases one by one and carry out corresponding testing work. This testing method has a large programming workload, a large debugging workload, low testing efficiency, and manual operation is prone to errors. Summary of the invention

[0004] The purpose of the present invention is to solve the problem of low test efficiency of the test method of the controller CAN interface in the prior art.

[0005] To solve the above problems, the embodiment of the present invention discloses a test method of a controller CAN interface, including input test and output test. The input test includes:

[0006] Obtain a database file of the CAN signal corresponding to the controller and the internal variable information of the integrated software in the controller, and generate a mapping file about the CAN signal-internal variable according to the database file and the internal variable information; generate a first script suitable for the controller local area network test environment and a second script suitable for the calibration measurement project according to the mapping file; use the first script as a test case for the input test, assign values ​​on the CAN bus through the controller local area network test environment and using the first script to obtain the assignment result, and send the assignment result to the controller; use the second script as a verification script for the input test, parse the internal signal generated by the controller according to the assignment result through the calibration measurement project and using the second script to obtain the parsing result, and judge whether the input transmission link of the controller is normal according to the parsing result and the assignment result.

[0007] And, output tests include:

[0008] Obtain a database file of the CAN signal corresponding to the controller and the internal variable information of the integrated software in the controller, and generate a mapping file about the CAN signal-internal variable according to the database file and the internal variable information; generate a first script suitable for the controller local area network test environment and a second script suitable for the calibration measurement project according to the mapping file; use the second script as a test case for the output test, through the calibration measurement project, use the second script to assign values ​​to the internal signals of the controller to obtain the assignment results, and send the assignment results to the CAN bus; use the first script as a verification script for the output test, through the controller local area network test environment, use the first script to parse the signal generated by the CAN bus according to the assignment results sent by the controller on the CAN bus to obtain the parsing results, and judge whether the output transmission link of the controller is normal according to the parsing results and the assignment results.

[0009] By adopting the above scheme, the labor cost is saved through the automated testing of the interface, the production efficiency is greatly improved, the misoperation and abnormal omission caused by manual operation are avoided, and the quality of the test is effectively guaranteed. Furthermore, when the test method is used for the CAN interface test of the whole vehicle, the number of real vehicle road tests can be reduced, while shortening the development time and reducing the cost, the software quality of the controller is improved, and the risk of the whole vehicle is reduced. Furthermore, the adequacy of the test can be guaranteed, and the assignment information and test results can be displayed in real time on the CANoe or CANape software interface of the host computer, which improves the test efficiency and test quality, thereby improving the reliability of the test system.

[0010] According to another specific embodiment of the present invention, the test method of the controller CAN interface disclosed in the embodiment of the present invention, the controller local network is a CANoe project, the first script is a CAPL script used for the CANoe project; the calibration measurement project is a CANape project, and the second script is a CASL script used for the CANape project.

[0011] By adopting the above scheme, when performing input testing, the CAPL script is used as a test case, making the process of assigning values ​​on the CAN bus simpler; the CASL script is used as a verification script, making the internal signal parsing of the controller more efficient. In addition, when performing output testing, the CASL script is used as a test case, making the accuracy of assigning values ​​inside the controller higher, and the CAPL script is used as a verification script, making the process of parsing on the CAN bus simpler and more convenient.

[0012] According to another specific embodiment of the present invention, the test method of the controller CAN interface disclosed in the embodiment of the present invention, in the input test, through the controller local area network test environment, and using the first script to assign values ​​on the CAN bus, including: through the controller local area network test environment, and using the first script to simulate the CAN signal to assign values ​​on the CAN bus, and assign the minimum value, maximum value and intermediate value to each CAN signal respectively. And, while sending the assignment result to the controller, it also includes: sending a first flag signal to the controller; wherein the first flag signal is used for time synchronization. And, through the calibration measurement project, and using the second script to parse the internal signal generated by the controller according to the assignment result to obtain the analysis result, including: after the controller receives the first flag signal, through the calibration measurement project, and using the second script to parse the internal signal of the controller to obtain the analysis result.

[0013] With the above solution, the controller will parse the internal signal of the controller only after receiving the first flag signal of time synchronization, so that the signal parsed by the controller is clock-synchronized with the signal assigned by the CAN bus, ensuring the accuracy of the parsing result and thus improving the test accuracy.

[0014] According to another specific embodiment of the present invention, the test method of the controller CAN interface disclosed in the embodiment of the present invention, in the output test, the internal signal of the controller is assigned by the calibration measurement project and the second script, including: assigning the minimum value, the maximum value and the intermediate value to each internal signal of the controller by the calibration measurement project, the second script and the calibration measurement protocol. And, while sending the assignment result to the CAN bus, it also includes: sending a second flag signal to the CAN bus; wherein the second flag signal is used for time synchronization. And, through the controller local area network test environment, and using the first script to parse the signal generated by the CAN bus according to the assignment result sent by the controller on the CAN bus to obtain the analysis result, including: after the CAN bus receives the second flag signal, through the controller local area network test environment, and using the first script to parse the signal generated by the CAN bus according to the assignment result sent by the controller on the CAN bus to obtain the analysis result.

[0015] With the above solution, the CAN bus will parse the signal generated by the controller based on the assignment result after receiving the time-synchronized second flag signal, so that the signal parsed by the CAN bus and the signal assigned by the controller are clock-synchronized, ensuring the accuracy of the parsing result and thus improving the test accuracy.

[0016] According to another specific embodiment of the present invention, the test method of the controller CAN interface disclosed in the embodiment of the present invention, when assigning a value to an internal signal of the controller, further includes: shielding a module with an automatic assignment function.

[0017] By adopting the above solution, the module with automatic assignment function is shielded, which can prevent the occurrence of assignment errors when assigning values ​​to the controller, thereby avoiding the impact of assignment errors on the accuracy of interface testing.

[0018] According to another specific embodiment of the present invention, in the test method of the controller CAN interface disclosed in the embodiment of the present invention, a mapping file is generated by a Python script in both the input test and the output test; and, in both the input test and the output test, a first script and a second script are generated by a Python script; and, the calibration measurement protocol is the XCP protocol; and the database file is a DBC file.

[0019] According to another specific embodiment of the present invention, the test method of the controller CAN interface disclosed in the embodiment of the present invention determines whether the input transmission link of the controller is normal according to the analysis result and the assignment result, including:

[0020] If the parsing result is the same as the assignment result, the input transmission link of the controller is normal;

[0021] If the parsing result is different from the assignment result, the input transmission link of the controller is abnormal.

[0022] In addition, judging whether the output transmission link of the controller is normal according to the analysis result and the assignment result includes:

[0023] If the parsing result is the same as the assignment result, the output transmission link of the controller is normal;

[0024] If the parsing result is different from the assignment result, the output transmission link of the controller is abnormal.

[0025] Furthermore, after determining whether the input transmission link or the output transmission link of the controller is normal, the method further includes:

[0026] Generate a visual test report based on the judgment results.

[0027] By adopting the above scheme, the interface testing method can generate a visual test report, which is convenient for monitoring the test process and handling interface faults in a timely manner.

[0028] The embodiment of the present invention discloses a test device for a controller CAN interface, comprising: a first acquisition module, the first acquisition module acquires a database file of a CAN signal corresponding to the controller, and internal variable information of software integrated in the controller; a first processing module, the first processing module is in communication with the first acquisition module, and generates a mapping file about CAN signals-internal variables according to the database file and the internal variable information; generates a first script applicable to a controller local area network test environment and a second script applicable to a calibration measurement project according to the mapping file; uses the first script as a test case for input testing, and assigns values ​​on a CAN bus through the controller local area network test environment and using the first script to obtain an assignment result, and sends the assignment result to the controller; uses the second script as a verification script for input testing, and uses the calibration measurement project and using the second script to parse the internal signal generated by the controller according to the assignment result to obtain a parsing result, and judges the input of the controller according to the parsing result and the assignment result. Whether the transmission link is normal; a second acquisition module, the second acquisition module acquires the database file of the CAN signal corresponding to the controller, and the internal variable information of the integrated software in the controller; a second processing module, the second processing module is communicated with the second acquisition module, and generates a mapping file about CAN signal-internal variable according to the database file and the internal variable information; a first script suitable for the controller local area network test environment and a second script suitable for the calibration measurement project are generated according to the mapping file; the second script is used as a test case for the output test, and the internal signal of the controller is assigned through the calibration measurement project and the second script is used to obtain the assignment result, and the assignment result is sent to the CAN bus; the first script is used as a verification script for the output test, and the signal generated by the CAN bus according to the assignment result sent by the controller is analyzed on the CAN bus through the controller local area network test environment and the first script is used to obtain the analysis result, and whether the output transmission link of the controller is normal is judged according to the analysis result and the assignment result.

[0029] An embodiment of the present invention discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, a test method for a controller CAN interface as described in any of the above embodiments is implemented.

[0030] An embodiment of the present invention discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for testing the controller CAN interface described in any of the above embodiments is implemented.

[0031] The beneficial effects of the present invention are:

[0032] The test method of the controller CAN interface provided by the present application saves labor costs through the automated testing of the interface, greatly improves production efficiency, avoids misoperation and abnormal omissions caused by manual operation, and effectively ensures the quality of the test. Furthermore, when the test method is used as a CAN interface test for a whole vehicle, the number of real vehicle road tests can be reduced, while shortening the development time and reducing costs, the software quality of the controller is improved, and the risk of the whole vehicle is reduced. Furthermore, the adequacy of the test can be guaranteed, and the assignment information and test results can be displayed in real time on the CANoe or CANape software interface of the host computer, which improves the test efficiency and test quality, thereby improving the reliability of the test software system. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a flowchart of an input test of a test method for a controller CAN interface provided by an embodiment of the present invention;

[0034] Figure 2 It is a flowchart of an output test of a test method for a controller CAN interface provided by an embodiment of the present invention;

[0035] Figure 3 It is a structural schematic diagram of a test device for a controller CAN interface provided by an embodiment of the present invention;

[0036] Figure 4 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

[0037] Description of reference numerals:

[0038] 111, first acquisition module; 112, first processing module; 113, second acquisition module; 114, second processing module; 121, transceiver; 122, processor; 123, memory. DETAILED DESCRIPTION

[0039] Embodiment 1:

[0040] In order to solve the problem of low test efficiency of the test method of the controller CAN interface in the prior art, an embodiment of the present invention provides a test method of the controller CAN interface. Specifically, the test method includes input test and output test.

[0041] refer to Figure 1 , the input test includes the following steps:

[0042] S11: Obtain a database file of a CAN signal corresponding to the controller and internal variable information of the software integrated in the controller, and generate a mapping file of the CAN signal-internal variable according to the database file and the internal variable information;

[0043] S12: generating a first script applicable to a controller area network test environment and a second script applicable to a calibration measurement project according to the mapping file;

[0044] S13: using the first script as a test case for input testing, performing assignment on the CAN bus through the controller area network test environment and using the first script to obtain an assignment result, and sending the assignment result to the controller;

[0045] S14: Use the second script as a verification script for input testing, calibrate the measurement project, and use the second script to parse the internal signal generated by the controller according to the assignment result to obtain the analysis result, and determine whether the input transmission link of the controller is normal based on the analysis result and the assignment result.

[0046] refer to Figure 2 , output tests include:

[0047] S21: Obtain a database file of a CAN signal corresponding to the controller and internal variable information of the software integrated in the controller, and generate a mapping file of the CAN signal-internal variable according to the database file and the internal variable information;

[0048] S22: generating a first script applicable to a controller area network test environment and a second script applicable to a calibration measurement project according to the mapping file;

[0049] S23: using the second script as a test case for the output test, assigning values ​​to the internal signals of the controller by calibrating the measurement project and using the second script to obtain an assignment result, and sending the assignment result to the CAN bus;

[0050] S24: Use the first script as a verification script for the output test, and parse the signal generated by the CAN bus according to the assignment result sent by the controller on the CAN bus through the controller local area network test environment and using the first script to obtain the analysis result, and judge whether the output transmission link of the controller is normal based on the analysis result and the assignment result.

[0051] Specifically, in the above-mentioned input test and output test, the database file is also called a network matrix file, specifically a DBC (Data Base CAN) file, which is a file used to describe the information of each logical node in the CAN network. The acquisition of database files and internal variable information, as well as the generation of mapping files can all be achieved using scripts.

[0052] Test case script files are used for test operations. Testers break down test cases according to requirements, design test scripts based on test cases, debug the test scripts, and run the test scripts. Test scripts are program codes for automatic testing.

[0053] With such steps, compared with the method in which testers use manual design of test cases one by one and carry out corresponding testing work, this method can automatically generate scripts according to the mapping file, and the method of automatically generating scripts takes less time than manual writing; and the automatically generated scripts do not need to be debugged, which reduces the time of manual debugging and saves labor costs, thereby improving the test efficiency. In addition, the accuracy of the automatically generated scripts is higher, and this method can also avoid the misoperation and abnormal omission caused by manual operation, effectively ensuring the quality of the test. Further, this method can automatically generate test scripts in multiple languages, which can be used in test projects in different environments. When this method is used for the test of the CAN interface of the whole vehicle, it can also reduce the number of road tests of the real vehicle, shorten the development cost of the whole vehicle, reduce the cost, and improve the software quality of the controller, thereby reducing the risk of the whole vehicle. Furthermore, this method can display the assignment information and test results on the CANoe or CANape software interface of the host computer in real time, improve the test efficiency and test quality, thereby improving the reliability of the test software system.

[0054] Further, in the test method of the controller CAN interface according to the present invention, the controller area network is a CANoe (CAN Open Environment, controller area network test environment) project, and the first script is a CAPL script for the CANoe project. And, the calibration measurement project is a CANape (CAN Application Programming Environment) project, and the second script is a CASL script for the CANape project. That is to say, if the CANoe project is used as the test project, in order to meet the use needs of the CANoe project, the generated test script must use the CANoe project script language, i.e., the controller area network access programming language (CAN Access Programming Language, CAPL) test script. If the CANape project is used as the test project, in order to meet the use needs of the CANape project, the generated test script must use the CANape project script language, i.e., the controller area network calculation script language (Calculation and Scripting Language, CASL) test script.

[0055] Specifically, CAPL is an event-oriented programming language, that is, program nodes are used to specify events, and when to execute and react, which has the advantages of low coupling and high initiative. CASL is a signal-oriented language, which has the advantages of high execution accuracy and high efficiency. When performing input testing, this method uses the CAPL script as a test case to make the process of assigning values ​​on the CAN bus simpler; using the CASL script as a verification script makes the internal signal parsing of the controller more efficient. In addition, when performing output testing, the CASL script is used as a test case, which makes the accuracy of assigning values ​​inside the controller higher, and the CAPL script is used as a verification script, which makes the process of parsing on the CAN bus simpler and more convenient.

[0056] Further, in the test method of the controller CAN interface according to the present invention, in the input test, the CAN bus is assigned values ​​by using the first script through the controller area network test environment, including: simulating the CAN signal through the controller area network test environment and using the first script to assign values ​​on the CAN bus, and assigning a minimum value, a maximum value and an intermediate value to each CAN signal. Specifically, the minimum value, the maximum value and the intermediate value of the CAN signal all refer to the maximum, the minimum and the intermediate value of the physical value of the CAN signal.

[0057] Further, in the test method of the controller CAN interface according to the present invention, in the input test, while sending the assignment result to the controller, it also includes: sending a first flag signal to the controller. The first flag signal is used for time synchronization. Specifically, the first flag signal can be sent in the form of a message, which is mainly used to indicate time synchronization.

[0058] Furthermore, in the test method of the controller CAN interface according to the present invention, in the input test, the internal signal generated by the controller according to the assignment result is parsed by the calibration measurement project and the second script to obtain the parsing result, including: after the controller receives the first flag signal, the internal signal of the controller is parsed by the calibration measurement project and the second script to obtain the parsing result. That is to say, the controller will parse the internal signal of the controller only after receiving the time-synchronized first flag signal. The signal parsed by the controller is clock-synchronized with the signal assigned by the CAN bus, which ensures the accuracy of the parsing result and improves the test accuracy.

[0059] Further, in the test method of the controller CAN interface according to the present invention, in the output test, the internal signal of the controller is assigned by the calibration measurement project and the second script, including: assigning the minimum value, the maximum value and the middle value to each internal signal of the controller by the calibration measurement project, the second script and the calibration measurement protocol. Specifically, the minimum value, the maximum value and the middle value of the internal signal all refer to the maximum, the minimum and the middle value of the internal signal definition range mapped to the CAN signal. More specifically, the calibration measurement protocol is the XCP protocol (Universal Calibration Protocol, universal measurement and calibration protocol).

[0060] Further, in the test method of the controller CAN interface according to the present invention, in the output test, while sending the assignment result to the CAN bus, it also includes: sending a second flag signal to the CAN bus. The second flag signal is used for time synchronization. Specifically, the second flag signal can be sent in the form of a message, which is mainly used to indicate time synchronization.

[0061] Further, in the test method of the controller CAN interface according to the present invention, in the output test, the signal generated by the CAN bus according to the assignment result sent by the controller is parsed on the CAN bus by the controller local area network test environment and the first script to obtain the parsing result, including: after the CAN bus receives the second flag signal, the signal generated by the CAN bus according to the assignment result sent by the controller is parsed on the CAN bus by the controller local area network test environment and the first script to obtain the parsing result. That is to say, the CAN bus will parse the signal generated according to the assignment result sent by the controller on the CAN bus only after receiving the time-synchronized second flag signal. The signal parsed by the CAN bus is synchronized with the signal assigned by the controller, which ensures the accuracy of the parsing result and improves the test accuracy.

[0062] Furthermore, in the test method of the controller CAN interface according to the present invention, when assigning a value to the internal signal of the controller, it also includes: shielding a module with an automatic value assignment function. Specifically, shielding the corresponding module can be achieved by cutting off the signal transmission and reception between the module and the outside world. In addition, shielding the module with an automatic value assignment function can prevent the occurrence of value assignment errors when assigning values ​​to the controller, thereby avoiding the impact of value assignment errors on the accuracy of interface testing.

[0063] Further, in the test method of the controller CAN interface according to the present invention, in both the input test and the output test, a Python script is used to generate a mapping file. Specifically, the Python script performs text file function processing on the database file of the CAN signal and the integrated software in the controller to obtain the internal variable information of the CAN signal and the integrated software in the controller, and generates a mapping file about the two information.

[0064] Further, in the test method of the controller CAN interface according to the present invention, in both the input test and the output test, the first script and the second script are generated by using Python scripts. The Python script can automatically generate the steps required for the test, thereby improving the test efficiency.

[0065] Further, in the test method of the controller CAN interface according to the present invention, judging whether the input transmission link of the controller is normal according to the analysis result and the assignment result includes:

[0066] If the parsing result is the same as the assignment result, the input transmission link of the controller is normal;

[0067] If the parsing result is different from the assignment result, the input transmission link of the controller is abnormal.

[0068] Further, in the test method of the controller CAN interface according to the present invention, judging whether the output transmission link of the controller is normal according to the analysis result and the assignment result includes:

[0069] If the parsing result is the same as the assignment result, the output transmission link of the controller is normal;

[0070] If the parsing result is different from the assignment result, the output transmission link of the controller is abnormal.

[0071] Furthermore, in the test method of the controller CAN interface according to the present invention, after determining whether the input transmission link or the output transmission link of the controller is normal, it also includes: generating a visual test report according to the determination result. Specifically, the test report is a Hyper Text Markup Language (HTML) test report.

[0072] Next, a specific input test method is described:

[0073] First, according to the controller under test and the integrated software version of the controller, a Python script is used to automatically generate a mapping file of CAN signals-internal variables based on the DBC file of the CAN signal and the internal variables of the integrated software. The CAN signal corresponds to the internal signal of the controller. After that, based on the generated mapping file, the CAPL script for the CANoe project and the CASL script for the CANape project are automatically generated based on the automation script written in Python. After that, the CAPL script is used as an input interface test case to simulate the CAN signal to assign values ​​on the CAN bus, assign the minimum value, maximum value and intermediate value to each CAN signal respectively, and send a flag signal for time synchronization on the CAN bus. After that, the CASL script is used as a verification script, and the internal signal of the controller is parsed through the CANape project using a protocol such as XCP. After the controller receives the flag signal, it is compared with the signal value assigned to the CAN signal to determine whether the input transmission link is normal.

[0074] Next, a specific output test method is described:

[0075] First, according to the tested controller and the integrated software version of the controller, a Python script is used to automatically generate a mapping file of internal variables-CAN signals based on the DBC file of the CAN signal and the internal variables of the integrated software, where the internal signal of the controller corresponds to the CAN signal. After that, based on the generated mapping file, a CAPL script for the CANoe project and a CASL script for the CANape project are automatically generated based on the written automation script. Next, the CASL script is used as an output interface test case, and the internal signal of the controller is assigned by the CANape project using the XCP protocol, and each internal signal is assigned a minimum value, a maximum value and an intermediate value. At the same time, a flag signal for time synchronization is sent inside the controller. If the module where the assigned signal is located automatically assigns a value, the module needs to be shielded. After that, the CAPL script is used as a verification script to parse the signal sent by the controller on the CAN bus. After the CAN bus receives the flag signal, it is compared with the signal value assigned to the internal signal to determine whether the output transmission link is normal.

[0076] Embodiment 2:

[0077] Based on the above-mentioned controller CAN interface test method, this embodiment provides a controller CAN interface test device. Figure 3 The testing device includes a first acquisition module 111 , a first processing module 112 , a second acquisition module 113 and a second processing module 114 .

[0078] Specifically, the first acquisition module 111 acquires a database file of a CAN signal corresponding to the controller and internal variable information of the software integrated in the controller.

[0079] The first processing module 112 is communicatively connected with the first acquisition module 111, and generates a mapping file about CAN signals and internal variables according to the database file and the internal variable information; generates a first script applicable to the controller local area network test environment and a second script applicable to the calibration measurement project according to the mapping file; uses the first script as a test case for the input test, and assigns values ​​on the CAN bus through the controller local area network test environment and the first script to obtain the assignment result, and sends the assignment result to the controller; uses the second script as a verification script for the input test, and uses the calibration measurement project and the second script to parse the internal signal generated by the controller according to the assignment result to obtain the parsing result, and judges whether the input transmission link of the controller is normal according to the parsing result and the assignment result.

[0080] The second acquisition module 113 acquires a database file of a CAN signal corresponding to the controller and internal variable information of the software integrated in the controller.

[0081] The second processing module 114 is communicatively connected with the second acquisition module 113, and generates a mapping file about CAN signals and internal variables according to the database file and the internal variable information; generates a first script applicable to the controller local area network test environment and a second script applicable to the calibration measurement project according to the mapping file; uses the second script as a test case for the output test, and assigns the internal signal of the controller through the calibration measurement project and the second script to obtain the assignment result, and sends the assignment result to the CAN bus; uses the first script as a verification script for the output test, and uses the controller local area network test environment and the first script to parse the signal generated by the CAN bus according to the assignment result sent by the controller on the CAN bus to obtain the parsing result, and judges whether the output transmission link of the controller is normal according to the parsing result and the assignment result.

[0082] The controller CAN interface test device provided in this embodiment can execute the controller CAN interface test method provided in the above method embodiment, and has the corresponding functional modules and beneficial effects of the execution method. The implementation principle and technical effects of this embodiment are similar to those of the above method embodiment, and will not be repeated here.

[0083] Embodiment 3:

[0084] Based on the above-mentioned controller CAN interface test method, this embodiment provides an electronic device. Figure 4 The electronic device may include: a transceiver 121, a processor 122, and a memory 123.

[0085] The processor 122 executes the computer execution instructions stored in the memory, so that the processor 122 executes the scheme in the above embodiment. The processor 122 can be a general-purpose processor, including a central processing unit CPU, a network processor (Network Processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0086] The memory 123 is connected to the processor 122 via a system bus and completes communication between them. The memory 123 is used to store computer program instructions.

[0087] The transceiver 121 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.

[0088] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory (NVM).

[0089] The electronic device provided in the embodiment of the present application may be the terminal device of the above embodiment.

[0090] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the controller CAN interface testing method described in the above embodiment.

[0091] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the controller CAN interface test method described in the above embodiment can be implemented.

[0092] Although the present invention has been illustrated and described with reference to certain preferred embodiments of the present invention, it should be understood by those skilled in the art that the above contents are further detailed descriptions of the present invention in conjunction with specific embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. Those skilled in the art may make various changes in form and details, including making several simple deductions or substitutions, without departing from the spirit and scope of the present invention.

Claims

1. A method for testing a controller CAN interface, characterized in that: Includes input testing and output testing; in The input tests include: Acquire a database file of a CAN signal corresponding to the controller and internal variable information of the software integrated in the controller, and generate a mapping file about CAN signal-internal variable according to the database file and the internal variable information; Generating a first script applicable to a controller area network test environment and a second script applicable to a calibration measurement project according to the mapping file; Using the first script as a test case of the input test, performing assignment on a CAN bus through the controller area network test environment and using the first script to obtain an assignment result, and sending the assignment result to the controller; Using the second script as a verification script for the input test, parsing the internal signal generated by the controller according to the assignment result through the calibration measurement project and using the second script to obtain a parsing result, and judging whether the input transmission link of the controller is normal according to the parsing result and the assignment result; and The output tests include: Acquire the database file of the CAN signal corresponding to the controller and the internal variable information of the integrated software in the controller, and generate the mapping file about the CAN signal-internal variable according to the database file and the internal variable information; Generating the first script applicable to the controller area network test environment and the second script applicable to the calibration measurement project according to the mapping file; Using the second script as a test case for the output test, assigning a value to an internal signal of the controller by using the second script through the calibration measurement project to obtain an assignment result, and sending the assignment result to the CAN bus; The first script is used as a verification script for the output test. Through the controller local area network test environment, the first script is used to parse the signal generated by the CAN bus according to the assignment result sent by the controller on the CAN bus to obtain a parsing result, and whether the output transmission link of the controller is normal is judged based on the parsing result and the assignment result.

2. The method for testing the controller CAN interface as claimed in claim 1, characterized in that: The controller area network is a CANoe project. The first script is a CAPL script for CANoe engineering; The calibration measurement project is a CANape project. The second script is a CASL script for CANape project.

3. The test method of the controller CAN interface as claimed in claim 2, characterized in that: In the input test, assigning values ​​on the CAN bus through the controller area network test environment and using the first script includes: By using the controller area network test environment and the first script to simulate the CAN signal to assign values ​​on the CAN bus, and assign a minimum value, a maximum value and an intermediate value to each CAN signal respectively; and While sending the assignment result to the controller, it also includes: Sending a first flag signal to the controller; wherein the first flag signal is used for time synchronization; and The method further comprises: performing, by means of the calibration measurement project, parsing the internal signal generated by the controller according to the assignment result using the second script to obtain the parsing result. After the controller receives the first flag signal, the internal signal of the controller is parsed through the calibration measurement project and using the second script to obtain the parsing result.

4. The method for testing the controller CAN interface as claimed in claim 2, characterized in that: In the output test, assigning a value to an internal signal of the controller by using the calibration measurement project and the second script includes: By means of the calibration measurement project, using the second script and adopting the calibration measurement protocol, each internal signal of the controller is assigned a minimum value, a maximum value and an intermediate value; and While sending the assignment result to the CAN bus, it also includes: Sending a second flag signal to the CAN bus; wherein the second flag signal is used for time synchronization; and The method further comprises: parsing a signal generated by the CAN bus according to the assignment result sent by the controller on the CAN bus by using the first script through the controller area network test environment to obtain a parsing result, including: After the CAN bus receives the second flag signal, the signal generated by the CAN bus according to the assignment result sent by the controller is parsed on the CAN bus through the controller area network test environment and using the first script to obtain the parsing result.

5. The method for testing the controller CAN interface as claimed in claim 4, characterized in that: When assigning values ​​to the controller's internal signals, it also includes: Disable modules with automatic value assignment function.

6. The method for testing the controller CAN interface as claimed in claim 3 or 5, characterized in that: In both the input test and the output test, the mapping file is generated by using a Python script; and In both the input test and the output test, the first script and the second script are generated by using Python scripts; and The calibration measurement protocol is the XCP protocol; The database file is a DBC file.

7. The method for testing the controller CAN interface as claimed in claim 6, characterized in that: Judging whether the input transmission link of the controller is normal according to the analysis result and the assignment result includes: If the analysis result is the same as the assignment result, the input transmission link of the controller is normal; If the analysis result is different from the assignment result, the input transmission link of the controller is abnormal; and Judging whether the output transmission link of the controller is normal according to the analysis result and the assignment result includes: If the analysis result is the same as the assignment result, the output transmission link of the controller is normal; If the analysis result is different from the assignment result, the output transmission link of the controller is abnormal; and After determining whether the input transmission link or the output transmission link of the controller is normal, the method further includes: Generate a visual test report based on the judgment results.

8. A test device for a controller CAN interface, characterized in that: include: A first acquisition module, wherein the first acquisition module acquires a database file of a CAN signal corresponding to the controller and internal variable information of the integrated software in the controller; A first processing module, the first processing module is in communication with the first acquisition module, and generates a mapping file about CAN signal-internal variable according to the database file and the internal variable information; Generate a first script applicable to a controller area network test environment and a second script applicable to a calibration measurement project according to the mapping file; use the first script as a test case for an input test, assign values ​​on a CAN bus through the controller area network test environment and using the first script to obtain an assignment result, and send the assignment result to the controller; Using the second script as a verification script for the input test, parsing the internal signal generated by the controller according to the assignment result through the calibration measurement project and using the second script to obtain a parsing result, and judging whether the input transmission link of the controller is normal according to the parsing result and the assignment result; A second acquisition module, wherein the second acquisition module acquires the database file of the CAN signal corresponding to the controller and the internal variable information of the integrated software in the controller; A second processing module, the second processing module is in communication with the second acquisition module, and generates the mapping file about CAN signal-internal variable according to the database file and the internal variable information; and generates the first script applicable to the controller area network test environment and the second script applicable to the calibration measurement project according to the mapping file; The second script is used as a test case for the output test. Through the calibration measurement project, the internal signal of the controller is assigned by the second script to obtain the assignment result, and the assignment result is sent to the CAN bus. The first script is used as a verification script for the output test. Through the controller local area network test environment, the first script is used to parse the signal generated by the CAN bus according to the assignment result sent by the controller on the CAN bus to obtain the analysis result, and whether the output transmission link of the controller is normal is judged according to the analysis result and the assignment result.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the test method for the controller CAN interface as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the test method of the controller CAN interface as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Controller area network signal transmission verifying method and system for automobile controller

    CN104657302A

  • Electric vehicle controller CAN interface HIL automatic test method

    CN114460925A

  • BMS HIL test method, device and equipment

    CN116166524A

  • System and method for verifying function of can gateway module for vehicle

    KR1020140078916A