CN116257398B - Serial port testing method and system - Google Patents

Serial port testing method and system Download PDF

Info

Publication number
CN116257398B
CN116257398B CN202310525660.0A CN202310525660A CN116257398B CN 116257398 B CN116257398 B CN 116257398B CN 202310525660 A CN202310525660 A CN 202310525660A CN 116257398 B CN116257398 B CN 116257398B
Authority
CN
China
Prior art keywords
binary
serial port
hexadecimal
test
parameter
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.)
Active
Application number
CN202310525660.0A
Other languages
Chinese (zh)
Other versions
CN116257398A (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.)
Zhongxing Lianhua Technology Beijing Co ltd
Original Assignee
Zhongxing Lianhua Technology Beijing 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 Zhongxing Lianhua Technology Beijing Co ltd filed Critical Zhongxing Lianhua Technology Beijing Co ltd
Priority to CN202310525660.0A priority Critical patent/CN116257398B/en
Publication of CN116257398A publication Critical patent/CN116257398A/en
Application granted granted Critical
Publication of CN116257398B publication Critical patent/CN116257398B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2247Verification or detection of system hardware configuration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing
    • G06F11/267Reconfiguring circuits for testing, e.g. LSSD, partitioning
    • 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
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The invention provides a serial port testing method and a serial port testing system, which belong to the technical field of equipment testing, wherein the method comprises the following steps: acquiring a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters; displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter; and converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, and sending a first test command containing the hexadecimal parameter to a serial port to obtain a test result returned by the serial port. The invention realizes automatic binary conversion of the test parameters, is convenient for the testers to set the parameters, and improves the efficiency and accuracy of the test.

Description

