A communication verification system, method, apparatus, device, and storage medium
Patent Information
- Application Number
- CN202211190856.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-28
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2042-09-28
AI Technical Summary
[0004]基于此,本申请提供一种通信验证系统、方法、装置、设备及存储介质,改善现有技术中通信验证效率不高且不准确的问题
[0018]综上,本申请提供了一种通信验证系统、方法、装置、设备及存储介质,其中,通信验证方法应用于通信验证系统中的通信验证设备。本申请的通信验证设备根据总线数据库文件生成和配置测试节点,并利用测试节点对待验证设备进行通信验证。由于测试节点是根据总线数据库文件自动生成和配置的,因此利用测试节点与待验证设备进行通信,可以覆盖多种通信场景,更贴近待验证设备的实际通信情况,无须手动测试验证,因此通过采用本申请所提供的通信验证系统、通信验证设备和通信验证方法能够快速且真实的模拟待验证验证设备的通信过程,以实现对待验证设备的自动、全面、周期性的通信验证,从而以改善现有技术中通信验证效率不高且不准确的问题。
Smart Images

Figure CN115665021B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive communications, and in particular to a communication verification system, method, apparatus, device, and storage medium. Background Technology
[0002] With the development of automation control technology, automobiles are now equipped with a variety of controllers. These controllers can interact with each other to ensure the implementation of various functions on the vehicle. In particular, critical controllers such as the Vehicle Control Unit (VCU) and Battery Management System (BMS) are particularly vulnerable; if their communication configuration is incorrect, it could potentially cause serious vehicle malfunctions.
[0003] To address this, engineers can manually test and verify the messages sent and received by the controller and the signals they carry after the underlying communication module is configured. However, manual testing and verification not only consumes a lot of time but also suffers from incomplete coverage and fails to accurately reflect the actual communication situation of the controller. Therefore, existing technologies still suffer from low efficiency and inaccuracy in communication verification. Summary of the Invention
[0004] Based on this, this application provides a communication verification system, method, apparatus, device, and storage medium to improve the problems of low efficiency and inaccuracy in communication verification in the prior art.
[0005] In a first aspect, this application provides a communication verification system, which includes: a device to be verified for communicating with other devices via a CAN bus; and a communication verification device for generating and configuring test nodes according to a bus database file and using the test nodes to perform communication verification on the device to be verified; wherein a first port of the communication verification device is electrically connected to the device to be verified, and a second port of the communication verification device is electrically connected to the device to be verified via a CAN bus.
[0006] In conjunction with the first aspect, in a first possible implementation of the first aspect, the system further includes: a debugger for addressing, reading, and assigning values to variables in the device to be verified; wherein, the first port of the communication verification device is electrically connected to the device to be verified through the debugger; and the debugger stores a mapping table between variables in the device to be verified and memory addresses.
[0007] In conjunction with the first aspect, in a second possible implementation of the first aspect, the system further includes: an interface conversion device for connecting a test node to a CAN bus; wherein the second port of the communication verification device is connected to the CAN bus through the interface conversion device, thereby electrically connecting to the device to be verified on the CAN bus; the interface conversion device is a PCAN, and the device to be verified and the interface conversion device are electrically connected via a USB data cable.
[0008] Secondly, this application provides a communication verification method, which includes: generating a test node based on a bus database file and configuring the attributes of the messages of the test node, wherein the attributes of the messages include at least one of variables, period, and type; using one of the test node and the device to be verified as a sender and the other as a receiver, and controlling the sender and receiver to perform data communication; verifying whether the variable values in the sender and the receiver are consistent, and if they are consistent, determining that the communication configuration of the device to be verified is correct.
[0009] In conjunction with the second aspect, in the first possible implementation of the second aspect, the above-mentioned steps for controlling the data communication between the sending end and the receiving end include: assigning values to variables in the sending end using a preset test dataset, so that the sending end sends a message to the receiving end, wherein the message includes the variable values of the assigned variables; after the receiving end receives the message sent by the sending end, reading the variable values of the assigned variables in the receiving end.
[0010] In conjunction with the second aspect, in the second possible implementation of the second aspect, before the above-mentioned step of controlling the sending end and the receiving end to perform data communication, the method further includes: initializing the interface conversion device and the debugger; parsing the MAP file of the device to be verified to obtain a mapping table of variables and memory addresses, and sending the mapping table to the debugger to realize the addressing of variables in the device to be verified; the step of controlling the sending end and the receiving end to perform data communication includes: controlling the sending end and the receiving end to perform data communication through the interface conversion device and the debugger.
[0011] In conjunction with the second aspect, in the third possible implementation of the second aspect, the step of verifying whether the variable values in the sending end and the receiving end are consistent, and determining that the communication configuration of the device to be verified is correct if they are consistent, includes: when the sending end is a test node, verifying whether the variable values in the device to be verified are consistent with the variable values in the test node, and determining that the communication configuration of the device to be verified is correct in the receiving direction if they are consistent; when the sending end is the device to be verified, verifying whether the variable values in the test node are consistent with the variable values in the device to be verified, and determining that the communication configuration of the device to be verified is correct in the sending direction if they are consistent; and if the communication configuration of the device to be verified is correct in both the receiving and sending directions, then determining that the communication configuration of the device to be verified is correct.
[0012] Thirdly, this application provides a communication verification device, which includes: an initialization unit, configured to generate a test node according to a bus database file and configure the attributes of the message of the test node, wherein the attributes of the message include at least one of variable, period, and type; a communication unit, configured to use one of the test node and the device to be verified as a transmitter and the other as a receiver, and control the transmitter and receiver to perform data communication; and a verification unit, configured to verify whether the variable values in the transmitter and the receiver are consistent, and if they are consistent, determine that the communication configuration of the device to be verified is correct.
[0013] In conjunction with the third aspect, in the first possible implementation of the third aspect, the aforementioned communication unit is specifically used to: assign values to variables in the sending end using a preset test dataset, so that the sending end sends a message to the receiving end, wherein the message includes the variable values of the assigned variables; after the receiving end receives the message sent by the sending end, it reads the variable values of the assigned variables in the receiving end.
[0014] In conjunction with the third aspect, in the second possible implementation of the third aspect, the aforementioned initialization unit is further configured to: initialize the interface conversion device and the debugger; parse the MAP file of the device to be verified to obtain a mapping table of variables and memory addresses, and send the mapping table to the debugger to realize addressing of variables in the device to be verified; the step of controlling the data communication between the sending end and the receiving end includes: controlling the data communication between the sending end and the receiving end through the interface conversion device and the debugger.
[0015] In conjunction with the third aspect, in the third possible implementation of the third aspect, the above verification unit is specifically used for: verifying whether the variable values in the device to be verified are consistent with the variable values in the test node when the sending end is a test node; if they are consistent, it is determined that the communication configuration of the device to be verified in the receiving direction is correct; verifying whether the variable values in the test node are consistent with the variable values in the device to be verified when the sending end is the device to be verified; if they are consistent, it is determined that the communication configuration of the device to be verified is correct in the sending direction; and determining that the communication configuration of the device to be verified is correct when the communication configuration of the device to be verified is correct in both the receiving and sending directions.
[0016] Fourthly, this application also provides a communication verification device, which includes a processor and a memory connected via a bus; the processor is used to execute multiple instructions; the memory is used to store multiple instructions, which are adapted to be loaded by the processor and executed as a communication verification method as described in the first aspect or any embodiment of the first aspect.
[0017] Fifthly, this application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor and executing a communication verification method as described in the first aspect or any embodiment of the first aspect.
[0018] In summary, this application provides a communication verification system, method, apparatus, device, and storage medium. The communication verification method is applied to the communication verification device within the communication verification system. The communication verification device of this application generates and configures test nodes based on a bus database file, and uses these test nodes to perform communication verification on the device under test. Since the test nodes are automatically generated and configured based on the bus database file, communication between the test nodes and the device under test can cover various communication scenarios, more closely resembling the actual communication situation of the device under test. Manual testing and verification are unnecessary. Therefore, by employing the communication verification system, communication verification device, and communication verification method provided in this application, the communication process of the device under test can be quickly and realistically simulated, achieving automatic, comprehensive, and periodic communication verification of the device under test, thereby improving the problems of low efficiency and inaccuracy in existing communication verification technologies. Attached Figure Description
[0019] Figure 1 This is a schematic block diagram of a communication verification system in one embodiment; Figure 2 This is a schematic block diagram of a communication verification system in another embodiment; Figure 3 This is a flowchart illustrating a communication verification method in one embodiment; Figure 4 This is a flowchart illustrating the communication verification method in another embodiment; Figure 5 A schematic block diagram of a communication verification device provided in this application; Figure 6 A structural block diagram of a communication verification device provided in this application. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0021] Since the embodiments of this application involve a relatively large number of technical terms, for ease of understanding, the relevant terms and concepts that may be involved in the embodiments of this application will be introduced below.
[0022] 1. Bus database file (Database CAN, DBC) The bus database file in this application refers to the database file of the Controller Area Network (CAN). A bus database file is a file that describes the data communication of each node controller in a CAN network. The bus database file defines CAN communication information very completely and clearly, describing all node controllers on the CAN network and the types, cycles, variables, etc., of messages that each node controller can send or receive. The CAN network operates based on the description in the bus database file, therefore, the bus database file plays a very powerful role. It is precisely because of the bus database file that the node controllers of the entire CAN network can collaboratively and synchronously develop without errors.
[0023] 2. MAP file A MAP file is a mapping file generated during the software compilation process. Parsing the MAP file yields the corresponding symbol table. The symbol table is a mapping relationship between variables and memory addresses. Through this mapping table, any variable in the table can be addressed to perform operations on the variable, such as reading and assigning values. In this application, the MAP file is a file generated during the compilation process of the software running on the device to be verified.
[0024] 3. Interface conversion equipment An interface conversion device is a device used to connect a communication verification device to a bus. In this application, the interface conversion device can be a PCAN, also known as PCAN-USB or a CAN card. It is a CAN-to-USB interface that can transmit messages from the CAN network to the communication verification device via a USB interface, and the messages can be viewed using relevant software. Specifically, one end of the PCAN is connected to the communication verification device via a Universal Serial Bus (USB) data line, and the other end is connected to the CAN bus.
[0025] 4. Debugger A debugger is a device used to connect a communication verification device and a device to be verified. On one hand, it can address variables in the device to be verified based on a local mapping table; on the other hand, it can respond to instructions from the communication verification device and, when the addressing is correct, perform operations on the variables in the device to be verified, such as reading and assigning values. It should be noted that the debugger can be SEGGER's J-LINK series, ARM's ULINK series, Lauterbach's TRACE32, etc., and this application does not impose any restrictions on this.
[0026] It should be noted that the processors referred to in this application may include, but are not limited to, central processing units (CPUs), general-purpose processors, coprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The processor can implement the methods described in this application, such as generating test nodes based on a bus database file and configuring the attributes of the messages of the test nodes, etc., which will not be elaborated further in this application.
[0027] It should also be noted that the illustrations provided in this embodiment are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show components related to the present invention and are not drawn according to the actual number, shape, and size of the components in implementation. In actual implementation, the form, quantity, and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex. The structures, proportions, sizes, etc., shown in the accompanying drawings of this specification are only used to complement the content disclosed in the specification for those skilled in the art to understand and read, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modification to the structure, change in the proportional relationship, or adjustment of the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention. Furthermore, the orientations or positional relationships indicated by terms such as "upper," "lower," "left," "right," "middle," "longitudinal," "lateral," "horizontal," "inner," "outer," "radial," and "circumferential" used in this specification are based on the orientations or positional relationships shown in the accompanying drawings and are only for the purpose of simplifying the description. They do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Changes or adjustments to their relative relationships, without substantially altering the technical content, should also be considered within the scope of the present invention. Therefore, they should not be construed as limitations on the present invention. In addition, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0028] Currently, to verify the communication of critical controllers in automobiles, engineers can manually test and verify the messages sent and received by the controller after the underlying communication module has been configured. However, manual testing and verification is time-consuming, labor-intensive, and inaccurate. Therefore, existing technologies still suffer from inefficient and inaccurate communication verification.
[0029] To address this issue, this application provides a communication verification system and a communication verification method, which can improve the problems of low efficiency and inaccuracy in existing communication verification technologies. Specifically, the communication verification method is applied to a communication verification device within a communication verification system, which includes a device to be verified and a communication verification device. like Figure 1 As shown, the communication verification system includes a device to be verified 110 and a communication verification device 120. The device to be verified 110 is used to communicate with other devices via a CAN bus 130. The communication verification device 120 is used to generate and configure test nodes according to a bus database file, and to use the test nodes to perform communication verification on the device to be verified 110. The first port 121 of the communication verification device 120 is electrically connected to the device to be verified 110, and the second port 122 of the communication verification device 120 is electrically connected to the device to be verified 110 via the CAN bus 130.
[0030] Since the communication verification device 120 and the device under test 110 are electrically connected via two ports, the communication verification device 120 can perform operations such as addressing, reading, and assigning values to variables in the device under test 110 through the first port 121, and can also connect to the CAN bus 130 through the second port 122 to communicate with the device under test 110. Furthermore, when the communication verification device 120 communicates with the device under test 110 through the second port 122, it is essentially communicating with the device under test 110 using a test node. This test node is generated and configured by the communication verification device 120 based on a bus database file. The configuration steps include configuring the attributes of the test node's messages, which include at least one of variables, period, and type. When the communication verification device 120 performs communication verification using the test node, one of the test node and the device to be verified 110 is used as the sender and the other as the receiver, and the sender and receiver are controlled to communicate data. After completing one data communication or all data communication, the communication verification device 120 verifies whether the variable values in the sender and receiver are consistent. If they are consistent, it is determined that the communication configuration of the device to be verified 110 is correct.
[0031] It should be noted that the first and second ports of the communication verification device are input / output (I / O) interfaces used for data transmission between the communication verification device and other devices. The specific type of the first and second ports is consistent with the port of the device to which they are connected, and this application does not limit the specific type of the first and second ports. For example, when the second port of the communication verification device is connected to the device to be verified via a CAN bus, the second port is a serial communication (Cluster Communication, COM) port, which follows the CAN communication protocol when transmitting data; as another example, when the second port of the communication verification device is connected to an interface conversion device via a USB data cable, the second port is a USB port, which follows the USB communication protocol when transmitting data.
[0032] It should also be noted that, in addition to the communication verification device 120 and the device to be verified 110, the communication verification system may also include a debugger 140 and / or an interface conversion device 150. This application will now describe this through three possible implementations: In another possible implementation, the communication verification system includes a debugger 140 in addition to the communication verification device 120 and the device to be verified 110. Specifically, the communication verification system also includes a debugger 140 for addressing, reading, and assigning values to variables in the device to be verified 110. The first port 121 of the communication verification device 120 is electrically connected to the device to be verified 110 through the debugger 140. The debugger 140 stores a mapping table between variables in the device to be verified 110 and memory addresses.
[0033] The communication verification system includes a device to be verified 110, a communication verification device 120, and a debugger 140. The first port 121 of the communication verification device 120 is electrically connected to the device to be verified 110 via the debugger 140, and the second port 122 of the communication verification device 120 is electrically connected to the device to be verified 110 via a bus 130. Before the communication verification device 120 performs operations such as addressing, reading, and assigning values to variables in the device to be verified 110 through the first port 121, it first sends a mapping table between variables in the device to be verified 110 and their memory addresses to the debugger 140. This allows the debugger 140 to address the variables in the device to be verified 110 based on this mapping table. Therefore, when the communication verification device 120 instructs the debugger 140 to read and assign values to variables in the device to be verified 110, it first uses the mapping table for accurate addressing. It should be noted that the mapping table is a symbol table obtained by the communication verification device 120 from parsing the MAP file of the device to be verified 110. The MAP file of the device to be verified 110 is generated during the compilation process of the software running on the device to be verified 110.
[0034] In another feasible implementation, the communication verification system, in addition to the communication verification device 120 and the device to be verified 110, also includes an interface conversion device 150. Specifically, the communication verification system further includes an interface conversion device 150 for connecting the test node to the CAN bus 130. The second port 122 of the communication verification device 120 is connected to the CAN bus 130 through the interface conversion device 150, thereby electrically connecting to the device to be verified 110 on the CAN bus 130. The interface conversion device 150 is a PCAN, and the device to be verified 110 and the interface conversion device 150 are connected via a USB data cable.
[0035] The communication verification system includes a device to be verified 110, a communication verification device 120, and an interface conversion device 150. The first port 121 of the communication verification device 120 is electrically connected to the device to be verified 110. The second port 122 of the communication verification device 120 is connected to the CAN bus 130 via the interface conversion device 150, thus electrically connecting to the device to be verified 110 on the CAN bus 130. The second port 122 of the communication verification device 120 is connected to the PCAN via a USB data cable. The PCAN is connected to the device to be verified 110 via the CAN bus 130. When the PCAN receives a message from the test node in the communication verification device 120 on the USB data cable, it forwards the message to the device to be verified 110 on the CAN bus 130. When the PCAN receives a message from the device to be verified 110 on the CAN line, it forwards the message to the communication verification device 120 on the USB data cable, thereby enabling communication between the communication verification device 120 and the device to be verified 110.
[0036] In another possible implementation, the communication verification system includes, in addition to the communication verification device 120 and the device to be verified 110, an interface conversion device 150. Specifically, as shown... Figure 2 As shown, the communication verification system also includes a debugger 140 for addressing, reading, and assigning values to variables in the device to be verified 110, and an interface conversion device 150 for connecting the test node to the CAN bus 130. The first port 121 of the communication verification device 120 is electrically connected to the device to be verified 110 via the debugger 140, and the second port 122 of the communication verification device 120 is connected to the CAN bus 130 via the interface conversion device 150, thereby electrically connecting to the device to be verified 110 on the CAN bus 130. The debugger 140 stores a mapping table between variables and memory addresses in the device to be verified 110. The interface conversion device 150 is a PCAN, and the device to be verified 110 and the interface conversion device 150 are connected via a USB data cable.
[0037] The communication verification system includes a device to be verified 110, a communication verification device 120, a debugger 140, and an interface conversion device 150. The first port 121 of the communication verification device 120 is electrically connected to the device to be verified 110 through the debugger 140, and the second port 122 of the communication verification device 120 is connected to the CAN bus 130 through the interface conversion device 150, thereby electrically connecting to the device to be verified 110 on the CAN bus 130.
[0038] In summary, this application provides a communication verification system, which includes a communication verification device and a device to be verified. The communication verification device in this system can generate and configure test nodes according to a bus database file, and utilizes these test nodes to perform communication verification on the device to be verified. Since the test nodes are automatically generated and configured based on the bus database file, communication between the test nodes and the device to be verified can cover various communication scenarios, more closely reflecting the actual communication situation of the device to be verified, without the need for manual testing and verification. Therefore, by adopting the communication verification system, communication verification device, and communication verification method provided in this application, the problems of low efficiency and inaccuracy in existing communication verification technologies can be improved.
[0039] In one embodiment, such as Figure 3 As shown, this application provides a communication verification method, which is applied to... Figure 1 The communication verification system shown is described below. Next, this application will use the communication verification device within the communication verification system as an example to illustrate the process, including the following steps: 301: Generate test nodes based on the bus database file and configure the attributes of the test node's messages.
[0040] To simulate test nodes that can communicate with the device under test on the CAN bus, the communication verification device first parses the bus database file to generate and configure test nodes. Configuring the test nodes involves configuring the attributes of the messages for each test node. Message attributes include at least one of variables, period, and type. Messages include both transmitted and received messages. Therefore, since the bus database file completely and clearly defines communication in the CAN network, the test nodes generated and configured based on the bus database file can comprehensively cover all communicable nodes on the CAN bus, as well as the messages that nodes can send and receive. Optionally, before parsing the bus database file, the completeness and correctness of the bus database file can be verified. If the bus database file is determined to be complete and correct, step 301 above is executed; otherwise, a message indicating an error in the bus database file is displayed.
[0041] 302: Designate one of the test node and the device to be verified as the sender and the other as the receiver, and control the sender and receiver to communicate data.
[0042] In this communication verification device, one of the test node and the device to be verified is used as the sender and the other as the receiver. If the test node is the sender, it is controlled to send a message to the device to be verified through the second port. If the device to be verified is the sender, it is controlled to send a message to the test node in the communication verification device through the first port, thereby controlling the data communication between the test node and the device to be verified.
[0043] 303: Verify whether the variable values in the sending end and the receiving end are consistent. If they are consistent, it is determined that the communication configuration of the device to be verified is correct.
[0044] Because the variable values in the message may change due to incorrect communication configuration of the device under test, and the receiving end stores these variable values in its local database after receiving the message, the communication verification device can determine whether the communication configuration of the device under test is correct by checking whether the variable values at the sending end and the receiving end are consistent. Specifically, after completing one or several data communications between the test node and the device under test, the communication verification device verifies whether the variable values at the sending end and the receiving end are consistent. If they are consistent, the communication configuration of the device under test is determined to be correct; otherwise, the communication configuration is determined to be incorrect.
[0045] In one feasible approach, the steps of controlling the data communication between the sending end and the receiving end include: assigning values to variables in the sending end using a preset test dataset, causing the sending end to send a message to the receiving end, wherein the message includes the variable values of the assigned variables; and after the receiving end receives the message sent by the sending end, reading the variable values of the assigned variables in the receiving end.
[0046] In order to control data communication between the sending and receiving ends, the communication verification device first assigns values to variables in the sending end using a preset test dataset. This causes the sending end to send a message containing the values of the assigned variables to the receiving end. After the receiving end receives the message and stores the values of the assigned variables in the message, it reads the values of the assigned variables from the receiving end. It should be noted that the preset test dataset includes at least one numerical value. The preset test dataset can be pre-set or randomly generated; this application does not impose any restrictions on this. Specifically, if the sending end is a test node and the receiving end is a device to be verified, the communication verification device assigns values to the variables in the test node according to a preset test dataset, causing the test node to generate a message including the values of the assigned variables, and sends the message to the device to be verified, so that the device to be verified stores the values of the assigned variables in its local database. If the sending end is a device to be verified and the receiving end is a test node, the device to be verified assigns values to the variables in the device to be verified according to a preset test dataset, causing the device to generate a message including the values of the assigned variables, and sends the message to the test node, so that the test node stores the values of the assigned variables in its local database.
[0047] In one feasible approach, the step of verifying whether the variable values in the sending end and the receiving end are consistent, and determining that the communication configuration of the device under test is correct if they are consistent, includes: when the sending end is a test node, verifying whether the variable values in the device under test are consistent with the variable values in the test node; if they are consistent, determining that the communication configuration of the device under test is correct in the receiving direction; when the sending end is the device under test, verifying whether the variable values in the test node are consistent with the variable values in the device under test; if they are consistent, determining that the communication configuration of the device under test is correct in the sending direction; and if the communication configuration of the device under test is correct in both the receiving and sending directions, then determining that the communication configuration of the device under test is correct.
[0048] Based on the direction of message transmission, the communication configuration of the device under test can be divided into communication configuration in the sending direction and communication configuration in the receiving direction. Specifically, if the device under test is the sender, then if the variable values in the test node are consistent with the variable values in the device under test, the communication configuration in the sending direction is determined to be correct; otherwise, it is determined to be incorrect. If the device under test is the receiver, then if the variable values in the device under test are consistent with the variable values in the test node, the communication configuration in the receiving direction is determined to be correct; otherwise, it is determined to be incorrect. If the communication configuration in both the sending and receiving directions is correct, then the communication configuration of the device under test is determined to be correct.
[0049] In summary, since the communication verification device first generates test nodes based on the bus database file and configures the variables, periodicity, and / or type of the test node's messages, and then uses the test nodes to perform communication verification on the device to be verified, it can be seen that the communication verification system provided in this application can quickly and realistically simulate the communication process of the device to be verified, so as to realize automatic, comprehensive, and periodic communication verification of the device to be verified, thereby improving the problems of low efficiency and inaccuracy of communication verification in the prior art.
[0050] In another embodiment, such as Figure 4 As shown, this application also provides a communication verification method, which is applied to Figure 2 The communication verification system shown is described below. Next, this application will use the communication verification device in this communication verification system as an example to illustrate the process, including the following steps: 401: Initialize the interface conversion device and debugger.
[0051] The initialization of the interface conversion device and debugger by the communication verification device refers to setting up the connection of the interface conversion device and debugger, so that the communication verification device can interact with the interface conversion device and debugger. For example, after the interface conversion device is initialized, the communication verification device can send and receive data on the CAN bus through the interface conversion device. After the debugger is initialized, the communication verification device can interact with the device to be verified through the debugger.
[0052] 402: Parse the MAP file of the device to be verified, obtain the mapping table between variables and memory addresses, and send the mapping table to the debugger.
[0053] In order for the communication verification device to perform operations such as reading and assigning values to variables in the device under verification via a debugger, it first needs to achieve correct addressing of the variables in the device under verification. To do this, the communication verification device first obtains the MAP file of the software running on the device under verification and parses the MAP file to obtain a symbol table, which is a mapping table between variables in the device under verification and memory addresses. The communication verification device then sends this mapping table to the debugger. When the communication verification device needs to operate on a variable in the device under verification, it sends a command to the debugger, allowing the debugger to quickly find the memory address corresponding to the variable to be operated on based on the locally stored mapping table, and then read or assign the value of the variable at that memory address, thereby enabling the reading and assignment of arbitrary variables in the device under verification.
[0054] 403: Generate test nodes based on the bus database file and configure the attributes of the test node's messages.
[0055] The communication verification device first generates a test node based on the bus database file, and then configures the attributes of the messages of the test node. The message attributes include at least one of variables, period, and type. The messages include sent messages and received messages. Through the configuration of the test node, the test node can periodically send messages of a preset type containing preset variables according to a preset period.
[0056] 404: Designate one of the test node and the device to be verified as the sender and the other as the receiver, and control the sender and receiver to communicate data.
[0057] In this system, the communication testing equipment controls data communication between the sending and receiving ends by assigning values to variables in the sending end. Specifically, when the test node is the sending end and the device under test is the receiving end, the communication verification equipment assigns values to the variables in the test node using a preset test dataset. After the variables are assigned values, the test node sends a message containing the values of the assigned variables to the device under test on the CAN bus via an interface conversion device. Upon receiving the message, the device under test stores the values of the assigned variables. When the device under test is the sending end and the test node is the receiving end, the communication verification equipment first addresses the variables that need to be assigned values in the device under test using a debugger, and then assigns values to the addressed variables using a preset test dataset. After the variables are assigned values, the device under test sends a message containing the values of the assigned variables to the test node via the CAN bus. Upon receiving the message, the test node stores the values of the assigned variables.
[0058] 405: Verify whether the variable values in the sending end and the receiving end are consistent. If they are consistent, it is determined that the communication configuration of the device to be verified is correct.
[0059] In this process, after one or more communications between the test node and the device under test, the communication verification device reads and compares the variable values in the receiving and sending ends. If they match, the communication configuration of the device under test is correct; otherwise, the communication configuration is incorrect. Specifically, when the sending end is the test node, it verifies whether the variable values in the device under test and the test node are consistent. If they match, the communication configuration of the device under test in the receiving direction is correct. When the sending end is the device under test, it verifies whether the variable values in the test node and the device under test are consistent. If they match, the communication configuration of the device under test in the sending direction is correct. If the communication configuration of the device under test is correct in both the receiving and sending directions, then the communication configuration of the device under test is considered correct.
[0060] In summary, this application also provides an implementation process for the communication verification method in another embodiment. The communication verification device interacts with the device under test via an interface conversion device, and simultaneously manipulates variables within the device under test using a debugger, thereby enabling control over the communication process between the test node and the device under test. Furthermore, since the test node is automatically generated and configured based on the bus database file, the communication verification method provided in this application can achieve automatic, comprehensive, and periodic communication verification of the device under test, thus improving the problems of low efficiency and inaccuracy in existing communication verification technologies.
[0061] In one embodiment, the present invention also provides a communication verification device, see [link to relevant documentation]. Figure 5 The embodiments of the present invention can divide the device into functional units according to the above method examples. For example, each function can be divided into separate functional units, or two or more functions can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in the embodiments of the present invention is illustrative and only represents one logical functional division; other division methods may be used in actual implementation. Figure 5 As shown, the communication verification device includes an initialization unit 510, a communication unit 520, and a verification unit 530. Specifically: the initialization unit 510 is used to generate test nodes according to the bus database file and configure the attributes of the messages of the test nodes, wherein the message attributes include at least one of variables, period, and type; the communication unit 520 is used to use one of the test nodes and the device to be verified as the sender and the other as the receiver, and to control the sender and receiver to communicate data; the verification unit 530 is used to verify whether the variable values in the sender and the receiver are consistent. If they are consistent, it is determined that the communication configuration of the device to be verified is correct.
[0062] In one implementable manner, the communication unit 530 is specifically used to: assign values to variables in the sending end using a preset test dataset, so that the sending end sends a message to the receiving end, wherein the message includes the variable values of the assigned variables; after the receiving end receives the message sent by the sending end, the receiving end reads the variable values of the assigned variables.
[0063] In one implementable manner, the initialization unit 510 is further configured to: initialize the interface conversion device and the debugger; parse the MAP file of the device to be verified to obtain a mapping table of variables and memory addresses, and send the mapping table to the debugger to enable addressing of variables in the device to be verified; and control the data communication between the sending end and the receiving end, including: controlling the data communication between the sending end and the receiving end through the interface conversion device and the debugger.
[0064] In one implementable manner, the verification unit 530 is specifically used to: verify whether the variable values in the device to be verified are consistent with the variable values in the test node when the sending end is a test node; if they are consistent, it is determined that the communication configuration of the device to be verified is correct in the receiving direction; verify whether the variable values in the test node are consistent with the variable values in the device to be verified when the sending end is the device to be verified; if they are consistent, it is determined that the communication configuration of the device to be verified is correct in the sending direction; and if the communication configuration of the device to be verified is correct in both the receiving and sending directions, it is determined that the communication configuration of the device to be verified is correct.
[0065] In one embodiment, this application also provides a communication verification device, see [link to relevant documentation]. Figure 6 The communication verification device can be, but is not limited to, various personal computers, laptops, smartphones, tablets, portable wearable devices, and servers. The server can be a standalone server or a server cluster consisting of multiple servers. As shown in the figure, the communication verification device in this embodiment may include a processor 610 and a memory 620. The processor 610 and the memory 620 are connected via a link 630. The processor 610 is used to execute multiple instructions; the memory 620 is used to store multiple instructions adapted to be loaded by the processor 610 and executed as in the communication verification method described in the above embodiment.
[0066] The processor 610 can be an Electronic Control Unit (ECU), a Central Processing Unit (CPU), a general-purpose processor, a coprocessor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The processor 610 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc. In this embodiment, the processor 610 can be a microcontroller. By programming the microcontroller, various control functions can be implemented. For example, in this embodiment, the processor can acquire, process, and demodulate the battery cell capacity and total accumulated charge. The processor has the advantages of powerful computing capabilities and fast processing speed. Specifically: the processor 610 is used to execute the initialization unit 510, which generates test nodes according to the bus database file and configures the attributes of the test node's messages, wherein the message attributes include at least one of variables, period, and type; it is also used to execute the function of the communication unit 520, which uses one of the test node and the device to be verified as the sender and the other as the receiver, and controls the sender and receiver to communicate data; it is also used to execute the function of the verification unit 530, which verifies whether the variable values in the sender and the receiver are consistent, and if they are consistent, determines that the communication configuration of the device to be verified is correct.
[0067] In one implementable manner, the processor 610 is specifically used to: assign values to variables in the sending end using a preset test dataset, so that the sending end sends a message to the receiving end, wherein the message includes the variable values of the assigned variables; after the receiving end receives the message sent by the sending end, the receiving end reads the variable values of the assigned variables.
[0068] In one implementable manner, the processor 610 is further configured to: initialize the interface conversion device and the debugger; parse the MAP file of the device to be verified to obtain a mapping table of variables and memory addresses, and send the mapping table to the debugger to enable addressing of variables in the device to be verified; and control the data communication between the sending end and the receiving end, including: controlling the data communication between the sending end and the receiving end through the interface conversion device and the debugger.
[0069] In one implementable manner, the processor 610 is specifically used to: verify whether the variable values in the device to be verified are consistent with the variable values in the test node when the sending end is a test node; if they are consistent, determine that the communication configuration of the device to be verified is correct in the receiving direction; verify whether the variable values in the test node are consistent with the variable values in the device to be verified when the sending end is the device to be verified; if they are consistent, determine that the communication configuration of the device to be verified is correct in the sending direction; and determine that the communication configuration of the device to be verified is correct when the communication configuration of the device to be verified is correct in both the receiving and sending directions.
[0070] In one possible implementation, this application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor and executing the methods in any of the foregoing embodiments. A processor 610 is configured to execute the plurality of instructions; a memory 620 is configured to store the plurality of instructions adapted for loading by the processor 610 and executing the communication verification method as described in the foregoing embodiments.
[0071] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0072] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A communication verification system, characterized in that, include: A device to be verified for communicating with other devices via the CAN bus; A communication verification device for generating and configuring test nodes based on a bus database file, and for using the test nodes to perform communication verification on the device to be verified; The bus database file defines the communication in the CAN network, and the test node fully covers all communicable nodes on the CAN bus, as well as the messages that the nodes can send and receive. The first port of the communication verification device is electrically connected to the device to be verified, and the second port of the communication verification device is electrically connected to the device to be verified through the CAN bus. And a debugger for addressing, reading and assigning values to variables in the device to be verified; The first port of the communication verification device is electrically connected to the device to be verified through the debugger; the debugger stores a mapping table between variables and memory addresses in the device to be verified. The communication verification device is further configured to use one of the test node and the device to be verified as a sender and the other as a receiver, and to control the sender and receiver to perform data communication, including: When the device to be verified is the sender and the test node is the receiver, the debugger is instructed to address the variables in the device to be verified according to the mapping table, and to assign values to the addressed variables using a preset test dataset, so that the device to be verified sends a message to the test node, wherein the message includes the variable values of the assigned variables. After completing one or more data communications between the test node and the device to be verified, the variable values received in the test node are read. Verify whether the variable values assigned in the device to be verified are consistent with the variable values read in the test node; If they match, the communication configuration of the device to be verified is correct; if they do not match, the communication configuration of the device to be verified is incorrect.
2. The system according to claim 1, characterized in that, The system also includes: An interface conversion device for connecting the test node to the CAN bus; The second port of the communication verification device is connected to the CAN bus through the interface conversion device, thereby electrically connecting to the device to be verified on the CAN bus; the interface conversion device is a PCAN, and the device to be verified and the interface conversion device are electrically connected via a USB data cable.
3. A communication verification method, applied to a communication verification device, characterized in that, include: Test nodes are generated based on the bus database file, and the attributes of the messages of the test nodes are configured. The bus database file defines the communication in the CAN network, and the test nodes fully cover all communicable nodes on the CAN bus, as well as the messages that the nodes can send and receive. The attributes of the messages include at least one of variables, period, and type. Using one of the test node and the device to be verified as the sender and the other as the receiver, and controlling the sender and receiver to communicate data, includes: The variables in the sending end are assigned values using a preset test dataset, so that the sending end sends a message to the receiving end, wherein the message includes the variable values of the assigned variables; After the receiving end receives the message sent by the sending end, the receiving end reads the value of the assigned variable. Verify whether the variable values in the sending end and the receiving end are consistent. If they are consistent, it is determined that the communication configuration of the device to be verified is correct.
4. The method according to claim 3, characterized in that, Before the step of controlling the sending end and the receiving end to perform data communication, the method further includes: Initialize the interface conversion device and debugger; The MAP file of the device to be verified is parsed to obtain a mapping table between variables and memory addresses, and the mapping table is sent to the debugger to enable addressing of variables in the device to be verified. The step of controlling the sending end and the receiving end to communicate data includes: controlling the sending end and the receiving end to communicate data through the interface conversion device and the debugger.
5. The method according to claim 3, characterized in that, The step of verifying whether the variable values in the sending end and the receiving end are consistent, and determining that the communication configuration of the device to be verified is correct if they are consistent, includes: When the sending end is the test node, verify whether the variable values in the device to be verified are consistent with the variable values in the test node. If they are consistent, it is determined that the communication configuration of the device to be verified in the receiving direction is correct. When the sending end is the device to be verified, verify whether the variable values in the test node are consistent with the variable values in the device to be verified. If they are consistent, it is determined that the communication configuration of the device to be verified is correct in the sending direction. If the communication configuration of the device to be verified is correct in both the receiving and transmitting directions, then the communication configuration of the device to be verified is determined to be correct.
6. A communication verification device, characterized in that, include: An initialization unit is used to generate test nodes based on a bus database file and configure the attributes of the messages of the test nodes. The bus database file defines the communication in the CAN network, and the test nodes fully cover all communicable nodes on the CAN bus, as well as the messages that the nodes can send and receive. The attributes of the messages include at least one of variables, period, and type. A communication unit, configured to use one of the test node and the device to be verified as a transmitter and the other as a receiver, and to control the transmitter and receiver to communicate data, includes: The variables in the sending end are assigned values using a preset test dataset, so that the sending end sends a message to the receiving end, wherein the message includes the variable values of the assigned variables; After the receiving end receives the message sent by the sending end, the receiving end reads the value of the assigned variable. The verification unit is used to verify whether the variable values in the sending end and the variable values in the receiving end are consistent. If they are consistent, it is determined that the communication configuration of the device to be verified is correct.
7. A communication verification device, characterized in that, The device includes a processor and a memory connected via a bus; the processor is used to execute multiple instructions; the memory is used to store the multiple instructions, which are adapted to be loaded by the processor and executed as the communication verification method as described in any one of claims 3-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor and executing the communication verification method as described in any one of claims 3-5.
Citation Information
Patent Citations
Bus message checking method, device and system for hardware in-loop testing
CN109634258A