A protocol test implementation method and device
By connecting the PC and the device under test to multiple pins of the serial communication module, testing of multiple protocols is solved, and the problem that different protocols in the prior art require different testing tools and host computer software is reduced, and the testing cost is increased and flexibility is increased.
Patent Information
- Application Number
- CN202210237749.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-11
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2042-03-11
AI Technical Summary
Existing protocol testing methods require the design of different testing tools and hosting software according to different protocols, which increases cost and complexity and is difficult to meet the needs of multiple testing environments.
By connecting the personal computer (PC) and the device under test to multiple pins of the preset serial communication module, testing of multiple protocols is realized, and testing costs are reduced by using the multiplexing of existing communication modules.
Testing of multiple protocols is implemented, reducing the testing cost of different protocols, increasing testing flexibility, and not destroying the functions of existing communication modules.
Smart Images

Figure CN114679401B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to protocol testing technology, and more particularly to a method and device for implementing protocol testing. Background Art
[0002] Data transmission control and signal analysis testing in the field of intelligent control, including spi (Serial Peripheral Interface), iic (Inter-Integrated Circuit), smbus (System Management Bus) and other protocol debugging, suitable for various cpu (central processing unit) peripherals.
[0003] In the existing scheme, debugging tools suitable for each protocol are made according to the principles of protocols such as SPI, IIC, SMBus, etc. The host computer operates the level of the pin to be output in each state in the debugging tool according to the specific protocol to achieve the effect of the protocol, and different protocols require different devices. The device can achieve the expected effect, but the specific protocol corresponds to different devices, which is troublesome to implement. In addition, different protocols need to design different test tools, and the host computer software needs to be designed, which increases the cost. Moreover, because the participation of the host computer is required, it cannot meet the needs of various test environments, and the test method is not flexible enough. Summary of the invention
[0004] The embodiments of the present application provide a protocol test implementation method and device, which can meet the testing of multiple protocols by reusing existing communication modules and reduce the testing costs of different protocols.
[0005] The embodiment of the present application provides a protocol test implementation method, which can be applied to a personal computer PC side, and the method may include:
[0006] Connecting the PC and the device under test to a plurality of pins of a preset first serial communication module respectively;
[0007] Sending and receiving first protocol test related data between the plurality of pins and the device under test;
[0008] Determine whether the protocol test is successful based on the data transmission and reception results.
[0009] In an exemplary embodiment of the present application, the plurality of pins may include: a data terminal ready DTR pin, a data ready DSR pin and a request to send RTS pin.
[0010] In an exemplary embodiment of the present application, the sending and receiving of first protocol test related data between the plurality of pins and the device under test may include:
[0011] Sending the first protocol test related data to the first serial communication module, and sending the first protocol test related data to the device under test through the DTR pin and the DSR pin of the first serial communication module;
[0012] Receive first response information corresponding to the first protocol test related data returned by the device under test through the RTS pin of the first serial communication module.
[0013] In an exemplary embodiment of the present application, the first protocol test related data may include first clock data and first protocol data;
[0014] The sending the first protocol test related data to the device under test through the DTR pin and the DSR pin of the first serial communication module may include:
[0015] Sending the first clock data to the device under test through the DTR pin;
[0016] The first protocol data is sent to the device under test through the DTR pin.
[0017] In an exemplary embodiment of the present application, determining whether the protocol test is successful according to the data transmission and reception result may include:
[0018] When the first response information returned by the device under test through the RTS pin of the first serial communication module is received within a first preset time period, it is determined that the protocol test is successful;
[0019] When the first response information returned by the device under test through the RTS pin of the first serial communication module is not received within a first preset time period, it is determined that the protocol test has failed, and the first protocol test related data is re-transmitted and received between the multiple pins and the device under test.
[0020] In an exemplary embodiment of the present application, different protocol tests correspond to different first protocol test related data.
[0021] In an exemplary embodiment of the present application, the first serial communication module may include: a universal serial bus USB to asynchronous transmission standard interface RS232 module.
[0022] An embodiment of the present application also provides a protocol test implementation device, which may include a first serial communication module, a first processor and a first computer-readable storage medium, wherein the first computer-readable storage medium stores instructions, and when the instructions are executed by the first processor, a protocol test implementation method applied to the PC side is implemented.
[0023] The embodiment of the present application also provides a protocol test implementation method, which can be applied to the device under test. The method may include:
[0024] Connecting the device under test and the personal computer PC to a plurality of pins of a preset second serial communication module respectively;
[0025] Sending and receiving second protocol test related data between the plurality of pins and the PC;
[0026] Determine whether the protocol test is successful based on the data transmission and reception results.
[0027] In an exemplary embodiment of the present application, the plurality of pins may include: a data ready DSR pin, a request to send RTS pin, and a clear to send CTS pin;
[0028] The sending and receiving of the second protocol test related data between the plurality of pins and the PC may include:
[0029] Sending the second protocol test related data to the second serial communication module, and sending the second protocol test related data to the PC through the RTS pin and the CTS pin of the second serial communication module;
[0030] Receive second response information corresponding to the second protocol test related data returned by the PC through the DSR pin of the second serial communication module.
[0031] In an exemplary embodiment of the present application, the second protocol test related data may include: second clock data and second protocol data;
[0032] The sending the second protocol test related data to the PC through the RTS pin and the CTS pin of the second serial communication module may include:
[0033] Sending the second clock data to the PC via the RTS pin;
[0034] The second protocol data is sent to the PC through the CTS pin.
[0035] An embodiment of the present application also provides a protocol test implementation device, which may include a second serial communication module, a second processor, and a second computer-readable storage medium, wherein the second computer-readable storage medium stores instructions, and when the instructions are executed by the second processor, a protocol test implementation method applied to the device under test is implemented.
[0036] Compared with the related art, the embodiment of the present application may include: connecting the PC and the device under test to a plurality of pins of a preset first serial communication module respectively; transmitting and receiving first protocol test related data between the plurality of pins and the device under test; and determining whether the protocol test is successful according to the data transmission and reception result. Through this embodiment, the test of multiple protocols is satisfied by reusing the existing communication module, and the test cost of different protocols is reduced.
[0037] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by implementing the present application. Other advantages of the present application can be realized and obtained by the schemes described in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0039] Figure 1 This is a flow chart of a protocol test implementation method applied to a PC side according to an embodiment of the present application;
[0040] Figure 2 A schematic diagram of a protocol simulation process applied to a PC side according to an embodiment of the present application;
[0041] Figure 3 This is a block diagram of a protocol test implementation device applied to a PC side according to an embodiment of the present application;
[0042] Figure 4 This is a flow chart of a protocol test implementation method applied to a device under test according to an embodiment of the present application;
[0043] Figure 5 A schematic diagram of a protocol simulation process applied to a device under test according to an embodiment of the present application;
[0044] Figure 6 This is a block diagram of the composition of a protocol test implementation device applied to a device under test according to an embodiment of the present application. DETAILED DESCRIPTION
[0045] The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and it is obvious to those skilled in the art that there may be more embodiments and implementations within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the specific embodiments, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.
[0046] The present application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features and elements disclosed in the present application may also be combined with any conventional features or elements to form a unique invention scheme defined by the claims. Any features or elements of any embodiment may also be combined with features or elements from other invention schemes to form another unique invention scheme defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in the present application may be implemented individually or in any appropriate combination. Therefore, except for the limitations made according to the attached claims and their equivalents, the embodiments are not subject to other restrictions. In addition, various modifications and changes may be made within the scope of protection of the attached claims.
[0047] In addition, when describing representative embodiments, the specification may have presented the method and / or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and / or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.
[0048] The present application embodiment provides a protocol test implementation method, which can be applied to a personal computer PC side, such as Figure 1 As shown, the method may include steps S101-S103:
[0049] S101, connecting the PC and the device under test to a plurality of pins of a preset first serial communication module respectively;
[0050] S102, sending and receiving first protocol test related data between the plurality of pins and the device under test;
[0051] S103: Determine whether the protocol test is successful based on the data transmission and reception results.
[0052] In an exemplary embodiment of the present application, the first serial communication module may include: a universal serial bus USB to asynchronous transmission standard interface RS232 module.
[0053] In an exemplary embodiment of the present application, a schematic diagram showing that a PC and a device under test are respectively connected to a first serial communication module can be as follows: Figure 2 shown.
[0054] In an exemplary embodiment of the present application, Figure 2 The entire protocol simulation process utilizes three pins of a USB to RS232 module (USB module for short, Universal Serial Bus) to achieve the reception and transmission of the first test protocol data. The implementation is simple, and multiple protocols can be matched for use without limiting the frequency, thus reducing costs and increasing flexibility. In addition, the function of the USB module is not destroyed, and the functional reuse of items is increased.
[0055] In an exemplary embodiment of the present application, a detailed method for implementing a protocol test by sending first test protocol data via a PC is described below.
[0056] In an exemplary embodiment of the present application, the plurality of pins may include: a data terminal ready DTR pin, a data ready DSR pin and a request to send RTS pin.
[0057] In the exemplary embodiments of the present application, the embodiment scheme of the present application is a peripheral testing method, which is flexible in operation and only requires multiplexing of multiple functional pins on the USB module. It is simple to build and does not require changing the schematic diagram, and only targets the sample to be tested.
[0058] In the exemplary embodiment of the present application, the selection of multiple functional pins of the USB module is critical, and the inherent input / output direction of the pins must be distinguished, and the USB module has an output or input voltage after power-on.
[0059] In an exemplary embodiment of the present application, the sending and receiving of first protocol test related data between the plurality of pins and the device under test may include:
[0060] Sending the first protocol test related data to the first serial communication module, and sending the first protocol test related data to the device under test through the DTR pin and the DSR pin of the first serial communication module;
[0061] Receive first response information corresponding to the first protocol test related data returned by the device under test through the RTS pin of the first serial communication module.
[0062] In an exemplary embodiment of the present application, the first protocol test related data may include first clock data and first protocol data;
[0063] The sending the first protocol test related data to the device under test through the DTR pin and the DSR pin of the first serial communication module may include:
[0064] Sending the first clock data to the device under test through the DTR pin;
[0065] The first protocol data is sent to the device under test through the DTR pin.
[0066] In an exemplary embodiment of the present application, if the host computer (PC) transmits the first protocol test related data to the device under test, the host computer can first send the first clock data and the first protocol data to the USB module. After the USB module receives the first protocol test related data, it transmits the corresponding data to the device under test through DTR (Data Terminal Ready) and DSR (dataset ready). The device under test sends the first response information ACK1 through RTS (Request To Send) according to the corresponding protocol.
[0067] In an exemplary embodiment of the present application, different protocol tests correspond to different first protocol test related data.
[0068] In an exemplary embodiment of the present application, after receiving the first protocol test related data, the device under test can determine the corresponding test protocol and return first response information ACK1 corresponding to the test protocol.
[0069] In an exemplary embodiment of the present application, the protocols that can be tested by the embodiment of the present application may include but are not limited to SPI, iic, smbus, etc.
[0070] In an exemplary embodiment of the present application, determining whether the protocol test is successful according to the data transmission and reception result may include:
[0071] When the first response information returned by the device under test through the RTS pin of the first serial communication module is received within a first preset time period, it is determined that the protocol test is successful;
[0072] When the first response information returned by the device under test through the RTS pin of the first serial communication module is not received within a first preset time period, it is determined that the protocol test has failed, and the first protocol test related data is re-transmitted and received between the multiple pins and the device under test.
[0073] The present application also provides a protocol test implementation device 1, such as Figure 3 As shown, it may include a first serial communication module 11, a first processor 12 and a first computer-readable storage medium 13, wherein the first computer-readable storage medium 13 stores instructions, and when the instructions are executed by the first processor 12, a protocol test implementation method applied to the PC side is implemented.
[0074] In the exemplary embodiments of the present application, any of the aforementioned embodiments of the protocol test implementation method applied to the PC side are applicable to the embodiment of the protocol test implementation device 1, and will not be described one by one here.
[0075] The present application also provides a protocol test implementation method, such as Figure 4 As shown, it can be applied to the device under test, and the method may include steps S201-S203:
[0076] S201, connecting the device under test and the personal computer PC to a plurality of pins of a preset second serial communication module respectively;
[0077] S202, sending and receiving second protocol test related data between the plurality of pins and the PC;
[0078] S203: Determine whether the protocol test is successful based on the data transmission and reception results.
[0079] In an exemplary embodiment of the present application, the second serial communication module may include: a universal serial bus USB to asynchronous transmission standard interface RS232 module.
[0080] In an exemplary embodiment of the present application, a schematic diagram showing that the PC and the device under test are respectively connected to the second serial communication module can be as follows: Figure 5 shown.
[0081] In an exemplary embodiment of the present application, Figure 5 The entire protocol simulation process utilizes three pins of a USB to RS232 module (USB module for short, Universal Serial Bus) to achieve the reception and transmission of the second test protocol data. The implementation is simple and can match multiple protocols for use without limiting the frequency, thus reducing costs and increasing flexibility. In addition, the function of the USB module is not destroyed, thus increasing the functional reuse of items.
[0082] In an exemplary embodiment of the present application, a detailed method for implementing a protocol test by sending second test protocol data through a device under test is described below.
[0083] In an exemplary embodiment of the present application, the plurality of pins may include: a data ready DSR pin, a request to send RTS pin, and a clear to send CTS pin;
[0084] The sending and receiving of the second protocol test related data between the plurality of pins and the PC may include:
[0085] Sending the second protocol test related data to the second serial communication module, and sending the second protocol test related data to the PC through the RTS pin and the CTS pin of the second serial communication module;
[0086] Receive second response information corresponding to the second protocol test related data returned by the PC through the DSR pin of the second serial communication module.
[0087] In an exemplary embodiment of the present application, the second protocol test related data may include: second clock data and second protocol data;
[0088] The sending the second protocol test related data to the PC through the RTS pin and the CTS pin of the second serial communication module may include:
[0089] Sending the second clock data to the PC via the RTS pin;
[0090] The second protocol data is sent to the PC through the CTS pin.
[0091] In an exemplary embodiment of the present application, if the device under test transmits second protocol test related data to a PC, the device under test can first send second clock data and second protocol data to the USB module. After the USB module receives the second protocol test related data, it transmits the corresponding data to the PC through RTS (Request To Send) and CTS (Clear To Send). The PC sends a second response message ACK2 through DSR according to the corresponding protocol.
[0092] In an exemplary embodiment of the present application, different protocol tests correspond to different second protocol test related data.
[0093] In an exemplary embodiment of the present application, after receiving the second protocol test related data, the PC can determine the corresponding test protocol and return the second response information ACK2 corresponding to the test protocol.
[0094] In an exemplary embodiment of the present application, the protocols that can be tested by the embodiment of the present application may include but are not limited to SPI, iic, smbus, etc.
[0095] In an exemplary embodiment of the present application, determining whether the protocol test is successful according to the data transmission and reception result may include:
[0096] When the second response information returned by the PC through the DSR pin of the second serial communication module is received within a second preset time period, determining that the protocol test is successful;
[0097] When the second response information returned by the PC through the DSR pin of the second serial communication module is not received within the second preset time period, it is determined that the protocol test has failed, and the second protocol test related data is sent and received again between the multiple pins and the PC.
[0098] In the exemplary embodiments of the present application, at least the following advantages are included:
[0099] 1. Reuse the USB module without damaging the structure and function of the USB module.
[0100] 2. The test device is not affected by the protocol model, and there is no need to customize tools according to the protocol, reducing costs.
[0101] 3. The frequency of the test protocol will not be fixed and can adapt to a variety of environments.
[0102] 4. Simple to make and easy to implement.
[0103] The present application also provides a protocol test implementation device 2, such as Figure 6 As shown, it may include a second serial communication module 21, a second processor 22 and a second computer-readable storage medium 23, wherein the second computer-readable storage medium 23 stores instructions, and when the instructions are executed by the second processor 22, a protocol test implementation method applied to the device under test is implemented.
[0104] In the exemplary embodiments of the present application, any of the aforementioned embodiments of the protocol test implementation method applied to the device under test side is applicable to the embodiment of the protocol test implementation device 2, and will not be described one by one here.
[0105] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
Claims
1. A protocol test implementation method, characterized in that: Applied to a personal computer PC, the method comprises: The PC and the device under test are respectively connected to a plurality of pins of a preset first serial communication module; wherein the plurality of pins include: a data terminal ready DTR pin, a data ready DSR pin, and a request to send RTS pin; The method includes: sending and receiving first protocol test related data between the plurality of pins and the device under test, including: sending the first protocol test related data to the first serial communication module, sending first clock data to the device under test through the DTR pin; sending the first protocol data to the device under test through the DSR pin; receiving first response information corresponding to the first protocol test related data returned by the device under test through the RTS pin, wherein the first protocol test related data includes the first clock data and the first protocol data; Determining whether the protocol test is successful according to the data transmission and reception result includes: determining that the protocol test is successful when the first response information returned by the device under test through the RTS pin of the first serial communication module is received within a first preset time length; determining that the protocol test fails when the first response information returned by the device under test through the RTS pin of the first serial communication module is not received within the first preset time length; Wherein, the first serial communication module includes: a universal serial bus USB to asynchronous transmission standard interface RS232 module, and the tested protocols include SPI, iic or smbus.
2. The protocol test implementation method according to claim 1, characterized in that: After the determination that the protocol test fails, the method further includes: The first protocol test related data is sent and received again between the plurality of pins and the device under test.
3. The protocol test implementation method according to any one of claims 1-2, characterized in that: Different protocol tests correspond to different first protocol test related data.
4. A protocol test implementation device, characterized in that: It includes a first serial communication module, a first processor and a first computer-readable storage medium, wherein the first computer-readable storage medium stores instructions, and when the instructions are executed by the first processor, the protocol test implementation method as described in any one of claims 1-3 is implemented.
5. A protocol test implementation method, characterized in that: Applied to the device under test, the method includes: Connecting the device under test and the personal computer PC to a plurality of pins of a preset second serial communication module respectively, wherein the plurality of pins include a data ready DSR pin, a request to send RTS pin and a clear to send CTS pin; The method includes: sending the second protocol test related data to the second serial communication module, sending the second clock data to the PC through the RTS pin; sending the second protocol data to the PC through the CTS pin; receiving the second response information corresponding to the second protocol test related data returned by the PC through the DSR pin of the second serial communication module, wherein the second protocol test related data includes: the second clock data and the second protocol data; Determining whether the protocol test is successful according to the data receiving and sending result includes: determining that the protocol test is successful when the second response information returned by the PC through the DSR pin of the second serial communication module is received within a second preset time length; determining that the protocol test fails when the second response information returned by the PC through the DSR pin of the second serial communication module is not received within the second preset time length; Wherein, the second serial communication module includes: a universal serial bus USB to asynchronous transmission standard interface RS232 module, and the tested protocols include SPI, iic or smbus.
6. A protocol test implementation device, characterized in that: It includes a second serial communication module, a second processor and a second computer-readable storage medium, wherein the second computer-readable storage medium stores instructions, and when the instructions are executed by the second processor, the protocol test implementation method as claimed in claim 5 is implemented.
Citation Information
Patent Citations
Multifunctional interface switching device based on USB interface
CN110221997A
Signal testing device and signal testing method
CN112905400A