Method and system for testing driving stability of universal serial port
By providing a test method and system for universal serial port driver stability, the problem of troubleshooting difficulties in the transplant and adaptation process caused by differences in serial port module hardware and drivers in the development of new products is solved, and the problem of not universal testing cases is achieved and problems in the transplant and adaptation process are discovered in a timely manner to ensure product delivery quality.
Patent Information
- Application Number
- CN202411788197.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
During the development of new products, due to the different hardware and drivers of SDK serial port modules provided by each SOC manufacturer, there are problems such as difficulty in troubleshooting during the transplantation and adaptation process and the lack of universality of test cases.
Provide a test method and system for universal serial port driver stability, through the first mode, data communication between the first board and the client is carried out, test cases are unified, and the integrity and stability of the serial port driver are detected through the second mode, and problems in the transplantation and adaptation process are discovered in a timely manner.
By unifying test cases, saving costs, and by detecting the integrity and stability of the serial driver, problems in the transplantation and adaptation process are discovered and solved in a timely manner to ensure product delivery quality.
Smart Images

Figure CN119718800A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a testing method and system for the stability of a universal serial port driver. Background Art
[0002] Importing a new platform is a common problem when developing new products. Since the hardware and drivers of the SDK serial port modules provided by various SOC manufacturers are different, the transplantation and adaptation process is a necessary process. After the transplantation and adaptation are completed, the single board is usually directly connected to the PLC and other devices for testing. This method often has the following problems: (1) When a problem occurs, it is not easy to troubleshoot, or the troubleshooting process is time-consuming and laborious; (2) The test cases are not universal. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a testing method and system for the stability of a universal serial port driver. Through the first mode, data communication is carried out between the first board and the client, which can unify the test cases and save costs; through the second mode, the integrity and stability of the serial port driver can be detected, and problems introduced during the transplantation and adaptation process can be discovered in time to ensure the delivery quality of the product.
[0004] In a first aspect, an embodiment of the present invention provides a method for testing the stability of a universal serial port driver, the method comprising:
[0005] Get the test parameters entered by the user;
[0006] Determining whether the number of the test parameters is a set number;
[0007] If yes, then determine the serial port number, serial port parameters, mode type, character string and the number of cycles of sending and receiving according to the test parameters;
[0008] When the mode type is the first mode, the first board sends the character string to the client, and the first board receives the first data sent by the client;
[0009] When the mode type is the second mode, the first board is used as a receiving end and the second board is used as a sending end;
[0010] Each time the receiving end receives the second data sent by the sending end, the receiving end accumulates and verifies the second data;
[0011] When the verification succeeds, the receiving end replies the setting mark data to the sending end, and the sending end continues to send the next time after receiving the setting mark data, until the number of transmissions reaches the number of cycles and the cycle ends.
[0012] Further, determining the serial port number, serial port parameters, mode type, character string and setting the number of cycles of sending and receiving according to the test parameters includes:
[0013] According to the first parameter of the test parameter, the serial port number is obtained;
[0014] According to the second to fifth parameters of the test parameters, the serial port parameters are obtained; wherein the serial port parameters include baud rate, data bit and parity check;
[0015] According to the sixth parameter of the test parameter, the mode type is obtained as the first mode or the second mode;
[0016] When the mode type is the first mode, obtaining the character string according to the seventh parameter of the test parameter;
[0017] When the mode type is the second mode, the number of cycles is obtained according to the seventh parameter.
[0018] Further, the first board sends the character string to the client, and the first board receives the first data sent by the client, including:
[0019] Determining whether the user inputs an end instruction;
[0020] If not, clearing the receiving buffer of the first board and sending the character string to the serial communication software of the client so that the serial communication software can view the character string;
[0021] The first board receives the first data sent by the serial port communication software;
[0022] If yes, then end.
[0023] Furthermore, the size of the sending buffer of the sending end is 1024 bytes, and the content of the second data is 0-255 bytes.
[0024] Furthermore, the method further comprises:
[0025] Open the corresponding serial port according to the serial port number;
[0026] The serial port is configured according to the serial port parameters.
[0027] Furthermore, the first single board is connected to the client via a standard serial port, and the first single board is connected to the second single board via the standard serial port.
[0028] In a second aspect, an embodiment of the present invention provides a system for testing the stability of a universal serial port driver, the system comprising:
[0029] The acquisition module is used to obtain the test parameters input by the user;
[0030] A judging module, used for judging whether the number of the test parameters is a set number;
[0031] A determination module, used for determining the serial port number, serial port parameters, mode type, character string and the number of cycles of setting the transmission and reception according to the test parameters when the number of the test parameters is the set number;
[0032] A transceiver module, configured to, when the mode type is the first mode, cause the first board to send the character string to the client, and for the first board to receive first data sent by the client;
[0033] A verification module, configured to, when the mode type is the second mode, use the first board as a receiving end and the second board as a sending end; each time the receiving end receives second data sent by the sending end, perform accumulation and verification on the second data;
[0034] The reply module is used for the receiving end to reply the setting mark data to the sending end when the verification is successful, and the sending end continues to send the setting mark data for the next time after receiving the setting mark data, until the number of transmissions reaches the number of cycles and the cycle ends.
[0035] Furthermore, the determination module is specifically used for:
[0036] According to the first parameter of the test parameter, the serial port number is obtained;
[0037] According to the second to fifth parameters of the test parameters, the serial port parameters are obtained; wherein the serial port parameters include baud rate, data bit and parity check;
[0038] According to the sixth parameter of the test parameter, the mode type is obtained as the first mode or the second mode;
[0039] When the mode type is the first mode, obtaining the character string according to the seventh parameter of the test parameter;
[0040] When the mode type is the second mode, the number of cycles is obtained according to the seventh parameter.
[0041] In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method described above when executing the computer program.
[0042] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code enables the processor to execute the method as described above.
[0043] The embodiment of the present invention provides a testing method and system for the stability of a universal serial port driver, comprising: obtaining a test parameter input by a user; judging whether the number of the test parameters is a set number; if so, determining a serial port number, a serial port parameter, a mode type, a character string and a set number of cycles of sending and receiving according to the test parameters; when the mode type is a first mode, a first single board sends a character string to a client, and the first single board receives first data sent by the client; when the mode type is a second mode, the first single board is used as a receiving end and the second single board is used as a sending end; the receiving end accumulates and verifies the second data each time it receives the second data sent by the sending end; when the verification is successful, the receiving end replies to the sending end with set mark data, and the sending end continues to send the next time after receiving the set mark data, until the number of transmissions reaches the number of cycles and the cycle ends; by using the first mode, data communication is performed between the first single board and the client, so that test cases can be unified and costs can be saved; by using the second mode, the integrity and stability of the serial port driver can be detected, and problems introduced in the transplantation and adaptation process can be discovered in time to ensure the delivery quality of the product.
[0044] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0045] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A flow chart of a method for testing the stability of a universal serial port driver provided in the first embodiment of the present invention;
[0048] Figure 2 A flowchart of the execution process of the first mode provided in the second embodiment of the present invention;
[0049] Figure 3A flowchart of the execution process of the second mode provided in the second embodiment of the present invention;
[0050] Figure 4 Schematic diagram of a universal serial port driver stability testing system provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] To facilitate understanding of this embodiment, the embodiment of the present invention is described in detail below.
[0053] Embodiment 1:
[0054] Figure 1 This is a flow chart of a method for testing the stability of a universal serial port driver provided in Embodiment 1 of the present invention.
[0055] Reference Figure 1 , the method comprises the following steps:
[0056] Step S101, obtaining test parameters input by a user;
[0057] Step S102, determining whether the number of test parameters is a set number;
[0058] Step S103, if yes, determine the serial port number, serial port parameters, mode type, character string and the number of cycles of sending and receiving according to the test parameters;
[0059] Here, if the number of test parameters is not the set number, the program will exit.
[0060] Step S104, when the mode type is the first mode, the first board sends the character string to the client, and the first board receives the first data sent by the client;
[0061] Step S105, when the mode type is the second mode, the first board is used as a receiving end, and the second board is used as a sending end;
[0062] Step S106, the receiving end accumulates and verifies the second data each time it receives the second data sent by the sending end;
[0063] Step S107, when the verification is successful, the receiving end replies to the sending end with the set mark data, and the sending end continues to send the set mark data after receiving the set mark data, until the number of transmissions reaches the cycle number and the cycle ends.
[0064] In this embodiment, a universal serial port driver stability test method is used to meet the self-test requirements, using a C language source program. When using this test method, different test modes can be started according to different input parameter combinations. This application mainly includes two self-test modes.
[0065] The first mode is that the first board is connected to the client via a standard serial port (such as RS232 / 485, etc.), the first board runs the test program, the client runs the serial port debugging software, the first board can send any string input according to the command line, and receive the first data sent by the client at the same time. The client can receive the string sent by the first board; at the same time, the client can edit any content to be sent and send it to the first board. Among them, the client can be a personal computer, a desktop computer or a laptop.
[0066] In the second mode, the first board and the second board are connected via a standard serial port (such as RS232 / 485, etc.), and the two boards can start the receiving and sending processes respectively according to different input parameters (R / W). The sending end sends 1024 times in a loop, sending 1 byte for the first time, 2 bytes for the second time, and so on, until the last time 1024 bytes are sent, thus realizing the communication flow change data with a granularity of 1 byte (Byte).
[0067] The receiving end accumulates and checks each time after receiving the second data. After the check is correct, it sends back the set mark data (0xa5a5a5a5). After receiving the set mark data, the sending end continues to send the next process until the number of transmissions reaches the number of cycles and the cycle ends. This fine-grained testing process can detect the integrity and stability of the serial port driver, and can promptly discover problems introduced during the transplantation and adaptation process, ensuring the delivery quality of the product.
[0068] The testing method of the present application is easy to implement, efficient and stable. When the platform is imported, it can timely detect possible problems in the transplantation and adaptation of the serial port driver to ensure the delivery quality.
[0069] Further, step S103 includes the following steps:
[0070] Step S201, obtaining the serial port number according to the first parameter of the test parameter;
[0071] Step S202, obtaining serial port parameters according to the second to fifth parameters of the test parameters; wherein the serial port parameters include baud rate, data bits (7 bits or 8 bits) and parity check (N represents no check or E represents even check or O represents odd check);
[0072] Step S203, according to the sixth parameter of the test parameter, obtaining the mode type as the first mode or the second mode;
[0073] Step S204, when the mode type is the first mode, obtaining a character string according to the seventh parameter of the test parameter;
[0074] Step S205, when the mode type is the second mode, the number of cycles is obtained according to the seventh parameter.
[0075] Here, if the mode type is the second mode, the sending buffer is initialized, and the size of the sending buffer is 1024 bytes; the content of the second data is 0 to 255; the elements starting from array subscript 256 are filled with 0, and so on;
[0076] Further, step S104 includes the following steps:
[0077] Step S301, determining whether the user inputs an end instruction;
[0078] Step S302: if not, clear the receiving buffer of the first board and send the character string to the serial communication software of the client so that the serial communication software can view the character string;
[0079] Step S303, the first board receives first data sent by the serial port communication software;
[0080] Step S304: if yes, then end.
[0081] Specifically, the present application adopts two test modes. The first mode is used for the first board to communicate with the serial communication software of the client. The first board can specify the string to be sent in the command line and receive the first data from the serial communication software at the same time.
[0082] The second mode uses two boards to communicate with each other, with the first board as the receiving end and the second board as the sending end. The first board receives (R) and the other board sends (W). The sending and receiving sides can pass in different parameters when starting the test case. The sending end sends 1024 times in a loop, with 1 byte sent for the first time, 2 bytes sent for the second time, and so on, until the last time 1024 bytes are sent, thus realizing the communication flow change data with a granularity of 1 byte.
[0083] The receiving end accumulates and verifies each time it receives data. After the verification is correct, it sends back the set mark data (0xa5a5a5a5). After receiving the set mark data, the sending end continues to send the next time until all cycles are completed.
[0084] Furthermore, the size of the sending buffer of the sending end is 1024 bytes, and the content of the second data is 0-255 bytes.
[0085] Furthermore, the method further comprises the following steps:
[0086] Step S401, opening the corresponding serial port according to the serial port number;
[0087] Step S402, configuring the serial port according to the serial port parameters.
[0088] Here, after the serial port is configured according to the obtained serial port parameters, the test process of the first mode or the second mode is started.
[0089] Furthermore, the first single board is connected to the client via a standard serial port, and the first single board is connected to the second single board via a standard serial port.
[0090] Embodiment 2:
[0091] Figure 2 This is a flow chart of the execution process of the first mode provided in the second embodiment of the present invention.
[0092] Reference Figure 2 , the method comprises the following steps:
[0093] Step S501, determine whether Ctrl+C is pressed to end; if yes, execute step S502; if not, execute step S503;
[0094] Step S502, end;
[0095] Step S503, the receiving buffer is cleared to 0;
[0096] Step S504, executing sending;
[0097] Step S505, executing receiving (blocking type).
[0098] Specifically, the execution process consists of a while(1) loop, and the exit condition is to press the Ctrl+C keys to end the test program; otherwise, the loop continues. When the loop comes in, the receiving buffer is cleared first, and the size of the receiving buffer is 1024 bytes; then the string is sent out; at the same time, the reception is started to receive the first data sent by the serial communication software of the client; the serial communication software can observe the string sent by the first single board, and at the same time, the first data to be sent can be input and sent to the first single board.
[0099] Example of commands for the first mode:
[0100] $. / uart-simple-test 0baud 8N 1A'helloworld1234'
[0101] The 0th parameter "uart-simple-test" indicates the name of the program;
[0102] The first parameter "0" indicates serial port number 0;
[0103] The second parameter "baud" indicates the baud rate, such as 115200;
[0104] The third parameter "8" indicates that the number of bits of data is 8;
[0105] The fourth parameter "N" means not to use parity check;
[0106] The fifth parameter "1" means the stop bit is 1;
[0107] The sixth parameter "A" indicates operation mode one;
[0108] The seventh parameter "helloworld1234" indicates the character string sent by the board.
[0109] Figure 3 This is a flow chart of the execution process of the second mode provided in the second embodiment of the present invention.
[0110] Reference Figure 3 , the method comprises the following steps:
[0111] Step S601, determining at the receiving end whether the number of cycles is full; if yes, then ending; if no, executing step S602;
[0112] Step S602, receiving second data sent by the sending end;
[0113] Step S603, perform accumulation and verification on the second data to determine whether the received verification is OK; if not, end; if yes, execute step S604;
[0114] Step S604, sending back setting mark data (0xa5a5a5a5);
[0115] Step S605, the loop variable body is incremented;
[0116] Step S606, the sending end determines whether the number of cycles is full; if yes, the process ends; if no, the process proceeds to step S607;
[0117] Step S607, sending second data to the receiving end;
[0118] Step S608, receiving setting mark data from the receiving end;
[0119] Step S609, determine whether the received marking data is OK; if yes, execute step S610; if no, end;
[0120] Step S610, the loop variable body is incremented.
[0121] Specifically, the receiving end and the sending end of the process are each composed of a for loop, and the number of loops is 1024. When the program starts, the program of the receiving end is started first (parameter 6 is set to R), and then the program of the sending end is started (parameter 6 is set to W).
[0122] After the receiving end starts receiving, it waits for receiving. After the sending end starts sending, it immediately sends the first byte, and the content of the byte is 0x00. The receiving end receives 0x00 sent by the sending end. After the verification is correct (the verification method is to accumulate the received content by byte), the setting mark data (0xa5a5a5a5) is sent back. After receiving the setting mark data, the sending end starts the second transmission and sends 2 bytes. The content of the bytes is 0x00 and 0x01. The receiving end receives 0x00 and 0x01 sent by the sending end. After the verification is correct, the setting mark data (0xa5a5a5a5) is sent back. After receiving the setting mark data, the sending end starts the third transmission, and so on, until all cycles are completed. The logic of sending data at the sending end is summarized as follows:
[0123] The first time, send 1 byte 0;
[0124] The second time, send 2 bytes 0,1;
[0125] The third time, send 3 bytes 0, 1, 2;
[0126] The fourth time, 4 bytes 0, 1, 2, 3 are sent; ......
[0128] The 256th time, 256 bytes are sent 0, 1, 2, 3...255
[0129] The 257th time, 257 bytes are sent 0, 1, 2, 3... 255, 0 ......
[0131] The 1024th time, 1024 bytes are sent 0,1,2,......255,0,......255,0,......255,0,......255
[0132] Example of commands for the second mode:
[0133] $. / uart-simple-test 0baud 8N 1R 1024#Start the receiving board first
[0134] $. / uart-simple-test 0baud 8N 1W 1024#Restart the sending board
[0135] The 0th parameter "uart-simple-test" indicates the name of the program;
[0136] The first parameter "0" indicates serial port number 0;
[0137] The second parameter "baud" indicates the baud rate, such as 115200;
[0138] The third parameter "8" indicates that the number of bits of data is 8;
[0139] The fourth parameter "N" means not to use parity check;
[0140] The fifth parameter "1" means the stop bit is 1;
[0141] The sixth parameter "R or W" indicates running in the second mode;
[0142] The seventh parameter "1024" indicates the number of cycles of receiving or sending;
[0143] Embodiment three:
[0144] Figure 4 Schematic diagram of a universal serial port driver stability testing system provided in Embodiment 3 of the present invention.
[0145] Reference Figure 4 , the system comprises:
[0146] The acquisition module is used to obtain the test parameters input by the user;
[0147] A judgment module is used to judge whether the number of test parameters is a set number;
[0148] A determination module, used to determine the serial port number, serial port parameters, mode type, character string and the number of cycles of sending and receiving according to the test parameters when the number of test parameters is the set number;
[0149] The transceiver module is used for, when the mode type is the first mode, the first board sends the character string to the client, and the first board receives the first data sent by the client;
[0150] A verification module, used for, when the mode type is the second mode, using the first single board as a receiving end and the second single board as a sending end; each time the receiving end receives the second data sent by the sending end, accumulating and verifying the second data;
[0151] The reply module is used for the receiving end to reply the set mark data to the sending end after the verification is successful. After receiving the set mark data, the sending end continues to send the next time until the number of transmissions reaches the cycle number and the cycle ends.
[0152] Furthermore, the module is specifically used to:
[0153] According to the first parameter of the test parameters, get the serial port number;
[0154] According to the second to fifth parameters of the test parameters, the serial port parameters are obtained; wherein the serial port parameters include baud rate, data bit and parity check;
[0155] According to the sixth parameter of the test parameter, the mode type is obtained as the first mode or the second mode;
[0156] When the mode type is the first mode, a string is obtained according to the seventh parameter of the test parameter;
[0157] When the mode type is the second mode, the number of cycles is obtained according to the seventh parameter.
[0158] The embodiment of the present invention provides a testing method and system for the stability of a universal serial port driver, comprising: obtaining a test parameter input by a user; judging whether the number of the test parameters is a set number; if so, determining a serial port number, a serial port parameter, a mode type, a character string and a set number of cycles of sending and receiving according to the test parameters; when the mode type is a first mode, a first single board sends a character string to a client, and the first single board receives first data sent by the client; when the mode type is a second mode, the first single board is used as a receiving end and the second single board is used as a sending end; the receiving end accumulates and verifies the second data each time it receives the second data sent by the sending end; when the verification is successful, the receiving end replies to the sending end with set mark data, and the sending end continues to send the next time after receiving the set mark data, until the number of transmissions reaches the number of cycles and the cycle ends; by using the first mode, data communication is performed between the first single board and the client, so that test cases can be unified and costs can be saved; by using the second mode, the integrity and stability of the serial port driver can be detected, and problems introduced in the transplantation and adaptation process can be discovered in time to ensure the delivery quality of the product.
[0159] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for testing the stability of the universal serial port driver provided in the above embodiment are implemented.
[0160] An embodiment of the present invention also provides a computer-readable medium having a non-volatile program code executable by a processor, wherein a computer program is stored on the computer-readable medium, and when the computer program is executed by the processor, the steps of the method for testing the stability of the universal serial port driver of the above embodiment are executed.
[0161] The computer program product provided in the embodiment of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment and will not be repeated here.
[0162] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0163] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0164] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0165] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0166] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for testing the stability of a universal serial port driver, characterized in that: The method comprises: Get the test parameters entered by the user; Determining whether the number of the test parameters is a set number; If yes, then determine the serial port number, serial port parameters, mode type, character string and the number of cycles of sending and receiving according to the test parameters; When the mode type is the first mode, the first board sends the character string to the client, and the first board receives the first data sent by the client; When the mode type is the second mode, the first board is used as a receiving end and the second board is used as a sending end; Each time the receiving end receives the second data sent by the sending end, the receiving end accumulates and verifies the second data; When the verification succeeds, the receiving end replies the setting mark data to the sending end, and the sending end continues to send the next time after receiving the setting mark data, until the number of transmissions reaches the number of cycles and the cycle ends.
2. The method for testing the stability of a universal serial port driver according to claim 1, characterized in that: Determine the serial port number, serial port parameters, mode type, character string and set the number of cycles of sending and receiving according to the test parameters, including: According to the first parameter of the test parameter, the serial port number is obtained; According to the second to fifth parameters of the test parameters, the serial port parameters are obtained; wherein the serial port parameters include baud rate, data bit and parity check; According to the sixth parameter of the test parameter, the mode type is obtained as the first mode or the second mode; When the mode type is the first mode, obtaining the character string according to the seventh parameter of the test parameter; When the mode type is the second mode, the number of cycles is obtained according to the seventh parameter.
3. The method for testing the stability of a universal serial port driver according to claim 1, characterized in that: The first board sends the character string to the client, and the first board receives the first data sent by the client, including: Determining whether the user inputs an end instruction; If not, clearing the receiving buffer of the first board and sending the character string to the serial communication software of the client so that the serial communication software can view the character string; The first board receives the first data sent by the serial port communication software; If yes, then end.
4. The method for testing the stability of a universal serial port driver according to claim 1, characterized in that: The size of the sending buffer of the sending end is 1024 bytes, and the content of the second data is 0-255 bytes.
5. The method for testing the stability of a universal serial port driver according to claim 1, characterized in that: The method further comprises: Open the corresponding serial port according to the serial port number; The serial port is configured according to the serial port parameters.
6. The method for testing the stability of a universal serial port driver according to claim 1, characterized in that: The first single board is connected to the client via a standard serial port, and the first single board is connected to the second single board via the standard serial port.
7. A universal serial port driver stability testing system, characterized in that: The system comprises: An acquisition module is used to obtain test parameters input by the user; A judging module, used for judging whether the number of the test parameters is a set number; A determination module, used for determining the serial port number, serial port parameters, mode type, character string and the number of cycles of setting the transmission and reception according to the test parameters when the number of the test parameters is the set number; A transceiver module, configured to, when the mode type is the first mode, cause the first board to send the character string to the client, and for the first board to receive first data sent by the client; A verification module, configured to, when the mode type is the second mode, use the first board as a receiving end and the second board as a sending end; each time the receiving end receives second data sent by the sending end, perform accumulation and verification on the second data; The reply module is used for the receiving end to reply the setting mark data to the sending end when the verification is successful, and the sending end continues to send the setting mark data for the next time after receiving the setting mark data, until the number of transmissions reaches the number of cycles and the cycle ends.
8. The universal serial port driver stability testing system according to claim 7, characterized in that: The determination module is specifically used for: According to the first parameter of the test parameter, the serial port number is obtained; According to the second to fifth parameters of the test parameters, the serial port parameters are obtained; wherein the serial port parameters include baud rate, data bit and parity check; According to the sixth parameter of the test parameter, the mode type is obtained as the first mode or the second mode; When the mode type is the first mode, obtaining the character string according to the seventh parameter of the test parameter; When the mode type is the second mode, the number of cycles is obtained according to the seventh parameter.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
10. A computer readable medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the method according to any one of claims 1 to 6.