Serial port testing method and system
Technical Field
The present invention relates to the field of device testing technologies, and in particular, to a serial port testing method and system.
Background
In a server, various functional chips are often employed. In the development stage and the later problem investigation stage, the running condition of each chip needs to be checked to ensure that the system functions normally. The most common test method at present is to collect and check serial information of each chip, because the chips typically send out the information through serial ports.
In the prior art, in the process of testing a serial port, the parameter for sending a command to the serial port is generally hexadecimal. Therefore, when test data is transmitted, a tester is required to carry out the binary conversion of the test parameters, the test data is inconvenient to transmit, time and labor are wasted, and errors are easy to occur.
Disclosure of Invention
The invention provides a serial port testing method and system, which are used for solving the defects that in the prior art, a tester performs the system conversion on testing parameters, is inconvenient to send testing data, wastes time and labor and is easy to make mistakes, and realizing the automatic system conversion on the testing parameters.
The invention provides a mouth test method, which comprises the following steps:
acquiring a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters;
displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter;
and converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, and sending a first test command containing the hexadecimal parameter to a serial port to obtain a test result returned by the serial port.
According to the serial port testing method provided by the invention, the parameter of the first testing command input by the tester is an initial hexadecimal parameter;
the step of converting the binary parameter into hexadecimal to obtain a hexadecimal parameter comprises the following steps:
grouping binary bits of the binary parameters to obtain binary bit groups, wherein the binary bit groups correspond to hexadecimal bits of the initial hexadecimal parameters one by one;
determining a first target binary packet in which the binary bit of the initial state value change is located;
and converting the first target binary group into hexadecimal data, and updating the state value of the hexadecimal bit corresponding to the first target binary group into the hexadecimal data to obtain the hexadecimal parameter.
According to the serial port testing method provided by the invention, after the step of converting the binary parameter into hexadecimal to obtain the hexadecimal parameter, the serial port testing method further comprises the following steps:
displaying the state value of the hexadecimal parameter so that the tester can change the state value of the hexadecimal bit of the hexadecimal parameter;
determining a second target binary packet corresponding to the hexadecimal bit of the state value modification;
and converting the state value of the hexadecimal bit after modification into binary data, and updating the state value of the second target binary group into the binary data.
According to the serial port testing method provided by the invention, the step of acquiring the first test command input by the tester into the serial port comprises the following steps:
scanning the serial ports, and displaying the serial numbers, baud rates and the number of the scanned serial ports;
and acquiring the serial numbers selected by the testers and the first test commands corresponding to the serial ports.
The serial port testing method provided by the invention further comprises the following steps:
acquiring a plurality of second test commands input by a tester for the serial port;
and responding to the selection operation of the second test command, the setting of the transmission delay and the selection operation of the transmission mode of the second test command by the tester, and transmitting the second test command selected by the tester to the serial port to obtain a test result of the serial port.
According to the serial port testing method provided by the invention, the step of acquiring the plurality of second testing commands input by the tester for the serial port comprises the following steps:
acquiring the initial state value of the binary bit corresponding to the function to be tested of the serial port by the tester, and carrying out N times of change to obtain N binary parameters;
and obtaining N second test commands based on the N binary parameters, wherein the N binary parameters are in one-to-one correspondence with the N second test commands.
According to the serial port testing method provided by the invention, before the first testing command and the second testing command are sent to the serial port, the serial port testing method further comprises the following steps:
and in response to the test command ending symbol input by the tester, attaching the test command ending symbol behind the first test command and the second test command.
The serial port testing method provided by the invention further comprises the following steps:
and storing the binary parameters, the hexadecimal parameters, the plurality of second test commands, the selection operation of the second test commands by the testers, the setting of transmission delay and the selection operation of the transmission mode of the second test commands.
The invention also provides a serial port test system, which comprises:
the first conversion module is used for obtaining a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters;
the display module is used for displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter;
the second conversion module is used for converting the binary parameters into hexadecimal to obtain hexadecimal parameters, and sending a first test command containing the hexadecimal parameters to the serial port to obtain a test result returned by the serial port.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the serial port testing method is realized by the processor when the processor executes the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a serial port testing method as described in any one of the above.
According to the serial port testing method and system, the testing command parameters input by the tester are converted into the binary system, the tester can change the state values of certain bits of the binary system parameters in a targeted manner according to the function to be tested of the serial port, and then the binary system parameters are converted into the sixteen-in system and sent to the serial port for testing, so that automatic binary system conversion of the testing parameters is realized, the tester is not required to carry out binary system conversion, the tester can find the parameter positions needing to be debugged conveniently, and the testing efficiency and accuracy are improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a serial port testing method provided by the invention;
FIG. 2 is a schematic diagram of a test operation interface in the serial port test method provided by the invention;
FIG. 3 is a schematic diagram of a serial port testing system according to the present invention;
fig. 4 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The following describes a serial port testing method according to the present invention with reference to fig. 1, which includes:
step 101, acquiring a first test command of a serial port input by a tester, and converting parameters in the first test command into binary to obtain initial binary parameters;
the first test command input by the tester may be a character string or hexadecimal, and the form of the first test command is not limited in this embodiment.
In this embodiment, the serial port test software is run by a PC (Personal Computer ) to generate the test operation interface shown in fig. 2. The PC is connected with a serial port through a USB (Universal Serial Bus ), and the serial port is in communication connection with the test module.
As shown in fig. 2, in the file window, if the test module connected by the serial port is 32 bits, the tester selects the command 1, and inputs the first test command CH 1in the input box corresponding to the command 1: the parameter in the first test command is 00000000, DATA 00000000. The parameters in the first test command are converted into binary, and the obtained initial binary parameters are displayed in a 3wen in window according to the bits.
If the serial port connected test module is 64 bits, the tester selects a command 2, and inputs a first test command CH 1in an input box corresponding to the command 2: the parameter in the first test command is DATA 00000000000000000000. The parameters in the first test command are converted into binary, and the obtained initial binary parameters are displayed in a 3wen in window according to the bits.
102, displaying an initial state value of each binary bit of the initial binary parameter, so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module in serial communication to obtain the binary parameter;
taking a 3wen in window as an example, 4 bytes of the initial binary parameter are displayed sequentially from top to bottom. For the 8-bit state value in each byte, it is displayed in turn from right to left.
The initial binary parameters are displayed in bits in the form of buttons. When a tester clicks a button, the state value of the corresponding binary bit of the button can be changed. For example, when the current state value of a certain binary bit is 0, clicking the corresponding button, and changing the state value to 1; when the current state value of a certain binary bit is 1, the corresponding button is clicked, and the state value is changed to 0.
When the initial binary parameters are changed, a tester can refer to binary bits corresponding to the functions to be tested of the test module communicated with the serial port, so that the serial port can be tested and debugged in a targeted manner.
As in fig. 2, the ddcrl function of the test module corresponds to bits from the 5 th bit to the 12 th bit of the binary parameter, and from the 2 nd bit to the 4 th bit of the second byte; the binary bits corresponding to the ochoff function are from the 9 th bit to the 12 th bit of the binary parameter, and from the 2 nd bit of the third byte to the 8 th bit of the third byte; the binary bits corresponding to the tapiv function are from bit 1 of the fourth byte to bit 8 of the fourth byte. The test functions corresponding to different test modules are different, and the test functions are not limited in this embodiment.
When the tapiv function is tested, the tester only needs to change the fourth byte in the binary parameter, and the other bytes remain unchanged.
Step 103, converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, and sending a first test command containing the hexadecimal parameter to a serial port to obtain a test result of the serial port.
The embodiment realizes the linkage of binary parameters and hexadecimal parameters. When changing the state value of the binary bit in the 3wen in window, the hexadecimal parameter in the command 1 is correspondingly changed; when changing the state value of a binary bit in the 3wen2in window, the hexadecimal parameter in command 2 will change accordingly.
After editing the command 1 or the command 2 to be sent, selecting a corresponding first test command, clicking a command sending button, and sending the first test command to the serial port.
If the state value of the binary parameter is not changed, the send command button can be directly clicked, and the first test command is sent to the serial port.
And receiving the test result returned by the serial port, and displaying the transmitted test command and the returned test result in a returned receiving column, so that the transmitted command information and the returned test result can be conveniently checked for verification.
According to the embodiment, the test command parameters input by the tester are converted into the binary system, the tester can change the state values of certain bits of the binary system parameters in a targeted manner according to the function to be tested of the serial port, and then the binary system parameters are converted into the hexadecimal system and sent to the serial port for testing, so that automatic binary system conversion of the test parameters is realized, the tester is not required to carry out binary system conversion, the tester can find the parameter positions to be debugged conveniently, and the testing efficiency and accuracy are improved.
On the basis of the above embodiment, in this embodiment, the parameter of the first test command input by the tester is an initial hexadecimal parameter;
the step of converting the binary parameter into hexadecimal to obtain a hexadecimal parameter comprises the following steps:
grouping binary bits of the binary parameters to obtain binary bit groups, wherein the binary bit groups correspond to hexadecimal bits of the initial hexadecimal parameters one by one;
since each bit of the hexadecimal parameter corresponds to four bits of the binary parameter, each four bits of the binary parameter are divided into one group, and the hexadecimal bit corresponding to each group of binary bits is determined.
Determining a first target binary packet in which the binary bit of the initial state value change is located;
and converting the first target binary group into hexadecimal data, and updating the state value of the hexadecimal bit corresponding to the first target binary group into the hexadecimal data to obtain the hexadecimal parameter.
As shown in fig. 2, when the state value of a certain binary bit of the binary parameter in the 3wen in window is changed, the hexadecimal bit affected by the changed state value is determined based on the hexadecimal bit corresponding to the group to which the binary bit belongs, thereby updating the state value of the hexadecimal bit.
The embodiment realizes bit linkage of the binary parameter and the hexadecimal parameter, and only updates the hexadecimal bit influenced by the changed state value under the condition that the state value of the binary bit is changed, thereby reducing the calculated amount.
On the basis of the foregoing embodiment, after the step of converting the binary parameter into hexadecimal to obtain the hexadecimal parameter in this embodiment, the method further includes:
displaying the state value of the hexadecimal parameter so that the tester can change the state value of the hexadecimal bit of the hexadecimal parameter;
optionally, when the tester switches the test function, the hexadecimal parameters in the command 1 or the command 2in fig. 2 can be changed first, so as to improve the parameter updating efficiency.
Determining a second target binary packet corresponding to the hexadecimal bit of the state value modification;
and converting the state value of the hexadecimal bit after modification into binary data, and updating the state value of the second target binary group into the binary data.
The binary bit affected by the hexadecimal bit altering the state value is determined, thereby updating the state value of the binary bit.
Based on the updated binary data, the tester can know the state value of the binary bit corresponding to the switched test function, and on the basis, the state value of the updated binary parameter can be changed again.
According to the embodiment, binary parameters and hexadecimal parameters are linked according to the bits, and under the condition that the state value of the hexadecimal bit is changed, only the binary bit influenced by the changed state value is updated, so that the calculated amount is reduced, and the flexibility of test parameter setting is improved.
Based on the foregoing embodiments, the step of obtaining the first test command of the serial port input by the tester in this embodiment includes:
scanning the serial ports, and displaying the serial numbers, baud rates and the number of the scanned serial ports;
and acquiring the serial numbers selected by the testers and the first test commands corresponding to the serial ports.
As shown in fig. 2, clicking a scan serial port button in the file window starts a scan serial port and opens the scanned serial port. The number of the scanned serial ports is displayed in a prompt bar, the serial port numbers and the baud rate are displayed in selection items for the testers to select, and the state and the number information of the serial ports are displayed more clearly.
When the tester selects the COM19 serial port, the baud rate of the serial port is 115200. The tester selects and configures either command 1 or command 2. When the tester clicks the send command button, command 1 or command 2 is sent to the COM19 serial port.
On the basis of the above embodiments, this embodiment further includes:
acquiring a plurality of second test commands input by a tester for the serial port;
in the multiple send boxes of fig. 2, the tester enters multiple second test commands.
And responding to the selection operation of the second test command, the setting of the transmission delay and the selection operation of the transmission mode of the second test command by the tester, and transmitting the second test command selected by the tester to the serial port to obtain a test result of the serial port.
In fig. 2, the tester selects the second test command, such as the first and third test commands, in a checkpointed manner. Clicking the batch send button simultaneously sends the selected second test command to the serial port.
And if the tester checks the cyclic transmission, the tester circularly transmits the selected second test command, otherwise, the selected second test command is transmitted once.
The tester sets the transmission delay of each second test command through the third column of the multiple transmission frames in fig. 2. And if the transmission delay is not set, transmitting the second test command according to the default delay.
The 0 to 19 in the last column in the plurality of transmission frames represent the number of the second test command. And when the button with the number is clicked, a second test command list corresponding to the number can be sent.
The embodiment is convenient for a tester to test a plurality of instructions simultaneously, improves the efficiency, increases the delay time setting between different instructions, can better verify the influence of the test time on the result, can also perform pressure test, and meets the test requirements of the tester on different scenes.
On the basis of the foregoing embodiment, the step of obtaining the plurality of second test commands input by the tester for the serial port in this embodiment includes:
acquiring the initial state value of the binary bit corresponding to the function to be tested of the serial port by the tester, and carrying out N times of change to obtain N binary parameters;
and obtaining N second test commands based on the N binary parameters, wherein the N binary parameters are in one-to-one correspondence with the N second test commands.
The second test command in the multiple transmission windows may be obtained by the tester making multiple changes to the state value of the binary bit in the 3wen in or 3wen in window.
After the binary parameters after each modification are converted into hexadecimal, test commands containing the hexadecimal parameters are stored in a plurality of sending windows.
While command 1 or command 2in the file window only holds test commands containing the last obtained hexadecimal parameters.
In the embodiment, a plurality of test commands are obtained by carrying out multiple changes on the binary parameters, so that automatic binary conversion of the test parameters is realized, and the test efficiency and accuracy are improved.
On the basis of the foregoing embodiment, before the first test command and the second test command are sent to the serial port, the method further includes:
and in response to the test command ending symbol input by the tester, attaching the test command ending symbol behind the first test command and the second test command.
The tester defines the test command ending symbol through the input box corresponding to the ending symbol in fig. 2. A test command terminator is added to the back of each test command.
The command ending symbol needed by the testers for testing different products is different, and the compatibility of the ending symbol of different types of equipment is realized and the universality of the test is improved.
On the basis of the above embodiment, this embodiment further includes:
and storing the binary parameters, the hexadecimal parameters, the plurality of second test commands, the selection operation of the second test commands by the testers, the setting of transmission delay and the selection operation of the transmission mode of the second test commands.
The test command and the configuration parameters input by the testers in each window in fig. 2 are stored into the test file, so that the corresponding test file can be directly imported for the same or repeated test, the test efficiency is improved, and the setting is not needed for each test. The file name can be customized, saved and loaded through the interface file column.
The serial port test system provided by the invention is described below, and the serial port test system described below and the serial port test method described above can be referred to correspondingly.
As shown in fig. 3, the system comprises a first conversion module 301, a display module 302 and a second conversion module 303, wherein:
the first conversion module 301 is configured to obtain a first test command input by a tester into a serial port, and convert parameters in the first test command into binary values to obtain initial binary parameters;
the display module 302 is configured to display an initial state value of each binary bit of the initial binary parameter, so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module in serial communication to obtain the binary parameter;
the second conversion module 303 is configured to convert the binary parameter into hexadecimal to obtain a hexadecimal parameter, and send a first test command containing the hexadecimal parameter to a serial port to obtain a test result returned by the serial port.
According to the embodiment, the test command parameters input by the tester are converted into the binary system, the tester can change the state values of certain bits of the binary system parameters in a targeted manner according to the function to be tested of the serial port, and then the binary system parameters are converted into the hexadecimal system and sent to the serial port for testing, so that automatic binary system conversion of the test parameters is realized, the tester is not required to carry out binary system conversion, the tester can find the parameter positions to be debugged conveniently, and the testing efficiency and accuracy are improved.
Fig. 4 illustrates a physical schematic diagram of an electronic device, as shown in fig. 4, which may include: processor 410, communication interface (Communications Interface) 420, memory 430 and communication bus 440, wherein processor 410, communication interface 420 and memory 430 communicate with each other via communication bus 440. Processor 410 may invoke logic instructions in memory 430 to perform a serial port testing method comprising: acquiring a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters; displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter; and converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, and sending a first test command containing the hexadecimal parameter to a serial port to obtain a test result returned by the serial port.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, where the computer program product includes a computer program, where the computer program can be stored on a non-transitory computer readable storage medium, and when the computer program is executed by a processor, the computer can execute a serial port testing method provided by the above methods, and the method includes: acquiring a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters; displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter; and converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, and sending a first test command containing the hexadecimal parameter to a serial port to obtain a test result returned by the serial port.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the serial port testing method provided by the above methods, the method comprising: acquiring a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters; displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter; and converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, and sending a first test command containing the hexadecimal parameter to a serial port to obtain a test result of the serial port.
The system embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. The serial port testing method is characterized by comprising the following steps of:
acquiring a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters;
displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter;
and converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, and sending a first test command containing the hexadecimal parameter to a serial port to obtain a test result returned by the serial port.
2. The serial port testing method according to claim 1, wherein the parameter of the first test command input by the tester is an initial hexadecimal parameter;
the step of converting the binary parameter into hexadecimal to obtain a hexadecimal parameter comprises the following steps:
grouping binary bits of the binary parameters to obtain binary bit groups, wherein the binary bit groups correspond to hexadecimal bits of the initial hexadecimal parameters one by one;
determining a first target binary packet in which the binary bit of the initial state value change is located;
and converting the first target binary group into hexadecimal data, and updating the state value of the hexadecimal bit corresponding to the first target binary group into the hexadecimal data to obtain the hexadecimal parameter.
3. The serial port testing method according to claim 2, wherein after the step of converting the binary parameter into hexadecimal to obtain a hexadecimal parameter, further comprising:
displaying the state value of the hexadecimal parameter so that the tester can change the state value of the hexadecimal bit of the hexadecimal parameter;
determining a second target binary packet corresponding to the hexadecimal bit of the state value modification;
and converting the state value of the hexadecimal bit after modification into binary data, and updating the state value of the second target binary group into the binary data.
4. A serial port testing method according to any one of claims 1-3, wherein the step of obtaining the first test command of the serial port input by the tester comprises:
scanning the serial ports, and displaying the serial numbers, baud rates and the number of the scanned serial ports;
and acquiring the serial numbers selected by the testers and the first test commands corresponding to the serial ports.
5. A serial port testing method according to any one of claims 1-3, further comprising:
acquiring a plurality of second test commands input by a tester for the serial port;
and responding to the selection operation of the second test command, the setting of the transmission delay and the selection operation of the transmission mode of the second test command by the tester, and transmitting the second test command selected by the tester to the serial port to obtain a test result of the serial port.
6. The serial port testing method according to claim 5, wherein the step of acquiring the plurality of second test commands input by the tester for the serial port comprises:
acquiring the initial state value of the binary bit corresponding to the function to be tested of the serial port by the tester, and carrying out N times of change to obtain N binary parameters;
and obtaining N second test commands based on the N binary parameters, wherein the N binary parameters are in one-to-one correspondence with the N second test commands.
7. The serial port testing method of claim 5, further comprising, prior to transmitting the first test command and the second test command to the serial port:
and in response to the test command ending symbol input by the tester, attaching the test command ending symbol behind the first test command and the second test command.
8. The serial port testing method of claim 5, further comprising:
and storing the binary parameters, the hexadecimal parameters, the plurality of second test commands, the selection operation of the second test commands by the testers, the setting of transmission delay and the selection operation of the transmission mode of the second test commands.
9. A serial port testing system, comprising:
the first conversion module is used for obtaining a first test command of a serial port input by a tester, and converting parameters in the first test command into binary values to obtain initial binary parameters;
the display module is used for displaying the initial state value of each binary bit of the initial binary parameter so that the tester can change the initial state value of the binary bit corresponding to the function to be tested of the test module communicated with the serial port to obtain the binary parameter;
the second conversion module is used for converting the binary parameters into hexadecimal to obtain hexadecimal parameters, and sending a first test command containing the hexadecimal parameters to the serial port to obtain a test result returned by the serial port.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the serial port testing method of any one of claims 1 to 8 when the program is executed by the processor.
CN202310525660.0A 2023-05-11 2023-05-11 Serial port testing method and system Active CN116257398B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310525660.0A CN116257398B (en) 2023-05-11 2023-05-11 Serial port testing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310525660.0A CN116257398B (en) 2023-05-11 2023-05-11 Serial port testing method and system

