CN115967660A - Method and device for testing CAN protocol conversion, terminal equipment and storage medium - Google Patents

Method and device for testing CAN protocol conversion, terminal equipment and storage medium Download PDF

Info

Publication number
CN115967660A
CN115967660A CN202210996098.5A CN202210996098A CN115967660A CN 115967660 A CN115967660 A CN 115967660A CN 202210996098 A CN202210996098 A CN 202210996098A CN 115967660 A CN115967660 A CN 115967660A
Authority
CN
China
Prior art keywords
test
tested
module
protocol conversion
testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210996098.5A
Other languages
Chinese (zh)
Other versions
CN115967660B (en
Inventor
杨战东
成海峰
马方方
刘志松
王明坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Youren Networking Co ltd
Original Assignee
Shandong Youren Networking Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Youren Networking Co ltd filed Critical Shandong Youren Networking Co ltd
Priority to CN202210996098.5A priority Critical patent/CN115967660B/en
Priority claimed from CN202210996098.5A external-priority patent/CN115967660B/en
Publication of CN115967660A publication Critical patent/CN115967660A/en
Application granted granted Critical
Publication of CN115967660B publication Critical patent/CN115967660B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention relates to the technical field of communication test, in particular to a method, a device, terminal equipment and a computer readable storage medium for testing CAN protocol conversion, wherein the method comprises the following steps: acquiring test item enabling data based on the test module, identifying a CAN test item according to the test item enabling data, and determining a parameter to be tested corresponding to the CAN test item; after the parameters to be tested are determined, controlling the test module to test the equipment to be tested so as to obtain a test result; and uploading the test result to the receiving carrier through the result exporting module. The invention improves the testing efficiency and the automation degree of testing CAN protocol conversion.

Description

Method and device for testing CAN protocol conversion, terminal equipment and storage medium
Technical Field
The present invention relates to the field of communications testing technologies, and in particular, to a method and an apparatus for testing CAN protocol conversion, a terminal device, and a computer-readable storage medium.
Background
With the further development and improvement of the ethernet technology, especially the improvement of the communication rate and the application of the interaction technology, the network-to-CAN application is wide, the ethernet-to-CAN module gradually becomes the most applied device in the industrial control field, and meanwhile, a user puts higher requirements on the test of the ethernet-to-CAN function.
The existing CAN conversion function test mode usually adopts a mode of an upper computer and auxiliary equipment for testing, the mode has the defects of great labor consumption, high cost of the required auxiliary equipment (USB-CAN analyzer), complex test environment construction, test data analysis and other work, more test items are needed, and the test items are frequently and repeatedly tested, so that time and labor are wasted.
In conclusion, the existing CAN conversion function test mode has the technical problems of low test efficiency and low automation degree.
Disclosure of Invention
The invention mainly aims to provide a method, a device, terminal equipment and a computer readable storage medium for testing CAN protocol conversion, aiming at improving the testing efficiency and the automation degree of testing CAN protocol conversion.
In order to achieve the above object, the present invention provides a method for testing CAN protocol conversion, which is applied to a system for testing CAN protocol conversion, the system comprising: the device comprises a test module and a result exporting module, wherein the test module is connected with a device to be tested, and the result exporting module is connected with a receiving carrier;
the method for testing CAN protocol conversion comprises the following steps:
acquiring test item enabling data based on the test module;
identifying a CAN test item according to the test item enabling data, and determining a parameter to be tested corresponding to the CAN test item;
after the parameter to be tested is determined, controlling the test module to test the equipment to be tested according to the parameter to be tested so as to obtain a test result;
and uploading the test result to the receiving carrier through the result exporting module.
Optionally, the step of controlling the test module to test the device to be tested according to the parameter to be tested includes:
calling the test module to judge whether the range of the parameter to be tested is traversed or not;
if not, configuring the EUT parameter of the equipment to be tested according to the parameter to be tested, and determining the configuration parameter of the test module according to the EUT parameter to control the test module to test the equipment to be tested.
Optionally, the step of configuring the EUT parameter of the device to be tested according to the parameter to be tested and determining the configuration parameter of the test module according to the EUT parameter includes:
transmitting the parameter to be tested to the equipment to be tested through serial port connection between the system and the equipment to be tested;
determining an AT instruction corresponding to the equipment to be tested, and configuring an EUT parameter of the equipment to be tested according to the AT instruction and the parameter to be tested;
and determining the configuration parameters matched with the EUT parameters in the range through the serial port connection between the system and the equipment to be tested.
Optionally, the test result includes: the step of controlling the test module to test the device to be tested comprises:
detecting whether the accumulated times of data mutual transmission between the test module and the equipment to be tested reaches a preset cycle time or not;
if the accumulated times do not reach the cycle times, sending the CAN frame of the test module to a CAN interface of the equipment to be tested through a CAN interface of the system;
in the equipment to be tested, converting the CAN frame into network data according to a preset CAN data transparent transmission protocol;
and receiving the network data of the network end of the equipment to be tested through the network end of the test module, and comparing the network data to obtain the first output test result.
Optionally, the test result further includes: a second output test result, after the step of obtaining the first output test result according to the first network data comparison, the method further comprises:
sending the CAN data transparent transmission protocol to a network end of the equipment to be tested through a network end of the system;
determining CAN protocol conversion data according to the CAN data transparent transmission protocol and the network data of the equipment to be tested;
and receiving CAN protocol conversion data of the CAN interface of the equipment to be tested through the CAN interface of the system, and comparing the CAN protocol conversion data to obtain a second output test result.
Optionally, after the step of comparing the converted data according to the CAN protocol to obtain the second output test result, the method further includes:
and displaying the first output test result and the second output test result through a human-computer interaction window of the test module.
Optionally, after the step of detecting whether the cumulative number of times of data mutual transmission between the test module and the device to be tested reaches the preset cycle number, the method further includes:
and if the accumulated times reach the cycle times, re-executing the steps of calling the test module to judge whether the range of the parameter to be tested is traversed or not and then.
In addition, in order to achieve the above object, the present invention further provides a device for testing CAN protocol conversion, wherein the device for testing CAN protocol conversion of the present invention comprises:
the acquisition module is used for acquiring the test item enabling data based on the test module;
the determining module is used for identifying the CAN test item according to the test item enabling data and determining the to-be-tested parameters corresponding to the CAN test item;
the test module is used for controlling the test module to test the equipment to be tested according to the parameters to be tested after the parameters to be tested are determined so as to obtain a test result;
and the export module is used for uploading the test result to the receiving carrier through the result export module.
The steps of the method for testing CAN protocol conversion of the invention are realized when each functional module of the device for testing CAN protocol conversion operates.
In addition, in order to achieve the above object, the present invention further provides a terminal device, where the terminal device includes a memory, a processor, and a program for testing CAN protocol conversion, stored in the memory and operable on the processor, and the program for testing CAN protocol conversion is executed by the processor to implement the steps of the method for testing CAN protocol conversion.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium having a program for testing CAN protocol conversion stored thereon, where the program for testing CAN protocol conversion, when executed by a processor, implements the steps of the method for testing CAN protocol conversion described above.
The invention is composed of a highly integrated embedded system containing a test module and a result exporting module, firstly, the human-computer interaction window of the test module is used for obtaining the enabling data of a test item, then the CAN test item is identified according to the enabling data of the test item, the parameter to be tested corresponding to the CAN test item is determined, after the parameter to be tested is determined, the test module is controlled to test and verify the function of the CAN relevant to the equipment to be tested through different physical link links between the system and the equipment to be tested, the corresponding test result is output, and then the result exporting module is used for sending the test result to a receiving carrier through different link links between the system and the receiving carrier.
Different from the traditional CAN protocol conversion test mode, the embedded system integrated with the test module and the result export module of the invention firstly determines the parameters to be tested corresponding to the CAN test items by the test module, and then controls the test module to test the equipment to be tested through different physical link links between the system and the equipment to be tested to obtain the test result and uploads the test result to the receiving carrier through the result export module of the system, thereby effectively avoiding the phenomenon that the prior art adopts the modes of an upper computer and auxiliary equipment to test, needs to consume a large amount of manual work to build a complex test environment and has slow test efficiency.
Drawings
FIG. 1 is a schematic flow chart diagram of a first embodiment of a method for testing CAN protocol conversion in accordance with the present invention;
FIG. 2 is a diagram illustrating hardware connections involved in an embodiment of a method for testing CAN protocol conversion according to the present invention;
FIG. 3 is a schematic diagram of a functional implementation flow involved in an embodiment of a method for testing CAN protocol conversion according to the present invention;
FIG. 4 is a schematic diagram of byte conversion involved in an embodiment of a method for testing CAN protocol conversion according to the present invention;
FIG. 5 is a diagram illustrating frame information involved in a method for testing CAN protocol conversion according to an embodiment of the present invention;
FIG. 6 is a diagram of a frame ID involved in an embodiment of a method for testing CAN protocol conversion according to the present invention;
FIG. 7 is a schematic diagram of frame data according to an embodiment of a method for testing CAN protocol conversion of the present invention;
FIG. 8 is a schematic diagram of a CAN conversion function according to an embodiment of the method for testing CAN protocol conversion of the present invention;
FIG. 9 is a schematic diagram of a device module for testing CAN protocol conversion according to the present invention;
fig. 10 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
An embodiment of the present invention provides a method for testing CAN protocol conversion, and referring to fig. 1, fig. 1 is a schematic flow diagram of a first embodiment of the method for testing CAN protocol conversion according to the present invention.
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application.
Referring to fig. 2, fig. 2 is a schematic diagram of hardware connection related to an embodiment of the method for testing CAN protocol conversion according to the present invention. As shown in fig. 2, the system for testing CAN protocol conversion according to the present invention includes a test module and a result export module, the result export module is disposed above the test module, and is connected to the device to be tested through the system, and the test module establishes a communication link with the device to be tested, wherein the connection with the device to be tested through the system may include: the serial port of the system is connected with the serial port of the equipment to be tested, the network port of the system is connected with the network port of the equipment to be tested, and the CAN interface of the system is connected with the CAN interface of the equipment to be tested.
In the system, the test module and the result exporting module establish a communication link for transmitting the test result of the test module to the result exporting module, and then uploading the test result to a receiving carrier through the connection between the result exporting module and a carrier (receiving carrier) for receiving the test result. The test module can further comprise a test item selection unit, a result analysis unit and a display unit.
The system CAN automatically test whether the related functions of the equipment to be tested, such as the CAN frame data conversion function, the CAN frame ID filtering function, the CAN parameter range realization, and the like, are normal, wherein the equipment to be tested CAN be understood as equipment for converting CAN frame data into network data.
The method for testing CAN protocol conversion is applied to the circuit for testing CAN protocol conversion. In this embodiment, the method for testing CAN protocol conversion of the present invention is applied to a terminal device for testing CAN protocol conversion of a device to be tested, and the method for testing CAN protocol conversion of the present invention includes:
step S10: acquiring test item enabling data based on the test module;
in this embodiment, a test module of the terminal device in the system for testing CAN protocol conversion first determines the test item enabling data.
Step S20: identifying a CAN test item according to the test item enabling data, and determining a parameter to be tested corresponding to the CAN test item;
in this embodiment, the terminal device identifies the enabled CAN test item through the test item enabling data, and determines the parameter to be tested corresponding to the CAN test item.
It should be noted that the test item enabling data may be understood as the relevant data of the CAN to be tested, such as the CAN baud rate, the CAN ID, the CAN data, the CAN mode, etc., which may be determined by the tester through the man-machine interaction window of the system of the present invention. In other words, in the test item selection unit, the test item enable data is an instruction to call relevant data corresponding to the CAN test item, i.e., is responsible for input and output of a control signal.
For example, referring to fig. 3, fig. 3 is a schematic diagram of a function implementation flow related to an embodiment of a method for testing CAN protocol conversion according to the present invention, at a start stage, a tester may set some basic configuration items through a human-computer interaction window of the system of the present invention, for example, when the system of the present invention is used as a recipient of network parameters, the tester needs to configure a socket type, an ip address, and a port number of the system to match with a device to be tested EUT, and in addition, the tester may also select a working mode of the system through the human-computer interaction window of the system of the present invention, that is, it may be understood that a terminal device obtains a relevant instruction for performing a basic configuration item on the system of the present invention through the human-computer interaction window of the system of the present invention.
After the process of the terminal device for performing the basic configuration project is finished, the terminal device initializes the CAN end and the network end of the system, and then in a test module of the system, the test item selection unit of the system is called to determine relevant data of the CAN test item, for example, the terminal device identifies that the enabled CAN test item is the CAN baud rate, the CAN ID, the CAN data or the CAN mode through the test item enabling data.
Referring to fig. 3, if the terminal device identifies that the enabled test item is the CAN baud rate according to the test item enabling data, the CAN baud rate in the test item selection unit is called in the test module to perform a test.
In other feasible embodiments, when the terminal device identifies that the enabled test item is another CAN parameter through the test item enabling data, the terminal device calls the CAN parameter corresponding to the test item selecting unit in the test module to perform a test, for example, if the terminal device identifies that the enabled test item is a CAN ID according to the test item enabling data, the terminal device calls the CAN ID in the test item selecting unit in the test module to perform a test; if the terminal equipment identifies that the enabled test item is CAN data according to the test item enabling data, calling the CAN data in the test item selection unit in the test module to test; if the terminal equipment identifies that the enabled test item is the CAN mode according to the test item enabling data, the CAN mode in the test item selection unit is called in the test module for testing.
It should be noted that the CAN test item may be understood as a test item selection unit stored in the test module, and the CAN test item may be customized according to the user's requirement, including but not limited to CAN baud rate, CAN ID, CAN data, and CAN mode.
The parameter to be tested CAN be understood as parameter data corresponding to the CAN baud rate, the CAN ID, the CAN data or the CAN mode in the CAN test item selected according to the test item enabling data.
For example, in this embodiment, after the terminal device obtains the test item enabling data through the human-computer interaction window of the test module, in the test module, the enabled CAN test item is identified according to the test item enabling data, that is, in the test item selection unit, the CAN baud rate, the CAN ID, the CAN data or the CAN mode corresponding to the CAN test item is called according to the test item enabling data, and the enabled CAN test item is displayed through the display unit of the test module.
In this embodiment, the to-be-tested parameters corresponding to the CAN test items are identified by obtaining the test item enabling data, so that the relevant parameters for testing the CAN protocol conversion of the to-be-tested device are configured in the system for testing the CAN protocol conversion, and a foundation is laid for the CAN protocol conversion test of the to-be-tested device.
Step S30: after the parameter to be tested is determined, controlling the test module to test the equipment to be tested according to the parameter to be tested so as to obtain a test result;
in this embodiment, after determining the parameter to be tested, the terminal device controls the test module to send and receive data through the connection between the system for testing CAN protocol conversion and the device to be tested according to the parameter to be tested, and compares the received data with a preset expected result in the result analysis unit, and outputs the test result.
It should be noted that the output form of the test result can be expressed as Pass or Fail.
In this embodiment, the terminal device first determines the parameters to be tested according to the self-defined CAN test items, then automatically tests the network to-CAN function of the device to be tested, and generates a report of the test result, thereby greatly reducing the manual participation and greatly improving the test efficiency.
Step S40: and uploading the test result to the receiving carrier through the result exporting module.
In this embodiment, referring to fig. 2, the terminal device first transmits the test result to the result export module through the communication connection between the test module and the result export module, and then the result export module may upload the test result to the receiving carrier according to a 4G, WIFI, ETH, USB, or SERIAL communication connection manner.
It should be noted that the receiving carrier includes, but is not limited to, a server or a usb disk; the linking mode of the result exporting module and the receiving carrier includes, but is not limited to, the above 4G, WIFI, ETH, USB or SERIAL communication connection.
In summary, the invention is composed of a highly integrated embedded system containing a test module and a result exporting module, firstly, the human-computer interaction window of the test module is used for obtaining the enabling data of the test item, the CAN test item is identified according to the enabling data of the test item, the parameter to be tested corresponding to the CAN test item is determined, after the parameter to be tested is determined, the test module is controlled to test and verify the function of the CAN relevant to the equipment to be tested through different physical link links between the system and the equipment to be tested, the corresponding test result is output, then, the different link links between the system and the receiving carrier are used for transmitting the test result to the receiving carrier through the result exporting module.
Different from the traditional CAN protocol conversion test mode, the embedded system integrated with the test module and the result export module of the invention firstly determines the parameters to be tested corresponding to the CAN test items by the test module, and then controls the test module to test the equipment to be tested through different physical link links between the system and the equipment to be tested to obtain the test result and uploads the test result to the receiving carrier through the result export module of the system, thereby effectively avoiding the phenomenon that the prior art adopts the modes of an upper computer and auxiliary equipment to test, needs to consume a large amount of manual work to build a complex test environment and has slow test efficiency.
Further, based on the first embodiment of testing CAN protocol conversion of the present invention, the second embodiment of testing CAN protocol conversion of the present invention is proposed.
In this embodiment, the step S30: controlling the test module to test the device to be tested according to the parameter to be tested may include:
step S301: calling the test module to judge whether the range of the parameter to be tested is traversed or not;
in this embodiment, the terminal device calls the test module to determine whether the range of the parameter to be tested is traversed.
It should be noted that the range of the parameter to be measured is a range defined by the user according to the CAN test item, that is, the range is preset.
For example, referring to fig. 3, fig. 3 is a schematic diagram of a function implementation flow related to an embodiment of a method for testing CAN protocol conversion according to the present invention, and a terminal device selects a CAN baud rate corresponding to a test CAN test item through test enable data, and then determines whether a range of the CAN baud rate is traversed.
Step S302: if not, configuring the EUT parameter of the equipment to be tested according to the parameter to be tested, and determining the configuration parameter of the test module according to the EUT parameter to control the test module to test the equipment to be tested.
In this embodiment, referring to fig. 3, if the terminal device determines that the range of the parameter to be tested is not traversed, the parameter to be tested is sent to the device to be tested through the serial connection between the system for testing the CAN protocol conversion and the device to be tested, in the device to be tested, the terminal device configures the EUT parameter of the device to be tested according to the AT instruction and the parameter to be tested, and then through the serial connection between the system and the device to be tested, in the system, the terminal device selects the configuration parameter matched with the EUT parameter, that is, the configuration parameter of the system, according to the range of the parameter to be tested, so as to control the test module of the system to test the device to be tested.
Further, in some possible embodiments, the step S302: configuring the EUT parameter of the device to be tested according to the parameter to be tested, and determining the configuration parameter of the test module according to the EUT parameter, which may further include:
step S3021: transmitting the parameter to be tested to the equipment to be tested through serial port connection between the system and the equipment to be tested;
for example, referring to fig. 2 and 3, the terminal device transmits the parameter to be tested of the CAN baud rate identified in the test module according to the test item enabling data to the device to be tested through the serial port connection between the system and the device to be tested.
Step S3022: determining an AT instruction corresponding to the equipment to be tested, and configuring an EUT parameter of the equipment to be tested according to the AT instruction and the parameter to be tested;
in this embodiment, the terminal device determines an AT instruction corresponding to the device to be tested, configures an EUT (Enterprise Unified bulk) parameter of the device to be tested according to the AT instruction and the parameter to be tested, and identifies a specific value of the EUT parameter according to the AT instruction.
It should be noted that the relevant AT command for configuring the EUT parameter is in the form as follows:
AT+CAN=<baudrate>,<workmode>,<fitertype>,<low>,<high><CR><LF>
< baudrate >: baud rate
10Kbps-1Mbps
< work mode >: mode of operation
FD: FD mode of operation
BASIC: standard mode of operation
LOOPBACK: loop back mode of operation
< fitertype >: ID filtering type
NONE: not enabling ID filtering
STDRECV: standard frame reception range
STDNORECV: standard frame no-receive range
EXDRECV: extending frame reception range
EXDNORECV: extending frame non-reception range
< low >: filtering/reception range low ID
ID minimum is 0, standard frame maximum is 2047, and extended frame maximum is 536870911
< high >: high ID of filtering/receiving range
The minimum ID is 0, the maximum standard frame is 2047, and the maximum extended frame is 536870911
AT+SOCKA=<protocol>,<IP>,<port><CR><CR><LF>
< protocol >: SOCKET working mode
TCPS: TCP Server mode
TCPC: TCP Client mode
UDPS: UDP Server mode
UDPC: UDP Client mode
< IP >: IP address corresponding to SOCKET
The IP address in the Server mode is a local IP address
The IP address is the target IP address under the Client mode
< port >: number of port corresponding to SOCKET
Is a local port number in Server mode
Is a target port number in a Client mode
For example, after the terminal device determines that the range of the parameter to be measured of the CAN baud rate is not traversed, a parameter 1 to be measured is randomly extracted within the range, the parameter 1 to be measured is transmitted to the device to be measured according to the AT instruction based on the serial port connection between the system and the device to be measured, then the EUT parameter of the device to be measured is configured in the device to be measured according to the AT instruction and the parameter 1 to be measured, and finally the specific value of the EUT parameter is identified to be 9600 according to the AT instruction.
Step S3023: and determining the configuration parameters matched with the EUT parameters in the range through the serial port connection between the system and the equipment to be tested.
In this embodiment, the terminal device determines the configuration parameter matching with the EUT parameter in the range to be tested through the serial port connection between the system and the device to be tested, and then obtains the configuration parameter of the system for testing the CAN protocol conversion.
For example, when the terminal device determines that the value of the EUT parameter corresponding to the CAN interface of the device to be tested is 9600, the terminal device selects the configuration parameter equal to the EUT parameter 9600 in the range of the parameter to be tested of the system through the serial port between the system and the device to be tested, and further configures the configuration parameter corresponding to the CAN interface of the system, so that the communication transmission data between the CAN interface of the system and the CAN interface of the device to be tested is unified.
Further, in other possible embodiments, the step S302: controlling the test module to test the device to be tested to obtain a test result may include:
step S30221: detecting whether the accumulated times of data mutual transmission between the test module and the equipment to be tested reaches a preset cycle time or not;
in this embodiment, the terminal device first determines the cumulative number of times of data transmission between the test module and the device to be tested, and then detects whether the cumulative number of times reaches a preset cycle number.
For example, referring to fig. 3, after determining the cumulative number of times of data mutual transmission between the test module and the device under test, the terminal device detects whether the cumulative number of times circulates 10 times, where the preset number of times of circulation includes but is not limited to 10 times.
Step S30222: if not, the CAN frame of the test module is sent to the CAN interface of the equipment to be tested through the CAN interface of the system;
in this embodiment, referring to fig. 2 and 3, if it is determined that the accumulated cycle number does not reach the preset cycle number, the terminal device sends the CAN frame of the test module to the CAN interface of the device to be tested through the CAN interface of the system.
It should be noted that the CAN frames are test data sent from the system of the present invention, and are all generated randomly.
Step S30223: in the equipment to be tested, converting the CAN frame into network data according to a preset CAN data transparent transmission protocol;
in this embodiment, the terminal device converts the CAN frame into the network data according to a preset CAN data transparent transmission protocol in the device to be tested, where the CAN frame includes but is not limited to a CAN frame rate, a CAN frame type, a CAN frame ID, and CAN frame data.
It should be noted that the inter-conversion between the network data and the CAN frame is based on the CAN data transparent transmission protocol, and the specific protocol content is as follows:
A. byte conversion
Referring to fig. 4, fig. 4 is a schematic diagram of byte conversion according to an embodiment of the method for testing CAN protocol conversion according to the present invention.
B. Frame information
Referring to fig. 4, the frame information of 88h of the second row and the first column in fig. 4 may be understood as 1 byte in length, wherein the frame information for identifying the frame type and the frame length, respectively.
Referring to fig. 5, fig. 5 is a schematic diagram of frame information related to an embodiment of a method for testing CAN protocol conversion according to the present invention, where FF is an identification bit of a standard frame and an extended frame, 1 is an extended frame, and 0 is a standard frame; RTR is the identification bit of the remote frame and the data frame, 1 is the remote frame, 0 is the data frame; the reserved bit needs to be filled with 0 and can not be set with 1; B3-B0 are data length bits for marking the data length of the CAN frame.
C. Referring to fig. 6, fig. 6 is a schematic diagram of a frame ID involved in an embodiment of a method for testing CAN protocol conversion according to the present invention. Wherein, the frame ID: length 4 bytes; the high position is in front and the low position is in back.
D. Referring to fig. 7, fig. 7 is a schematic diagram of frame data related to an embodiment of the method for testing CAN protocol conversion according to the present invention. Wherein, the frame data: the length is 8 bytes, the effective length is represented by B3-B0 bits of the frame information, and the deficiency is compensated for 00h.
For example, CAN-to-ethernet (CAN frame to network data conversion) format is as follows:
CAN transmission
Frame format: expanding the frame;
frame type: a data frame;
ID:12345678;
data: 12345678 00;
receiving by Ethernet: 85 12345678 1234 78 00 00 00 00 00;
0x85 indicates that the frame format is an extended frame, the frame type is a data frame, and the data length is 5;
the last four bits represent CAN ID 12345678;
the last 8 bits are the data area, the effective length is 5, and the rest bits are filled with 0.
Step S304: and receiving network data of the network end of the equipment to be tested through the network end of the test module, and comparing according to the network data to obtain a first output test result.
In this embodiment, the terminal device receives network data transmitted by the network terminal of the device to be tested through the network terminal of the test module, and outputs a first output test result after comparing the network data with a preset test result in the result analysis unit of the test module.
Further, in some possible embodiments, in the step S30223: after obtaining a first output test result according to the network data comparison, the method for testing the CAN protocol conversion may include:
step A10: sending the CAN data transparent transmission protocol to a network end of the equipment to be tested through a network end of the system;
in this embodiment, referring to fig. 2, the terminal device sends the CAN data transparent transmission protocol to the network end of the device to be tested through the network end of the system.
Step A20: determining CAN protocol conversion data according to the CAN data transparent transmission protocol and the network data of the equipment to be tested;
in this embodiment, the terminal device first determines the network data of the device to be tested, and then determines the CAN protocol conversion data (CAN frame) according to the CAN data transparent transmission protocol and the network data.
For example, the form of ethernet to CAN (conversion of network data to CAN frames) is as follows:
and Ethernet transmission: 05 00 00 06 12345678 00 00 00;
0x05 represents that the frame format is a standard frame, the frame type is a data frame, and the data length is 5;
00 00 06 indicates ID 0678;
123456 00 00 00 00 is a data area with an effective length of 5.
Step A30: and receiving CAN protocol conversion data of the CAN interface of the equipment to be tested through the CAN interface of the system, and comparing the CAN protocol conversion data to obtain a second output test result.
In this embodiment, the terminal device receives the CAN protocol conversion data (CAN frame) transmitted by the CAN interface of the device under test through the CAN interface of the test module, and outputs a second output test result after comparing the CAN protocol conversion data (CAN frame) with a preset test result in the result analysis unit of the test module.
Further, in other possible embodiments, in the step a30: after obtaining a second output test result according to the comparison of the CAN protocol conversion data, the method for testing CAN protocol conversion may include:
step B10: and displaying the first output test result and the second output test result through a human-computer interaction window of the test module.
In this embodiment, the test result includes a first output test result and a second output test result, and the terminal device displays the first output test result and the second output test result through the human-computer interaction window of the test module.
Further, in other possible embodiments, in step S30221: after detecting whether the accumulated number of times of data transmission between the test module and the device to be tested reaches the preset cycle number, the method for testing the CAN protocol conversion may include:
step C10: and if the accumulated times reach the cycle times, re-executing the steps of calling the test module to judge whether the range of the parameter to be tested is traversed or not and then.
In this embodiment, if it is determined that the cumulative number of times of data mutual transmission between the test module and the device to be tested reaches the preset cycle number, the terminal device re-executes the steps of calling the test module to determine whether the range of the parameter to be tested is traversed and completed, and then.
In addition, referring to fig. 8, fig. 8 is a schematic diagram of a CAN conversion function related to an embodiment of a method for testing CAN protocol conversion according to the present invention. In some feasible embodiments, the system for testing CAN protocol conversion of the present invention integrates a CAN interface and a network interface, and controls a CAN frame of the system to be sent to a device to be tested through the CAN interface, and then, in the device to be tested, the CAN frame is packaged and packaged according to a CAN data transparent transmission protocol and then transmitted to a Socket (Socket), thereby determining that the packaged CAN frame CAN be transmitted to the network end of the system according to a TCP and UDP transmission protocol, and further realizing the function of CAN data conversion of network data. Since the system for testing CAN protocol conversion and the device under test establish bidirectional communication, network data conversion CAN data CAN be realized with reference to fig. 8.
In conclusion, the invention integrates all test data and test logic in one embedded device, is suitable for the tested device with fixed technical standard, realizes the automatic test of whether the CAN frame data conversion function, the CAN frame ID filtering function, the CAN parameter range realization and other related functions of the tested device are normal or not, wherein, the algorithm module of the system CAN be randomly selected according to the test parameter library, does not need to write a test script, and is suitable for bubble test and full coverage test; the CAN communication mode CAN be controlled to select standard or FD mode for testing, the testing requirements of the equipment with various existing CAN communication modes are met, and the testing efficiency and the automation degree of CAN protocol conversion are further improved.
Furthermore, the invention also provides a device for testing CAN protocol conversion. Referring to fig. 9, fig. 9 is a schematic diagram of a device module for testing CAN protocol conversion according to the present invention.
The device for testing CAN protocol conversion of the invention comprises:
an obtaining module H10, configured to obtain test item enabling data based on the test module;
the determining module H20 is used for identifying the CAN test item according to the test item enabling data and determining the parameters to be tested corresponding to the CAN test item;
the test module H30 is used for controlling the test module to test the equipment to be tested according to the parameters to be tested after the parameters to be tested are determined so as to obtain a test result;
and the export module H40 is used for uploading the test result to the receiving carrier through the result export module.
Optionally, the test module H30 may further include:
the calling unit is used for calling the test module to judge whether the range of the parameter to be tested is traversed or not;
and the configuration unit is used for configuring the EUT parameter of the equipment to be tested according to the parameter to be tested if the EUT parameter of the equipment to be tested is not the same as the configuration parameter of the test module according to the EUT parameter, and controlling the test module to test the equipment to be tested.
Optionally, the test module H30 may further include:
the transmission unit is used for transmitting the parameter to be detected to the equipment to be detected through serial port connection between the system and the equipment to be detected;
a first parameter determining unit, configured to determine an AT instruction corresponding to the device to be tested, and configure an EUT parameter of the device to be tested according to the AT instruction and the parameter to be tested;
and the second parameter determining unit is used for determining the configuration parameters matched with the EUT parameters in the range through the serial port connection between the system and the equipment to be tested.
Optionally, the test module H30 may further include:
the detection unit is used for detecting whether the accumulated times of data transmission between the test module and the equipment to be tested reach the preset cycle times or not;
the first sending unit is used for sending the CAN frame of the test module to the CAN interface of the equipment to be tested through the CAN interface of the system if the accumulated times do not reach the cycle times;
the first conversion unit is used for converting the CAN frame into network data in the equipment to be tested according to a preset CAN data transparent transmission protocol;
and the first output unit is used for receiving the network data of the network end of the equipment to be tested through the network end of the test module and obtaining a first output test result according to the network data comparison.
Optionally, the test module H30 may further include:
the second sending unit is used for sending the CAN data transparent transmission protocol to the network end of the equipment to be tested through the network end of the system;
the second conversion unit is used for determining CAN protocol conversion data according to the CAN data transparent transmission protocol and the network data of the equipment to be tested;
and the second output unit is used for receiving CAN protocol conversion data of the CAN interface of the equipment to be tested through the CAN interface of the system and obtaining a second output test result according to the comparison of the CAN protocol conversion data.
Optionally, the test module H30 may further include:
and the display unit is used for displaying the first output test result and the second output test result through a human-computer interaction window of the test module.
Optionally, the test module H30 may further include:
and the re-execution unit is used for re-executing the steps of calling the test module to judge whether the range of the parameter to be tested is traversed or not and then judging if the accumulated times reach the cycle times.
The steps of the method for testing CAN protocol conversion of the invention are realized when each functional module of the device for testing CAN protocol conversion operates.
In addition, the invention also provides terminal equipment. Referring to fig. 10, fig. 10 is a schematic structural diagram of a terminal device according to an embodiment of the present invention. The terminal equipment of the embodiment of the invention CAN be equipment for testing CAN protocol conversion for local operation.
As shown in fig. 10, the terminal device according to the embodiment of the present invention may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a Wi-Fi interface).
A memory 1005 is provided on the terminal apparatus main body, and the memory 1005 stores a program that realizes a corresponding operation when executed by the processor 1001. The memory 1005 is also used to store parameters for use by the terminal device. The memory 1005 may be a high-speed RAM memory or a non-volatile memory such as a disk memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the terminal device configuration shown in fig. 10 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 10, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and a program for testing CAN protocol conversion.
In the terminal device shown in fig. 10, the processor 1001 may be configured to call the smart connection program of the terminal device stored in the memory 1005 and execute the steps of the above-described embodiments of the method of testing CAN protocol conversion of the present invention.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all equivalent structures or equivalent processes performed by the present invention or directly or indirectly applied to other related technical fields are also included in the scope of the present invention.

