Automated testing method and system for can communication card
Patent Information
- Application Number
- CN202610640902.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-11
- Publication Date
- 2026-09-11
AI Technical Summary
[0003]本公开要解决的技术问题是为了克服现有CAN通讯卡测试技术中存在功能覆盖不足、兼容性验证缺失、实时性缺陷、数据分析效率低的缺陷,提供一种CAN通讯卡的自动化测试方法及系统
[0043] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described automated testing method for a CAN communication card.
Smart Images

Figure CN122741401A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial communication testing technology, specifically relating to an automated testing method and system for CAN communication cards. Background Technology
[0002] As wind turbine generators become larger and more intelligent, the application of CAN (Controller Area Network) bus in wind power control systems is becoming increasingly widespread, primarily for real-time communication of key components such as pitch systems, converters, and sensor networks. As the core communication protocol between the wind power main control system and execution units, CANopen (a high-level communication protocol based on the CAN bus) is widely used for status monitoring and safety protection of wind turbine equipment due to its high reliability and real-time performance, such as the transmission of Emergency Shutdown Cycle (EMCY) commands. However, existing CAN communication card testing technologies in the wind power industry have the following prominent problems: Insufficient functional coverage: Traditional testing relies on manual operation, making it difficult to fully verify complex scenarios such as SDO (communication method for accessing the device object dictionary) parameter modification, NMT (state machine for controlling each node in the CANopen network) command response, and PDO (synchronous / asynchronous transmission for efficient transmission of real-time process data). Lack of compatibility verification: Most test systems do not cover stability at different baud rates (20Kb / s to 1000Kb / s) and lack dynamic adaptation capabilities for multiple CAN slave models. Real-time performance deficiencies: Key indicators such as EMCY message processing and PDO data packet loss rate under high-load scenarios (e.g., bus utilization above 50%) lack automated verification methods. Low data analysis efficiency: Test data relies on manual parsing and cannot be automated through scripts for error frame detection, bus load calculation, and other analyses. Therefore, developing a full-scenario, highly reliable CAN communication card test system for the wind power industry is of great significance for ensuring the safe operation of wind turbines and reducing maintenance costs. Summary of the Invention
[0003] The technical problem to be solved by this disclosure is to overcome the shortcomings of existing CAN communication card testing technology, such as insufficient functional coverage, lack of compatibility verification, real-time defects, and low data analysis efficiency, and to provide an automated testing method and system for CAN communication cards.
[0004] This disclosure solves the above-mentioned technical problems through the following technical solution:
[0005] This disclosure provides an automated testing method for a CAN communication card, the automated testing method for the CAN communication card including:
[0006] Traverse any target baud rate within the preset baud rate range, and trigger the CAN communication card under test and at least one CAN slave station on the CAN bus to generate a closed-loop verification link through periodic synchronization frames;
[0007] In response to the bus load rate of the CAN bus being greater than or equal to 50%, the first data corresponding to the closed-loop verification link is acquired; wherein, the first data includes at least one of the following: the packet loss rate of the process data and the error frames of the process data;
[0008] Based on the first data, the stability level of the CAN communication card under test at the target baud rate is determined.
[0009] Preferably, the automated testing method for the CAN communication card further includes:
[0010] In response to the bus load rate of the CAN bus being greater than or equal to 70%, a standard emergency error code is injected into the CAN slave station, triggering the CAN slave station to send an emergency message to the CAN communication card under test, and the second data of the emergency message received by the CAN communication card under test is obtained; wherein, the second data includes at least one of the delay time of the emergency message and the error code of the emergency message;
[0011] The reliability of the CAN communication card under test is determined based on the second data.
[0012] Preferably, the automated testing method for the CAN communication card further includes:
[0013] The CAN communication card under test sends a modify SDO command or an abnormal SDO request to the CAN slave station.
[0014] Obtain the third data returned by the CAN slave station;
[0015] The parameter adaptation capability of the CAN communication card under test is determined based on the third data.
[0016] And / or,
[0017] The CAN communication card under test sends an abnormal SDO request to the CAN slave station;
[0018] The abnormal SDO request includes at least one of the following: accessing an illegal index, writing excessively long data, or making high-frequency continuous requests.
[0019] Obtain the fourth data returned by the CAN slave station;
[0020] The robustness of the CAN communication card under test is determined based on the fourth data.
[0021] Preferably, the automated testing method for the CAN communication card further includes:
[0022] The CAN communication card under test sequentially sends network management commands to control the CAN slave station to enter the running state; wherein, the running state includes at least one of the following: pre-operation state, operation state, stop state, and reset state;
[0023] Obtain the fifth data returned by the CAN slave station; wherein the fifth data includes a heartbeat message or a start message;
[0024] The completeness of the network management function of the CAN communication card under test is determined based on the fifth data.
[0025] Preferably, the step of obtaining the first data corresponding to the closed-loop verification link includes:
[0026] The first data is detected and calculated using a preset script;
[0027] And / or,
[0028] The preset baud rate range is greater than or equal to 20 kilobits per second, and the preset baud rate range is less than or equal to 1000 kilobits per second;
[0029] And / or,
[0030] The periodic synchronization frame has a period of 100 milliseconds, 500 milliseconds, or 1000 milliseconds.
[0031] This disclosure also provides an automated testing system for CAN communication cards, the automated testing system for CAN communication cards comprising:
[0032] The verification module is used to traverse any target baud rate within the preset baud rate range and trigger the CAN communication card under test to generate a closed-loop verification link with at least one CAN slave station on the CAN bus through periodic synchronization frames.
[0033] The acquisition module is configured to acquire first data corresponding to the closed-loop verification link in response to the bus load rate of the CAN bus being greater than or equal to 50%; wherein the first data includes at least one of the following: packet loss rate of process data and error frames of process data;
[0034] The determination module is used to determine the stability level of the CAN communication card under test at the target baud rate based on the first data.
[0035] This disclosure also provides an automated testing device for a CAN communication card, applied to the CAN communication card, to implement the automated testing method for the CAN communication card as described above. The automated testing device for the CAN communication card includes: a CAN slave station and a CAN bus analyzer.
[0036] The CAN communication card under test is connected in parallel to the CAN slave and the CAN bus analyzer via a twisted pair cable to the same CAN bus;
[0037] The CAN bus analyzer is used to monitor bus data and determine at least one of the first data, second data, third data, fourth data, and fifth data based on the bus data.
[0038] Preferably, the automated testing device for the CAN communication card further includes: a host computer and a controller;
[0039] The controller is connected to the host computer via Ethernet, the CAN bus analyzer is connected to the host computer via USB, and the controller and the CAN communication card under test are connected via Ethernet.
[0040] The host computer is used to run test scripts, generate test cases, and send control commands to the controller;
[0041] The controller is used to receive the control command, convert the control command into an SDO command or a network management command, and send the SDO command or network management command to the CAN bus through the CAN communication card under test.
[0042] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described automated testing method for a CAN communication card.
[0043] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described automated testing method for a CAN communication card.
[0044] Based on common knowledge in the field, the above-mentioned preferred conditions can be combined arbitrarily to obtain various preferred embodiments of this disclosure.
[0045] The positive and progressive effects of this disclosure are as follows:
[0046] This disclosure establishes a closed-loop verification link between the master station (the CAN communication card under test) and the slave station (at least one CAN slave station on the CAN bus) by iterating through baud rates, ensuring the integrity of communication data. Then, by switching baud rates, the stability of the CAN communication card is verified across the entire rate range. Attached Figure Description
[0047] Figure 1 A flowchart illustrating an automated testing method for a CAN communication card, provided as an exemplary embodiment of this disclosure;
[0048] Figure 2A schematic diagram of the structure of an automated testing system for a CAN communication card provided as an exemplary embodiment of this disclosure;
[0049] Figure 3 A schematic diagram of the structure of an automated testing device for a CAN communication card provided as an exemplary embodiment of this disclosure;
[0050] Figure 4 A hardware architecture diagram of a specific example of an automated testing apparatus for a CAN communication card provided as an exemplary embodiment of this disclosure;
[0051] Figure 5 A multi-mode test comparison diagram illustrating a specific example of an automated testing apparatus for a CAN communication card provided as an exemplary embodiment of this disclosure;
[0052] Figure 6 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of the present disclosure. Detailed Implementation
[0053] The present disclosure is further illustrated below by way of embodiments, but the present disclosure is not limited to the scope of the embodiments described herein.
[0054] The prefixes such as "first" and "second" used in this disclosure are merely for distinguishing different descriptive objects and do not limit the position, order, priority, quantity, or content of the described objects. The use of ordinal numbers and other prefixes used to distinguish descriptive objects in this disclosure does not constitute a limitation on the described objects. The description of the described objects is given in the claims or the context of the embodiments, and should not be construed as an unnecessary limitation. Furthermore, in the description of this embodiment, unless otherwise stated, "multiple" means two or more.
[0055] In this embodiment of the disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information comply with relevant laws and regulations and do not violate public order and good morals.
[0056] Example 1
[0057] Figure 1 A flowchart illustrating an automated testing method for a CAN communication card, as provided in an exemplary embodiment of this disclosure, is shown below. Figure 1 As shown, the automated testing methods for CAN communication cards include:
[0058] S1. Traverse any target baud rate within the preset baud rate range, and trigger the CAN communication card under test and at least one CAN slave station on the CAN bus to generate a closed-loop verification link through periodic synchronization frames.
[0059] The preset baud rate range is greater than or equal to 20 kilobits per second, and less than or equal to 1000 kilobits per second. The periodic synchronization frame period is 100 milliseconds, 500 milliseconds, or 1000 milliseconds.
[0060] S2. In response to the CAN bus load rate being greater than or equal to 50%, obtain the first data corresponding to the closed-loop verification link.
[0061] In an optional implementation, step S2 includes:
[0062] S21. Detect and calculate the first data using a preset script.
[0063] The first data includes at least one of the following: packet loss rate of process data and error frames of process data.
[0064] S3. Determine the stability of the CAN communication card under test at the target baud rate based on the first data.
[0065] This embodiment establishes a closed-loop verification link between the master station (the CAN communication card under test) and the slave station (at least one CAN slave station on the CAN bus) by traversing the baud rates, ensuring the integrity of the communication data. Then, by switching the baud rate, the stability of the CAN communication card is verified across the entire rate range.
[0066] In an optional implementation, the automated testing method for CAN communication cards further includes:
[0067] S4. In response to the bus load rate of the CAN bus being greater than or equal to 70%, inject a standard emergency error code into the CAN slave, trigger the CAN slave to send an emergency message to the CAN communication card under test, and obtain the second data of the emergency message received by the CAN communication card under test.
[0068] The second data includes at least one of the following: the delay time of the emergency message and the error code of the emergency message.
[0069] S5. Determine the reliability level of the CAN communication card under test based on the second data.
[0070] In this implementation, standard error codes (e.g., 0x8130) and EMCY messages under high load scenarios are simulated using an analyzer. Node failures (e.g., 0x01 general error) are simulated to verify the CAN communication card's ability to parse and process emergency messages in real time. EMCY is triggered under 70% bus load to test the CAN communication card's real-time performance and priority mechanism.
[0071] In an optional implementation, the automated testing method for CAN communication cards further includes:
[0072] S611, the CAN communication card under test sends a modify SDO command or an abnormal SDO request to the CAN slave station.
[0073] S612, Obtain the third data returned by the CAN slave station.
[0074] S613. Determine the parameter adaptation capability of the CAN communication card under test based on third data.
[0075] In this embodiment, the response of the CAN slave station is verified to meet expectations by simulating SDO commands (e.g., modifying heartbeat time parameters) or injecting abnormal data (e.g., invalid indexes or sub-indexes). The parameter adaptation capability of the CAN communication card under test is verified by adjusting the SDO task cycle in real time through the object dictionary.
[0076] In an optional implementation, the automated testing method for CAN communication cards further includes:
[0077] S621, The CAN communication card under test sends an abnormal SDO request to the CAN slave station.
[0078] Abnormal SDO requests include at least one of the following: accessing an illegal index, writing excessively long data, or making high-frequency continuous requests.
[0079] S622. Obtain the fourth data returned by the CAN slave station.
[0080] S623. Determine the robustness capability of the CAN communication card under test based on the fourth data.
[0081] In this embodiment, an abnormal SDO request is introduced to verify the robustness of the CAN communication card under test.
[0082] In an optional implementation, the automated testing method for CAN communication cards further includes:
[0083] S7. The CAN communication card under test sends network management commands in sequence to control the CAN slave to enter the running state.
[0084] The operating state includes at least one of the following: pre-operation state, operation state, stop state, and reset state.
[0085] S8. Obtain the fifth data returned by the CAN slave station.
[0086] The fifth piece of data includes heartbeat messages or start messages.
[0087] S9. Determine the completeness of the network management function of the CAN communication card under test based on the fifth data.
[0088] In this embodiment, NMT commands (Network Management, the core mechanism for network management in the CANopen communication protocol) such as start, stop, pre-run, reset node, and reset communication are sent and forwarded to the CAN communication card under test to verify whether it responds correctly and broadcasts control messages. The system tests all NMT state switching commands to ensure that the CAN communication card under test complies with the CANopen (a protocol) network management specifications.
[0089] Example 2
[0090] Corresponding to the aforementioned embodiments of automated testing methods for CAN communication cards, this disclosure also provides embodiments of automated testing systems for CAN communication cards.
[0091] Figure 2 This is a schematic diagram of an automated testing system for a CAN communication card, provided as an exemplary embodiment of the present disclosure. The automated testing system for the CAN communication card includes:
[0092] Verification module 1 is used to traverse any target baud rate within a preset baud rate range and trigger the CAN communication card under test to generate a closed-loop verification link with at least one CAN slave station on the CAN bus through periodic synchronization frames.
[0093] The preset baud rate range is greater than or equal to 20 kilobits per second, and the preset baud rate range is less than or equal to 1000 kilobits per second; the period of the periodic synchronization frame is 100 milliseconds, 500 milliseconds, or 1000 milliseconds.
[0094] Acquisition module 2 is used to acquire the first data corresponding to the closed-loop verification link in response to the bus load rate of the CAN bus being greater than or equal to 50%.
[0095] The first data includes at least one of the following: packet loss rate of process data and error frames of process data.
[0096] Module 3 is used to determine the stability level of the CAN communication card under test at the target baud rate based on the first data.
[0097] In an optional implementation, the acquisition module 2 is further configured to, in response to a bus load rate of 70% or greater than or equal to 70%, inject a standard emergency error code into the CAN slave, trigger the CAN slave to send an emergency message to the CAN communication card under test, and acquire the second data of the emergency message received by the CAN communication card under test.
[0098] The second data includes at least one of the following: the delay time of the emergency message and the error code of the emergency message;
[0099] The determination module 3 is also used to determine the reliability level of the CAN communication card under test based on the second data.
[0100] In an optional implementation, see Figure 2 The automated testing system for CAN communication cards also includes:
[0101] Command module 4 is used for the CAN communication card under test to send a modify SDO command or an abnormal SDO request to the CAN slave station.
[0102] Module 2 is also used to acquire third data returned by the CAN slave station.
[0103] Module 3 is also used to determine the parameter adaptation capability of the CAN communication card under test based on third data.
[0104] In an optional implementation, instruction module 4 is also used to send an abnormal SDO request from the CAN communication card under test to the CAN slave station.
[0105] Abnormal SDO requests include at least one of the following: accessing an illegal index, writing excessively long data, or making high-frequency continuous requests.
[0106] Module 2 is also used to acquire the fourth data returned by the CAN slave station.
[0107] Module 3 is also used to determine the robustness capability of the CAN communication card under test based on the fourth data.
[0108] In an optional implementation, the instruction module 4 is also used to send network management commands sequentially to the CAN communication card under test to control the CAN slave station to enter the running state.
[0109] The operating state includes at least one of the following: pre-operation state, operation state, stop state, and reset state.
[0110] Module 2 is also used to acquire the fifth data returned by the CAN slave station.
[0111] The fifth piece of data includes heartbeat messages or start messages.
[0112] Module 3 is also used to determine the completeness of the network management function of the CAN communication card under test based on the fifth data.
[0113] In an optional implementation, the acquisition module 2 is further configured to detect and calculate the first data via a preset script.
[0114] For the system embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure solution according to actual needs.
[0115] Example 3
[0116] This embodiment provides an automated testing device for CAN communication cards, applied to CAN communication cards, to implement the automated testing method for CAN communication cards as described above. (See also...) Figure 3 The automated testing device for CAN communication cards includes: CAN slave station 301 and CAN bus analyzer 302.
[0117] The CAN communication card under test is connected in parallel to the same CAN bus via a twisted pair cable to the CAN slave 301 and the CAN bus analyzer 302.
[0118] The CAN bus analyzer 302 is used to monitor bus data and determine at least one of the first data, second data, third data, fourth data, and fifth data based on the bus data.
[0119] In an optional implementation, see Figure 3 The automated testing device for CAN communication cards also includes: host computer 303 and controller 304.
[0120] The controller 304 is connected to the host computer 303 via Ethernet, the CAN bus analyzer 302 is connected to the host computer 303 via USB, and the controller 304 and the CAN communication card under test are connected via Ethernet.
[0121] The host computer 303 is used to run test scripts, generate test cases, and send control commands to the controller 304.
[0122] The controller 304 is used to receive control commands, convert the control commands into SDO commands or network management commands, and send the SDO commands or network management commands to the CAN bus through the CAN communication card under test.
[0123] The following is a specific example to illustrate the automated testing device for the CAN communication card in this embodiment.
[0124] like Figure 4As shown, the hardware architecture of this example includes a host computer (Windows 10, Python 3.8), a controller (ARM, integrating the CANopen master protocol stack), a CAN communication card under test (supporting CANopen DS301 V4.2), heterogeneous slave stations (3 types: servo drivers with CiA402 protocol, and analog slave nodes), a CAN bus analyzer (VECTOR 1640A, bandwidth 1GS / s), and cables (twisted pair shielded cable, characteristic impedance 120Ω±10%).
[0125] 1. Host computer: Runs test scripts (Python / CANoe, etc.), generates test cases, and sends control commands.
[0126] 2. Controller: Receives instructions from the host computer, converts them into CANopen protocol messages (such as SDO / NMT), and sends them to the bus through the CAN communication card under test.
[0127] 3. CAN communication card under test: Connects to the CAN bus and supports dynamic PDO mapping (32TPDO / 32RPDO) and multi-baud rate adaptive.
[0128] IV. CAN Slave: Includes different models of devices used to simulate heterogeneous nodes in real-world scenarios.
[0129] 5. CAN bus analyzer (e.g., VECTOR 1640A): Monitors bus data, records error frames and load rates, and supports data simulation (such as sine waves and incremental sequences), records raw data, and generates log files.
[0130] The CAN communication card under test is connected in parallel to the CAN slave and CAN bus analyzer via twisted pair cable to the same bus. The controller is connected to the host computer via Ethernet, the CAN bus analyzer is connected to the host computer via USB, and the controller and the CAN communication card under test are connected via Ethernet.
[0131] Figure 5 This example demonstrates a multi-mode test comparison. The specific test procedure and conditions are as follows:
[0132] I. SDO Functional Testing:
[0133] Step 1: The host computer sends an OD (ObjectDictionary) modification command (index 0x1017, sub-index 0x00, data = 0x3E8) to set the heartbeat time to 1000ms.
[0134] Step 2: The controller constructs an exception SDO (Segmented transmission of excessively long data, length > 8 bytes).
[0135] Step 3: Monitor the analyzer bus and verify that the correct response time is ≤50ms (standard frame 11-bit ID + 8-byte data), and the exception handling triggers an ABORT frame (error code 0x05040000).
[0136] II. NMT State Machine Testing:
[0137] The host computer sequentially sends NMT commands such as start, stop, and reset node. The controller forwards these commands to the card under test. The analyzer verifies whether the card responds correctly and broadcasts control messages. The system tests all NMT state switching commands in a systematic way to ensure that the communication card complies with the CANopen network management specification.
[0138] III. EMCY Extreme Scenario Test:
[0139] When the bus is under high load (load greater than 50%), use Canoe simulation (a process of modeling, simulation, testing and analysis) to inject errors (e.g., communication error 0x8130 bus short circuit trigger; overvoltage protection 0x8150 power module abnormality) to verify that the error response delay is <100 microseconds (at 1 megabits per second) and the error log recording integrity rate is 100%.
[0140] IV. PDO High-Load Stress Test
[0141] PDO (Process Data Object) testing can test reliability in synchronous or asynchronous modes. It mainly includes synchronous transmission (SYNC-triggered PDO) testing, asynchronous transmission (event-triggered or timed transmission) testing, InhibitTime (to prevent excessive PDO transmission), EventTimer (periodic transmission) testing, master station processing logic (incrementing and transmitting PDO data upon receipt), and automatic data analysis (checking for packet loss and data integrity). The CAN communication card under test is connected to a CAN slave station and a CAN communication analyzer. CANoe is used to simulate slave data, acquire, record, and analyze bus data; Python is used for PDO data processing and analysis; and Wireshark is used for offline data analysis.
[0142] 1. Synchronous Transmission Test: The master station sends a SYNC (synchronization signal) frame (COB-ID=0x80) every 100ms. After receiving the SYNC, the slave station sends a TPDO (part of the Process Data Object mechanism) (e.g., 0x180+NodeID). After receiving the TPDO, the master station increments the data by 1 and sends it back (RPDO, part of the Process Data Object mechanism). The CAN bus analyzer records the data to check whether there is synchronization and no data loss.
[0143] 2. Asynchronous transmission (event-triggered / timed transmission) test: The slave station triggers PDO according to the event timer (e.g., 50ms) or data change, and the master station does not rely on SYNC, directly processes and sends back the data.
[0144] 3. Forbidden Time Test: Set the forbidden time of PDO (e.g., 10ms) to prevent repeated transmission in a short period of time, force high-frequency triggering of PDO, check whether the time interval is observed, and verify that the actual PDO transmission interval is greater than or equal to the forbidden time (10ms).
[0145] IV. Data simulation mode test: The CAN bus analyzer simulates the incremental data of the slave station to test the continuity of the data; the CAN bus analyzer simulates the sinusoidal change of the slave station data to simulate sensor data; the CAN bus analyzer simulates constants to verify fixed frames.
[0146] 5. Simulate data at different baud rates using a CAN bus analyzer, ensuring a bus load of approximately 70% and continuous operation for 24 hours. Verify that there is no packet loss or data anomalies on the bus data within the required range. Implement automatic data simulation (incrementing / sine / constant) and automated analysis, combining a CAN analyzer and Python scripts to achieve end-to-end verification.
[0147] This example achieves the following technical effects through the collaborative work of a host computer, controller, and analyzer: 1. Automated Testing: Python scripts control the testing process and automatically analyze logs, reducing manual intervention. 2. High-Precision Verification: The CAN analyzer (VECTOR 1640A) accurately records bus error frames, load rates, and raw data; Python scripts automatically analyze packet loss rates and timing deviations. 3. Wide Compatibility: Supports multiple slave station models and a full range of baud rates, adapting to industrial and wind power applications. 4. High Load and Robustness Verification Capabilities: Traditional testing struggles to simulate stability under high loads (e.g., above 30%). The analyzer simulates incremental / sine wave data streams, superimposed with 50%-70% bus load stress testing. EMCY testing verifies real-time performance and priority mechanisms under high-pressure conditions.
[0148] Example 4
[0149] Figure 6 This is a schematic diagram of the structure of an electronic device according to an example embodiment of the present disclosure. The electronic device includes a memory, a processor, and a computer program stored in the memory and used to run on the processor. When the processor executes the computer program, it implements the automated testing method of the CAN communication card of any of the above embodiments. Figure 6 The electronic device 90 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0150] like Figure 6As shown, the electronic device 90 can be manifested as a general-purpose computing device, such as a server device. The components of the electronic device 90 may include, but are not limited to: at least one processor 91, at least one memory 92, and a bus 93 connecting different system components (including memory 92 and processor 91).
[0151] Bus 93 includes a data bus, an address bus, and a control bus.
[0152] The memory 92 may include volatile memory, such as random access memory (RAM) 921 and / or cache memory 922, and may further include read-only memory (ROM) 923.
[0153] The memory 92 may also include a program tool 925 (or utility) having a set (at least one) program module 924, such program module 924 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0154] The processor 91 executes various functional applications and data processing by running computer programs stored in the memory 92, such as the automated testing method for CAN communication cards provided in any of the above embodiments.
[0155] Electronic device 90 can also communicate with one or more external devices 94 (e.g., keyboard, pointing device, etc.). This communication can be performed through input / output (I / O) interface 95. Furthermore, electronic device 90 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public network, such as the Internet) via network adapter 96. As shown, network adapter 96 communicates with other modules of electronic device 90 via bus 93. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with electronic device 90, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
[0156] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0157] Example 5
[0158] This disclosure also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the automated testing method for the CAN communication card provided in any of the above embodiments.
[0159] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.
[0160] Example 6
[0161] This disclosure also provides a computer program product, including a computer program, which, when executed by a processor, implements an automated testing method for a CAN communication card as described above.
[0162] The program code for executing the computer program product disclosed herein can be written in any combination of one or more programming languages. The program code can be executed entirely on a user device, partially on a user device, as a stand-alone software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0163] While specific embodiments of this disclosure have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of this disclosure is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of this disclosure, but all such changes and modifications fall within the scope of protection of this disclosure.
Claims
1. An automated testing method for a CAN communication card, characterized in that, The automated testing method for the CAN communication card includes: Traverse any target baud rate within the preset baud rate range, and trigger the CAN communication card under test and at least one CAN slave station on the CAN bus to generate a closed-loop verification link through periodic synchronization frames; In response to the bus load rate of the CAN bus being greater than or equal to 50%, the first data corresponding to the closed-loop verification link is acquired; wherein, the first data includes at least one of the following: the packet loss rate of the process data and the error frames of the process data; Based on the first data, the stability level of the CAN communication card under test at the target baud rate is determined.
2. The automated testing method for a CAN communication card as described in claim 1, characterized in that, The automated testing method for the CAN communication card also includes: In response to the bus load rate of the CAN bus being greater than or equal to 70%, a standard emergency error code is injected into the CAN slave station, triggering the CAN slave station to send an emergency message to the CAN communication card under test, and the second data of the emergency message received by the CAN communication card under test is obtained; wherein, the second data includes at least one of the delay time of the emergency message and the error code of the emergency message; The reliability of the CAN communication card under test is determined based on the second data.
3. The automated testing method for a CAN communication card as described in claim 1, characterized in that, The automated testing method for the CAN communication card also includes: The CAN communication card under test sends a modify SDO command or an abnormal SDO request to the CAN slave station. Obtain the third data returned by the CAN slave station; The parameter adaptation capability of the CAN communication card under test is determined based on the third data. And / or, The CAN communication card under test sends an abnormal SDO request to the CAN slave station; The abnormal SDO request includes at least one of the following: accessing an illegal index, writing excessively long data, or making high-frequency continuous requests. Obtain the fourth data returned by the CAN slave station; The robustness of the CAN communication card under test is determined based on the fourth data.
4. The automated testing method for a CAN communication card as described in claim 1, characterized in that, The automated testing method for the CAN communication card also includes: The CAN communication card under test sequentially sends network management commands to control the CAN slave station to enter the running state; wherein, the running state includes at least one of the following: pre-operation state, operation state, stop state, and reset state; Obtain the fifth data returned by the CAN slave station; wherein the fifth data includes a heartbeat message or a start message; The completeness of the network management function of the CAN communication card under test is determined based on the fifth data.
5. The automated testing method for a CAN communication card as described in claim 1, characterized in that, The step of obtaining the first data corresponding to the closed-loop verification link includes: The first data is detected and calculated using a preset script; And / or, The preset baud rate range is greater than or equal to 20 kilobits per second, and the preset baud rate range is less than or equal to 1000 kilobits per second; And / or, The periodic synchronization frame has a period of 100 milliseconds, 500 milliseconds, or 1000 milliseconds.
6. An automated testing system for CAN communication cards, characterized in that, The automated testing system for the CAN communication card includes: The verification module is used to traverse any target baud rate within the preset baud rate range and trigger the CAN communication card under test to generate a closed-loop verification link with at least one CAN slave station on the CAN bus through periodic synchronization frames. The acquisition module is configured to acquire first data corresponding to the closed-loop verification link in response to the bus load rate of the CAN bus being greater than or equal to 50%; wherein the first data includes at least one of the following: packet loss rate of process data and error frames of process data; The determination module is used to determine the stability level of the CAN communication card under test at the target baud rate based on the first data.
7. An automated testing device for a CAN communication card, characterized in that, Applied to the CAN communication card, to realize the automated testing method of the CAN communication card as described in any one of claims 1-5, wherein the automated testing device for the CAN communication card includes: a CAN slave station and a CAN bus analyzer; The CAN communication card under test is connected in parallel to the CAN slave and the CAN bus analyzer via a twisted pair cable to the same CAN bus; The CAN bus analyzer is used to monitor bus data and determine at least one of the first data, second data, third data, fourth data, and fifth data based on the bus data.
8. The automated testing device for CAN communication cards as described in claim 7, characterized in that, The automated testing device for the CAN communication card also includes: a host computer and a controller; The controller is connected to the host computer via Ethernet, the CAN bus analyzer is connected to the host computer via USB, and the controller and the CAN communication card under test are connected via Ethernet. The host computer is used to run test scripts, generate test cases, and send control commands to the controller; The controller is used to receive the control command, convert the control command into an SDO command or a network management command, and send the SDO command or network management command to the CAN bus through the CAN communication card under test.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the automated testing method for the CAN communication card according to any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements an automated testing method for the CAN communication card as described in any one of claims 1-5.