Publications (2)

Publication Number Publication Date
CN116257398A CN116257398A (en) 2023-06-13
CN116257398B true CN116257398B (en) 2023-10-03

Family

ID=86686506

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310525660.0A Active CN116257398B (en) 2023-05-11 2023-05-11 Serial port testing method and system

Country Status (1)

Country Link
CN (1) CN116257398B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036740A (en) * 2012-12-17 2013-04-10 上海斐讯数据通信技术有限公司 Ethernet passive optical network (EPON) system testing method for network terminal gigabit Ethernet interface signal
CN105119779A (en) * 2015-09-11 2015-12-02 上海斐讯数据通信技术有限公司 Automatic testing method and system for serial port of equipment to be tested
CN106648945A (en) * 2016-09-30 2017-05-10 北京金山安全软件有限公司 Interface data testing method and device and electronic equipment
CN113626322A (en) * 2021-07-30 2021-11-09 北京达佳互联信息技术有限公司 Interface test method, device, equipment and medium based on binary data communication
CN114281620A (en) * 2021-12-06 2022-04-05 阿里巴巴达摩院(杭州)科技有限公司 Method and device for testing I2C bus signals
CN115374736A (en) * 2022-08-26 2022-11-22 苏州睿芯集成电路科技有限公司 Method for generating discrete loaded simulation memory model by converting binary file
CN115733778A (en) * 2022-09-07 2023-03-03 苏州磊泰电子科技有限公司 Universal serial port testing method, system and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103969482A (en) * 2013-01-30 2014-08-06 鸿富锦精密电子(天津)有限公司 SVID (serial voltage identification) data testing system and method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103036740A (en) * 2012-12-17 2013-04-10 上海斐讯数据通信技术有限公司 Ethernet passive optical network (EPON) system testing method for network terminal gigabit Ethernet interface signal
CN105119779A (en) * 2015-09-11 2015-12-02 上海斐讯数据通信技术有限公司 Automatic testing method and system for serial port of equipment to be tested
CN106648945A (en) * 2016-09-30 2017-05-10 北京金山安全软件有限公司 Interface data testing method and device and electronic equipment
CN113626322A (en) * 2021-07-30 2021-11-09 北京达佳互联信息技术有限公司 Interface test method, device, equipment and medium based on binary data communication
CN114281620A (en) * 2021-12-06 2022-04-05 阿里巴巴达摩院(杭州)科技有限公司 Method and device for testing I2C bus signals
CN115374736A (en) * 2022-08-26 2022-11-22 苏州睿芯集成电路科技有限公司 Method for generating discrete loaded simulation memory model by converting binary file
CN115733778A (en) * 2022-09-07 2023-03-03 苏州磊泰电子科技有限公司 Universal serial port testing method, system and device