Claims (10)

1. A method for testing CAN protocol conversion, the method being applied to a system for testing CAN protocol conversion, the system comprising: the device comprises a test module and a result export module, wherein the test module is connected with a device to be tested, and the result export module is connected with a receiving carrier;
the method for testing CAN protocol conversion comprises the following steps:
acquiring test item enabling data based on the test module;
identifying a CAN test item according to the test item enabling data, and determining a parameter to be tested corresponding to the CAN test item;
after the parameter to be tested is determined, controlling the test module to test the equipment to be tested according to the parameter to be tested so as to obtain a test result;
and uploading the test result to the receiving carrier through the result exporting module.
2. The method for testing CAN protocol conversion of claim 1 wherein said step of controlling said test module to test said device under test based on said parameter under test comprises:
calling the test module to judge whether the range of the parameter to be tested is traversed or not;
if not, configuring the EUT parameter of the equipment to be tested according to the parameter to be tested, and determining the configuration parameter of the test module according to the EUT parameter to control the test module to test the equipment to be tested.
3. The method of testing CAN protocol conversion of claim 2 wherein said step of configuring EUT parameters of said device under test according to said parameters under test and determining configuration parameters of said test module according to said EUT parameters comprises:
transmitting the parameter to be tested to the equipment to be tested through serial port connection between the system and the equipment to be tested;
determining an AT instruction corresponding to the equipment to be tested, and configuring an EUT parameter of the equipment to be tested according to the AT instruction and the parameter to be tested;
and determining the configuration parameters matched with the EUT parameters in the range through the serial port connection between the system and the equipment to be tested.
4. The method for testing CAN protocol conversion of claim 2, wherein the test results comprise: the step of controlling the test module to test the device to be tested comprises:
detecting whether the accumulated times of data mutual transmission between the test module and the equipment to be tested reaches a preset cycle time or not;
if the accumulated times do not reach the cycle times, sending the CAN frame of the test module to a CAN interface of the equipment to be tested through a CAN interface of the system;
in the equipment to be tested, converting the CAN frame into network data according to a preset CAN data transparent transmission protocol;
and receiving the network data of the network end of the equipment to be tested through the network end of the test module, and comparing the network data to obtain the first output test result.
5. The method for testing CAN protocol conversion of claim 4, wherein the test results further comprise: a second output test result, after the step of obtaining the first output test result according to the first network data comparison, the method further comprises:
sending the CAN data transparent transmission protocol to a network end of the equipment to be tested through a network end of the system;
determining CAN protocol conversion data according to the CAN data transparent transmission protocol and the network data of the equipment to be tested;
and receiving CAN protocol conversion data of the CAN interface of the equipment to be tested through the CAN interface of the system, and comparing the CAN protocol conversion data to obtain a second output test result.
6. The method of testing CAN protocol conversion of claim 5, wherein after the step of comparing the second output test result against CAN protocol conversion data, the method further comprises:
and displaying the first output test result and the second output test result through a human-computer interaction window of the test module.
7. The method for testing CAN protocol conversion of claim 4, wherein after the step of detecting whether the cumulative number of times of data interchange between the test module and the device under test reaches a preset number of cycles, the method further comprises:
and if the accumulated times reach the cycle times, re-executing the steps of calling the test module to judge whether the range of the parameter to be tested is traversed or not and then.
8. An apparatus for testing CAN protocol conversion, comprising:
the acquisition module is used for acquiring test item enabling data based on the test module;
the determining module is used for identifying the CAN test item according to the test item enabling data and determining the to-be-tested parameters corresponding to the CAN test item;
the test module is used for controlling the test module to test the equipment to be tested according to the parameters to be tested after the parameters to be tested are determined so as to obtain a test result;
and the export module is used for uploading the test result to the receiving carrier through the result export module.
9. A terminal device, characterized in that the terminal device comprises a memory, a processor and a program for testing CAN protocol conversion stored on the memory and executable on the processor, and the processor implements the steps of the method for testing CAN protocol conversion according to any one of claims 1 to 7 when executing the program for testing CAN protocol conversion.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a program for testing CAN protocol conversion, which when executed by a processor implements the steps of the method for testing CAN protocol conversion according to any one of claims 1 to 7.
CN202210996098.5A 2022-08-18 Method, device, terminal equipment and storage medium for testing CAN protocol conversion Active CN115967660B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210996098.5A CN115967660B (en) 2022-08-18 Method, device, terminal equipment and storage medium for testing CAN protocol conversion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210996098.5A CN115967660B (en) 2022-08-18 Method, device, terminal equipment and storage medium for testing CAN protocol conversion

Publications (2)

Publication Number Publication Date
CN115967660A true CN115967660A (en) 2023-04-14
CN115967660B CN115967660B (en) 2024-05-03

Family

ID=

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117376187A (en) * 2023-10-13 2024-01-09 国家电网有限公司华东分部 Communication protocol detection method and detection system

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882108A (en) * 2010-06-30 2010-11-10 三一重机有限公司 Embedded software automatic test system and method thereof
CN104734911A (en) * 2015-02-10 2015-06-24 重庆邮电大学 CAN bus network management test system and method
CN106850372A (en) * 2017-02-22 2017-06-13 重庆长安汽车股份有限公司 A kind of method of testing and system of controller CAN signal
CN109815107A (en) * 2017-11-22 2019-05-28 北京京东尚科信息技术有限公司 The method and apparatus of automatic test
CN110032134A (en) * 2019-04-17 2019-07-19 湖南优利泰克自动化系统有限公司 Plc communication module test method, device, system and computer equipment
CN112134759A (en) * 2020-09-22 2020-12-25 中车唐山机车车辆有限公司 Train Ethernet test system
CN112367216A (en) * 2020-10-19 2021-02-12 许继集团有限公司 Communication debugging method, debugging instrument and system suitable for safety and stability control system
CN112367223A (en) * 2020-10-29 2021-02-12 中国第一汽车股份有限公司 Ethernet test method, device, equipment and medium for gateway controller
CN112532484A (en) * 2020-11-26 2021-03-19 国网山西省电力公司电力科学研究院 Transparent protocol conversion method and device for joint debugging test of stability control test system
CN112596962A (en) * 2020-12-08 2021-04-02 国汽(北京)智能网联汽车研究院有限公司 Automobile CAN bus penetration test system and method
CN112685319A (en) * 2021-01-07 2021-04-20 北京全路通信信号研究设计院集团有限公司 Automatic testing method, device, medium, electronic equipment and system
CN113010357A (en) * 2021-03-12 2021-06-22 山东英信计算机技术有限公司 Testing method, device, equipment and medium for edge intelligent terminal CAN interface
KR20210092452A (en) * 2020-01-16 2021-07-26 엘에스일렉트릭(주) Test device for MODBUS RTU system
CN113259210A (en) * 2021-07-16 2021-08-13 南斗六星系统集成有限公司 Intelligent testing system for car networking terminal
CN113282070A (en) * 2021-04-08 2021-08-20 深圳元戎启行科技有限公司 Bus port fault judgment method and system
CN114578790A (en) * 2022-03-04 2022-06-03 沃飞长空科技(成都)有限公司 Unmanned aerial vehicle flight control automatic test method, system, equipment and medium

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882108A (en) * 2010-06-30 2010-11-10 三一重机有限公司 Embedded software automatic test system and method thereof
CN104734911A (en) * 2015-02-10 2015-06-24 重庆邮电大学 CAN bus network management test system and method
CN106850372A (en) * 2017-02-22 2017-06-13 重庆长安汽车股份有限公司 A kind of method of testing and system of controller CAN signal
CN109815107A (en) * 2017-11-22 2019-05-28 北京京东尚科信息技术有限公司 The method and apparatus of automatic test
CN110032134A (en) * 2019-04-17 2019-07-19 湖南优利泰克自动化系统有限公司 Plc communication module test method, device, system and computer equipment
KR20210092452A (en) * 2020-01-16 2021-07-26 엘에스일렉트릭(주) Test device for MODBUS RTU system
CN112134759A (en) * 2020-09-22 2020-12-25 中车唐山机车车辆有限公司 Train Ethernet test system
CN112367216A (en) * 2020-10-19 2021-02-12 许继集团有限公司 Communication debugging method, debugging instrument and system suitable for safety and stability control system
CN112367223A (en) * 2020-10-29 2021-02-12 中国第一汽车股份有限公司 Ethernet test method, device, equipment and medium for gateway controller
CN112532484A (en) * 2020-11-26 2021-03-19 国网山西省电力公司电力科学研究院 Transparent protocol conversion method and device for joint debugging test of stability control test system
CN112596962A (en) * 2020-12-08 2021-04-02 国汽(北京)智能网联汽车研究院有限公司 Automobile CAN bus penetration test system and method
CN112685319A (en) * 2021-01-07 2021-04-20 北京全路通信信号研究设计院集团有限公司 Automatic testing method, device, medium, electronic equipment and system
CN113010357A (en) * 2021-03-12 2021-06-22 山东英信计算机技术有限公司 Testing method, device, equipment and medium for edge intelligent terminal CAN interface
CN113282070A (en) * 2021-04-08 2021-08-20 深圳元戎启行科技有限公司 Bus port fault judgment method and system
CN113259210A (en) * 2021-07-16 2021-08-13 南斗六星系统集成有限公司 Intelligent testing system for car networking terminal
CN114578790A (en) * 2022-03-04 2022-06-03 沃飞长空科技(成都)有限公司 Unmanned aerial vehicle flight control automatic test method, system, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117376187A (en) * 2023-10-13 2024-01-09 国家电网有限公司华东分部 Communication protocol detection method and detection system