Also Published As

Publication number Publication date
CN116257398A (en) 2023-06-13

Similar Documents

Publication Publication Date Title
CN109768970B (en) Configurable universal protocol generation method
CN109359149B (en) Simulation test method and related device
CN108132876B (en) Embedded software object code unit testing method based on injection mode
CN102404379A (en) Communication device and communication method
CN111786855A (en) Network card pressure testing method and device, electronic equipment and storage medium
CN113806037A (en) Service calling method and device, storage medium and electronic equipment
CN115309660A (en) Interface testing method and device, storage medium and computer equipment
CN116257398B (en) Serial port testing method and system
CN111506501B (en) Method and device for generating test instruction set and electronic equipment
CN110708216B (en) Switch LLDP protocol test method and test system
CN111104276B (en) Chip testing system and method
CN112788576A (en) Equipment offline processing method and system, storage medium and electronic device
CN109327354B (en) Method, device and test system for generating signal forwarding test case
CN113985849A (en) Method for writing DTC (digital control channel) read ECU (electronic control unit) version of automatic clear-reading whole vehicle based on CANoe software
CN111371654B (en) Automatic testing system and method for intelligent fusion product network port
KR101989340B1 (en) Data link layer test method and system of CAN communication
CN114070705A (en) Device network management method, medium and device based on command line
US10303584B2 (en) Method for message-processing
CN111858781A (en) Simulation method and device based on preset communication protocol
CN114487758B (en) Test method and test system for semiconductor equipment
CN110675613A (en) Communication method and device between 4G communication module and metering ammeter, computer equipment and storage medium
CN110850841A (en) Fault diagnosis method and related device
CN112988202B (en) System and method for upgrading FC (fiber channel) module
CN118012681A (en) Full duplex function verification method and device for universal asynchronous receiving and transmitting device
US11182939B2 (en) Method and system for transforming message logs into images

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
GR01 Patent grant