Similar Documents

Publication Publication Date Title
CN107592238B (en) Automatic test method and system of interface, service terminal and memory
CN111475417A (en) Automatic testing method, device, equipment and storage medium
CN106603581B (en) Test method and device supporting multiple communication protocols
CN104978263A (en) Mobile terminal application program test method and mobile terminal application program test system
CN112839323A (en) Bluetooth device testing method and device, terminal and computer readable storage medium
CN111273153A (en) Automatic testing method, device and system for chip
CN111563042A (en) Wireless performance test system and method applied to Wi-Fi5 chip
CN111639002B (en) Sleep power consumption testing method, system, computer equipment and storage medium
CN113672441B (en) Method and device for testing intelligent equipment
CN107015912A (en) Realize system, method, device and the electronic equipment of remote debugging
CN111756597B (en) Wireless module testing system, method and device applied to gateway
CN107453934A (en) A kind of method of testing, apparatus and system
CN110703741A (en) Multifunctional communication debugging equipment
CN110896366A (en) Network card function testing method and device of multi-network card equipment and storage medium
CN111367812A (en) Test method, electronic device and readable storage medium
CN112822073B (en) Test method, device, system, electronic equipment and readable storage medium
CN114660436A (en) Chip testing equipment and chip testing method
CN113407469B (en) Parameter configuration method and device, storage medium and electronic device
CN113064618B (en) System and method for simulating new energy vehicle conformance detection
CN108910642A (en) Elevator debugging information processing method, system, readable storage medium storing program for executing and commissioning device
CN111104276B (en) Chip testing system and method
CN115967660A (en) Method and device for testing CAN protocol conversion, terminal equipment and storage medium
CN110708216B (en) Switch LLDP protocol test method and test system
CN115967660B (en) Method, device, terminal equipment and storage medium for testing CAN protocol conversion
CN109743225B (en) Data testing method and device, storage medium and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant