Test method, device and equipment for universal asynchronous receiver / transmitter, and medium

By writing drivers in kernel drivers and writing automated test programs under operating systems, the problems of low UART test efficiency and unreliable results are solved, and automated tests and results are realized, improving testing efficiency and accuracy.

CN119071205APending Publication Date: 2024-12-03SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411156871.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

At this stage, UART testing is inefficient, test results are unreliable, and test results cannot be saved automatically.

Method used

Write adaptive drivers in the kernel drivers, and write automated test programs under the operating system, generate executable kernel image files, implant test platforms, connect to boards, and execute automated test programs to obtain and automatically save test results .

Benefits of technology

It improves the efficiency and accuracy of UART testing, realizes automatic storage and automatic judgment of test results, and simplifies the modification process of automated programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071205A_ABST
    Figure CN119071205A_ABST
Patent Text Reader

Abstract

The invention discloses a test method, device, equipment and medium for a universal asynchronous receiver / transmitter, which are applied to the field of testing and comprise the following steps of: writing an adaptive drive program in a drive of a kernel; compiling a kernel, implanting the compiled driving program into the kernel, and generating an executable kernel mirror image file; implanting the kernel mirror image file into a test platform, and starting an operating system corresponding to the kernel; the test platform is connected with a board card with a universal asynchronous transceiver transmitter to be tested; and under the operating system, compiling and executing an automatic test program to obtain a test result and automatically storing the test result. According to the invention, the problems of low test efficiency, unreliable test result and incapability of automatically storing the test result of the general asynchronous transceiver transmitter at the present stage are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing, and in particular to a testing method, device, equipment and medium for a universal asynchronous receiver-transmitter. Background Art

[0002] UART (Universal Asynchronous Receiver / Transmitter) is a serial, asynchronous, full-duplex communication protocol that is widely used in the embedded field. Most general-purpose SOCs (System on Chip) are equipped with UART. Therefore, the UART test is generally used for boards with SOCs, which requires the coordination of software and hardware. Before the test, the corresponding board and the test platform need to be correctly connected through the serial port, and then the functional test is carried out.

[0003] At present, there are generally two ways to test UART functions: (1) The method of using bare metal programs for testing. Usually, the test program written in C language is directly compiled into a binary image file and burned into the corresponding memory. When the program needs to be modified, the image needs to be re-burned. This method is time-consuming, complicated to operate, and has low test efficiency. In addition, since the bare metal program is not running in the system, the test results are not completely reliable. (2) The method of inputting send and receive commands in the system. Since UART has many functions, it is easy to miss functional points, and the test results require manual judgment by the tester, which is easy to produce deviations. It also has the disadvantages of being time-consuming and inefficient. At the same time, the above two methods cannot automatically save the test results, which can easily cause the loss of test results.

[0004] Therefore, the current UART test has the problems of low efficiency, unreliable test results, and inability to automatically save the test results. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a test method, device, equipment and medium for a universal asynchronous receiver and transmitter, which solves the problems of low UART test efficiency, unreliable test results and inability to automatically save test results in the prior art.

[0006] In order to solve the above technical problems, the present invention provides a method for testing a universal asynchronous receiver-transmitter, comprising:

[0007] Write an adapted driver in the kernel driver;

[0008] Compiling the kernel, implanting the written driver into the kernel, and generating an executable kernel image file;

[0009] The kernel image file is implanted into the test platform, and the operating system corresponding to the kernel is started; the test platform is connected to a board with a universal asynchronous receiver-transmitter to be tested;

[0010] Under the operating system, an automated test program is written and executed, and the test results are obtained and automatically saved.

[0011] On the one hand, write an adapted driver in the kernel driver, including:

[0012] Writing a driver program for direct memory access interface testing, a driver program for basic function testing, and a driver program for flow control function testing in the driver of the kernel;

[0013] Accordingly, under the operating system, an automated test program is written, including:

[0014] Under the operating system, write automated test programs for direct memory access interface testing, basic function testing, and flow control function testing.

[0015] On the one hand, under the operating system, an automated test program for direct memory access interface testing, basic function testing, and flow control function testing is written, including:

[0016] Under the operating system, writing an automated test program for the direct memory access interface;

[0017] Under the operating system, write an automated test program for a data bit test function, a stop bit test function, a parity bit test function, a start bit check function, and a baud rate test function;

[0018] Under the operating system, write automated test programs for software flow control test functions and hardware flow control test functions.

[0019] On the one hand, under the operating system, executing the automated test program, obtaining the test results and automatically saving them, includes:

[0020] Under the operating system, the corresponding automatic test program is executed according to the functional test instruction, automatic judgment is performed, and the test results are obtained and automatically saved.

[0021] On the one hand, under the operating system, the corresponding automated test program is executed according to the functional test instruction to perform automated judgment, including:

[0022] If the test instruction is a direct memory access interface function test instruction, the automatic test program of the direct memory access interface is executed to determine whether the direct memory access interface transmission mode of the universal asynchronous receiver and transmitter to be tested is enabled; if not enabled, the test is terminated; if enabled, a direct memory access interface data transceiver test is performed to determine whether the direct memory access interface is used for data transmission, and if so, the test is normal; if not, the test is terminated and abnormal information is output;

[0023] If the test instruction is a flow control function test instruction, a test program of the flow control function test is executed, and the flow control function of the universal asynchronous receiver and transmitter to be tested is judged according to the register information whether it is enabled; if it is not enabled, the test is terminated; if it is enabled, the instructions for receiving and sending data are executed to judge whether the reception and sending of data are normal, if it is normal, the test is terminated and abnormal information is output; if it is not normal, the flow control function of the universal asynchronous receiver and transmitter to be tested is turned off, and after turning it off, it is judged whether the reception and sending of data are normal, if it is normal, the test passes; if it is not normal, the test is terminated and abnormal information is output;

[0024] If the test instruction is a basic function test instruction, a basic test target is determined according to the basic test function instruction, and an automated test program corresponding to the basic test target is executed.

[0025] On the one hand, after getting the test results, it also includes:

[0026] When the test result is normal and a repeat test instruction is received, the corresponding repeat function test is automatically performed.

[0027] On the one hand, test results are automatically saved, including:

[0028] The test results are classified, archived and saved according to the test functions.

[0029] The present invention also provides a test device for a universal asynchronous receiver-transmitter, comprising:

[0030] The driver writing module is used to write the adapted driver in the kernel driver;

[0031] A kernel image file generation module, used for compiling the kernel, implanting the written driver into the kernel, and generating an executable kernel image file;

[0032] An operating system startup module is used to implant the kernel image file into the test platform and start the operating system corresponding to the kernel; the test platform is connected to a board with a universal asynchronous receiver-transmitter to be tested;

[0033] The automated test program writing and execution module is used to write and execute automated test programs under the operating system, obtain test results and automatically save them.

[0034] The present invention also provides a test device for a universal asynchronous receiver-transmitter, comprising:

[0035] Memory for storing computer programs;

[0036] The processor is used to implement the steps of the above-mentioned universal asynchronous receiver-transmitter testing method when executing the computer program.

[0037] The present invention also provides a medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the steps of the above-mentioned universal asynchronous receiver-transmitter testing method are implemented.

[0038] The present invention also provides a computer program product, comprising a computer program / instruction, which implements the steps of the above-mentioned universal asynchronous receiver-transmitter testing method when executed by a processor.

[0039] It can be seen from the above technical scheme that the present invention writes an adapted driver in the kernel driver; compiles the kernel, implants the written driver into the kernel, generates an executable kernel image file; implants the kernel image file into the test platform, starts the operating system corresponding to the kernel; the test platform is connected to the board with the universal asynchronous receiver and transmitter to be tested; under the operating system, writes and executes the automated test program, obtains the test result and automatically saves it. The beneficial effect of the present invention is that by writing and executing the automated test program based on the operating system, the problems of low efficiency, unreliable test results, and inability to automatically save the test results of the universal asynchronous receiver and transmitter at this stage can be solved. The present invention writes and tests the automated test program based on the operating system, and the test results are reliable; and the automated test program has a high degree of automation, can realize automatic judgment of the test results, and can also realize automatic saving of the data generated by the test process and the test results, saving the test time and improving the efficiency and accuracy. In addition, when the automated program needs to be modified, it cannot be re-burned, and the automated test program can be directly modified under the operating system, and the modification becomes faster and more convenient.

[0040] In addition, the present invention also provides a test device, equipment and medium for a universal asynchronous receiver-transmitter, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0042] Figure 1 A flowchart of a method for testing a universal asynchronous receiver / transmitter provided by an embodiment of the present invention;

[0043] Figure 2 An example diagram of a test module for a comprehensive test provided by an embodiment of the present invention;

[0044] Figure 3 An example flow chart of a method for testing a universal asynchronous receiver / transmitter provided in an embodiment of the present invention;

[0045] Figure 4 An example diagram of a DMA interface test provided by an embodiment of the present invention;

[0046] Figure 5 A framework diagram of automated test program processing and execution provided by an embodiment of the present invention;

[0047] Figure 6 A schematic diagram of the structure of a test device for a universal asynchronous receiver-transmitter provided by an embodiment of the present invention;

[0048] Figure 7 A schematic structural diagram of a universal asynchronous receiver / transmitter test device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0050] Please refer to Figure 1 , Figure 1 A flowchart of a method for testing a universal asynchronous receiver / transmitter is provided in an embodiment of the present invention. The method may include:

[0051] S101: Write an adapted driver in the kernel driver.

[0052] The execution subject of this embodiment is a terminal. This embodiment does not limit the type of terminal, as long as it can complete the operation of the test method of the universal asynchronous receiver and transmitter.

[0053] In this embodiment, if the board with the universal asynchronous receiver / transmitter to be tested is a SOC board with Linux (an operating system), an adaptive driver program can be written in the driver of the Linux kernel.

[0054] Furthermore, for the comprehensiveness of the test, the above-mentioned writing of the adapted driver in the kernel driver may include the following steps:

[0055] In the kernel driver, a driver for direct memory access interface testing, a driver for basic function testing and a driver for flow control function testing are written; accordingly, under the operating system, an automated testing program is written, including: under the operating system, an automated testing program for direct memory access interface testing, basic function testing and flow control function testing is written.

[0056] Specifically, in this embodiment, corresponding drivers are written in the kernel driver for different types of tests. For example, the driver for DMA (Direct Memory Access) interface test, the driver for basic function test and the driver for flow control function test. Correspondingly, under the operating system, corresponding automatic test programs are also written. In this way, the UART with a DMA interface can be automatically tested for the DMA interface; for the UART that can support high baud rate transmission and has flow control (referred to as flow control) function, there can also be corresponding flow control function tests. Of course, the UART can also be automatically tested for basic functions. Among them, for the driver for the DMA interface test of UART, an adapted DMA interface test driver can be written in the kernel driver according to the data processing method of the DMA interface to the UART.

[0057] S102: Compile the kernel, implant the written driver into the kernel, and generate an executable kernel image file.

[0058] Similarly, in this embodiment, the driver program written in step S101 can be implanted into the Linux kernel by compiling the Linux kernel, so that an executable kernel image file can be generated.

[0059] S203: implanting the kernel image file into the test platform, and starting the operating system corresponding to the kernel; connecting the test platform to a board with a universal asynchronous receiver-transmitter to be tested.

[0060] The present embodiment implants the kernel image file generated by step 102 into the test platform, and starts the operating system based on the test platform. Similarly, if the Linux kernel, then the Linux operating system is started accordingly. It is understandable that the functional test of UART is generally used for the board with SOC, and requires the coordination of software and hardware. Before the test, the board with the universal asynchronous receiver and transmitter to be tested and the platform to be tested are correctly connected through the serial port, and only then can the universal asynchronous receiver and transmitter to be tested be functionally tested based on the test platform.

[0061] S204: Under the operating system, write and execute an automated test program, obtain test results, and automatically save them.

[0062] In this embodiment, an automatic test program can be written and executed under the Linux operating system. Based on the Linux operating system, the test results can be automatically saved, and based on the automatic test program, the test results can be automatically determined.

[0063] Further, in order to ensure the comprehensiveness and integrity of the UART function test, the above-mentioned automated test program for writing direct memory access interface test, basic function test and flow control function test under the operating system may include the following steps:

[0064] Under the operating system, write an automated test program for the direct memory access interface;

[0065] Under the operating system, write automated test programs for data bit test function, stop bit test function, parity bit test function, start bit check function and baud rate test function;

[0066] Under the operating system, write automated test programs for software flow control test functions and hardware flow control test functions.

[0067] Specifically, this embodiment can write an automated test program for direct memory access interface, an automated test program for basic function test, and an automated test program for flow control function test under the Linux operating system. For the writing of the automated test program for the basic functions of UART, based on the transmission format supported by the UART protocol, there are a data bit test module, a stop bit test module, a parity bit test module, a start bit detection module, and a baud rate test module in low baud rate mode, such as Figure 2 As shown in the first part. The frame format of the UART protocol transmission is generally 1 start bit, 5-8 data bits, 1 parity bit, and 1 / 1.5 / 2 stop bits. The functions of each module in the first part are as follows:

[0068] (1) Data bit test module: Tests data transmission with four data bit lengths of 5 / 6 / 7 / 8 supported by the UART protocol;

[0069] (2) Stop bit test module: Tests the data transmission with three stop bit lengths of 1 / 1.5 / 2 bits supported by the UART protocol;

[0070] (3) Parity bit test module: Test the transmission of odd and even parity bits of UART without parity bit and with parity bit;

[0071] (4) Start bit detection module: detects the start bit of the transmission to see if it is abnormal;

[0072] (5) Baud rate test module: Tests data transmission at baud rates commonly used by serial terminals, such as 300 / 1200 / 4800 / 9600 / 19200 / 38400 / 115200.

[0073] It needs to be explained that at this stage, there is only a basic function test, but there is no DMA interface test and flow control function test in the present invention. Figure 2 The test modules shown in the second part. The functions of each module in the second part are as follows:

[0074] (1) The DMA interface test module is used to configure the Linux kernel device driver, open the UART interface using DMA mode transmission, and then detect whether the data received and sent by the UART uses the DMA mode transmission interface;

[0075] (2) The hardware flow control test module is used to test whether data transmission is actually restricted after the UART performs flow control through the hardware pins. When connecting the board and the test platform in the hardware flow control test module, the flow control pins need to be additionally connected;

[0076] (3) The software flow control test module is used to test whether data transmission is actually restricted after UART performs flow control through software.

[0077] Furthermore, in order to meet the user's personalized testing needs, the above-mentioned automated testing program is executed under the operating system to obtain the test results and automatically save them, which may include the following steps:

[0078] Under the operating system, the corresponding automated test program is executed according to the functional test instructions, automated judgment is performed, the test results are obtained and automatically saved.

[0079] It should be noted that before performing a functional test (i.e., software test), it should be ensured that the hardware connection is normal, that is, the hardware test is normal. For example, the hardware board and the test platform are correctly connected, and the hardware detection work such as the UART transmission physical channel has been successfully established; the test platform has been configured with the corresponding serial port tool. Because the test platform in this embodiment has started the operating system and various automated test programs have been written, it can meet the various test requirements of the user. When the user's functional test instruction is received, the corresponding automated test program can be executed. Because the automated test program of the present invention has a high degree of automation, it can perform test judgments by itself, and the test results can be directly obtained. In addition, testing based on the operating system can realize the automatic preservation of the test results, and of course, the data during the test process can also be saved.

[0080] Furthermore, in order to improve the accuracy and completeness of the test, the above-mentioned automatic test program is executed according to the functional test instruction under the operating system to perform automatic judgment, which may include the following steps:

[0081] Step 11: If the test instruction is a direct memory access interface function test instruction, the automatic test program of the direct memory access interface is executed to determine whether the direct memory access interface transmission mode of the universal asynchronous receiver and transmitter to be tested is enabled; if not enabled, the test is terminated; if enabled, a direct memory access interface data transmission and reception test is performed to determine whether the direct memory access interface is used for data transmission. If so, the test is normal; if not, the test is terminated and an exception message is output.

[0082] Specifically, for the DMA interface function test, this embodiment determines whether the DMA interface transmission mode is enabled for the universal asynchronous receiver and transmitter UART to be tested; if not enabled, the automated test program is directly terminated and relevant information is printed; if the DMA interface transmission mode is used, the DMA interface data transceiver function test is performed to determine whether the transmission process uses DMA interface transmission instead of ordinary function transmission, and further determine whether the data transmission is correct. If an exception occurs, the corresponding exception information is printed and the corresponding exception log is saved; if there is no exception, it means that the DMA interface of the universal asynchronous receiver and transmitter UART to be tested is normal and the test passes.

[0083] Step 12: If the test instruction is a flow control function test instruction, the test program of the flow control function test is executed, and whether the flow control function of the universal asynchronous receiver and transmitter to be tested is enabled is determined according to the register information; if not enabled, the test is terminated; if enabled, the instructions for receiving and sending data are executed to determine whether the reception and sending of data are normal. If normal, the test is terminated and abnormal information is output; if abnormal, the flow control function of the universal asynchronous receiver and transmitter to be tested is turned off, and after turning off, it is determined whether the reception and sending of data are normal. If normal, the test passes; if abnormal, the test is terminated and abnormal information is output.

[0084] Specifically, for the flow control function test, enable the flow control function of the UART port under the Linux system, and determine whether the flow control function is successfully turned on based on the register information, and determine whether software flow control or hardware flow control is used, and output the judgment result. However, whether it is software flow control or hardware flow control, the test process is the same, as follows: when the flow function can be turned on, execute the instructions for receiving and sending data, and determine whether the reception and transmission of data are normal after the flow control function is turned on. If the data is received and sent normally, the test program is terminated, and the error information is printed and saved; if it is not normal, it means that the flow control function is turned on and the test is normal, and further test whether the flow control function is turned off normally. Specifically, turn off the flow control function, check whether the data is sent normally after turning it off, if it is sent normally, it means that the flow control function test of the universal asynchronous receiver and transmitter to be tested has passed, otherwise the test fails and prints the relevant error information; finally, the test results are automatically saved, and the test completion information is output.

[0085] Step 13: If the test instruction is a basic function test instruction, determine the basic test target according to the basic test function instruction, and execute the automated test program corresponding to the basic test target.

[0086] Specifically, the basic function test includes function tests of different data bits, different stop bits, different parity bits, error start bits, and different baud rates. According to the test instructions selected by the user, the corresponding automatic test program is processed, which can be specifically: according to the function point requirements, the function tests of different data bits, different stop bits, different parity bits, error start bits, and different baud rates are executed in sequence, and other parameters are kept unchanged. According to the results generated after the command is executed, it is automatically determined whether the test passes. If it fails, the corresponding function point information is printed and the corresponding exception log is saved.

[0087] It should be noted that when the user selects multiple test functions, this embodiment does not limit the execution order of step 11, step 12 and step 13. This embodiment, through the writing and execution of automated test programs, effectively tests and verifies the DMA interface function test of UART and the flow control function test of UART, which lack related test methods, and can also take into account other basic function tests of UART, which is a more comprehensive test method.

[0088] Furthermore, in order to improve the test effect, before executing the automated test program, the following steps may also be included:

[0089] Detecting whether the universal asynchronous receiver / transmitter to be tested has a direct memory access interface, and if so, providing a direct memory access interface function test instruction; if not, not providing a direct memory access interface function test instruction;

[0090] It is detected whether the universal asynchronous receiver / transmitter to be tested has a flow control function, and if so, a flow control function test instruction is provided; if not, no flow control function test instruction is provided.

[0091] Specifically, when the universal asynchronous receiver-transmitter to be tested is automatically tested in this embodiment, in order to avoid the user from selecting the wrong instruction, the universal asynchronous receiver-transmitter to be tested can be tested first. For the universal asynchronous receiver-transmitter that only has the processor bus interface and the UART bus interface that interact with the processor and does not have the direct memory access interface, the user will not be given the direct memory access interface function test instruction, and accordingly, the universal asynchronous receiver-transmitter will not be tested for this function; and for the universal asynchronous receiver-transmitter that only supports baud rates lower than 115200, does not support high baud rate transmission, and does not have the flow control function, the flow control function test instruction is not provided for it. Effectively remind the user to avoid wasting time testing functions that are not available. For the universal asynchronous receiver-transmitter to be tested in this case, a default option can be provided for the user, that is, only the basic function test of the universal asynchronous receiver-transmitter to be tested is required. For various types of universal asynchronous receiver-transmitters to be tested, while performing comprehensive tests, it is also possible to avoid wasting time and resources on unnecessary tests, thereby improving test efficiency.

[0092] Furthermore, in order to increase the reliability of the test, after the test results are obtained, the following steps may be included: when the test results are normal and a repeat test instruction is received, the corresponding repeat function test is automatically performed.

[0093] Specifically, for test results without abnormalities, multiple cycles of repeated testing can be selected to test the stability of the function point. After the test is completed, the results generated by the test process are automatically saved and the test completion information is output.

[0094] Furthermore, in order to facilitate users to view the test results, the above test results are automatically saved, which may include the following steps: classifying and archiving the test results according to the test functions for saving.

[0095] Specifically, for the test results generated by the test, the test results are automatically saved and classified and archived according to the test function. In this way, when the user chooses a full coverage functional test, the test results of each functional item can be easily checked to ensure that the functional points are fully covered.

[0096] The test method of the universal asynchronous receiver and transmitter provided by the embodiment of the present invention is applied, by writing an adapted driver in the kernel driver; compiling the kernel, implanting the written driver into the kernel, generating an executable kernel image file; implanting the kernel image file into the test platform, starting the operating system corresponding to the kernel; connecting the test platform with the board with the universal asynchronous receiver and transmitter to be tested; writing and executing the automated test program under the operating system, obtaining the test result and automatically saving it. The beneficial effect of the method is that by writing and executing the automated test program based on the operating system, the problems of low test efficiency, unreliable test results, and inability to automatically save the test results of the universal asynchronous receiver and transmitter at this stage can be solved. The present invention writes and tests the automated test program based on the operating system, and the test result is reliable; and the automated test program has a high degree of automation, a more concise process, can realize automatic judgment of the test result, and can also realize automatic saving of the data generated by the test process and the test result, saving the test time, and improving the test efficiency and accuracy. In addition, when the automated program needs to be modified, it cannot be re-burned, and the automated test program can be directly modified under the operating system, and the modification becomes faster and more convenient.

[0097] It should be further explained that, under the Linux system, in addition to effectively testing the basic functions of UART, DMA interface functions and flow control functions, other transmission protocols such as SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), and CAN (Controller Area Network) can be tested efficiently and reliably through automated testing programs, which is a widely used testing method. In addition, UART will have more new functions in the subsequent development. If it is suitable for automated testing programs, the corresponding test programs and test methods can also be improved and iterated.

[0098] In order to make the present invention easier to understand, please refer to Figure 3 , Figure 3The flow chart of a method for testing a universal asynchronous receiver-transmitter provided in an embodiment of the present invention may specifically include: connecting a board and a platform, configuring a serial port tool, executing a test script, and viewing and verifying the results. Take the DMA interface test as an example for illustration. Figure 4 Write a driver that adapts to the DMA interface, and implant the driver into the operating system, connect the pins and the platform, configure the serial port tool, execute the test script for the DMA interface test, view and verify the data transmission results and transmission path, and obtain the DMA interface test results. Figure 5 A framework diagram for the processing and execution of an automated test program provided by an embodiment of the present invention. Under the Linux operating system, the automated test program is run to implement synchronous testing of the basic function test module, the DMA interface test module, and the software and hardware flow test module. For the basic function test module, each basic function therein is automatically tested and the stability of each function is tested, and its test results are saved and archived; for the DMA interface test module, it is determined whether the DMA interface is turned on, whether the transmission uses the DMA interface, and whether the transmission result is correct, and its test results are saved and printed; for the software and hardware flow control function test module, the flow control configuration is turned on and the data receiving and sending instructions are executed to test whether the flow control function is turned on normally; the flow control configuration is disabled and the unsent data is retransmitted to test whether the flow control function is turned off normally, and its test results are saved and printed.

[0099] The following is an introduction to a UART test device provided by an embodiment of the present invention. The UART test device described below and the UART test method described above can be referenced to each other.

[0100] Please refer to Figure 4 , Figure 4 A schematic diagram of a structure of a test device for a universal asynchronous receiver-transmitter provided in an embodiment of the present invention may include:

[0101] The driver writing module 100 is used to write an adapted driver in the kernel driver;

[0102] A kernel image file generating module 200 is used to compile the kernel, implant the written driver into the kernel, and generate an executable kernel image file;

[0103] The operating system startup module 300 is used to implant the kernel image file into the test platform and start the operating system corresponding to the kernel; the test platform is connected to the board with the universal asynchronous receiver and transmitter to be tested;

[0104] The automated test program writing and executing module 400 is used to write and execute automated test programs under the operating system, obtain test results and automatically save them.

[0105] Based on the above embodiment, the driver writing module 100 may include:

[0106] A driver writing unit, used for writing a driver for direct memory access interface test, a driver for basic function test and a driver for flow control function test in the driver of the kernel;

[0107] Accordingly, the automated test program writing and executing module 400 includes:

[0108] The automated test program writing unit is used to write automated test programs for direct memory access interface testing, basic function testing and flow control function testing under the operating system.

[0109] Based on the above embodiment, the automated test program writing unit may include:

[0110] A first writing subunit, used for writing an automated test program of the direct memory access interface under the operating system;

[0111] A second writing subunit is used to write an automated test program for a data bit test function, a stop bit test function, a parity bit test function, a start bit check function and a baud rate test function under the operating system;

[0112] The third writing subunit is used to write an automated test program for the software flow control test function and the hardware flow control test function under the operating system.

[0113] Based on the above embodiment, the automated test program writing and executing module 400 may include:

[0114] The automated test program execution unit is used to execute the corresponding automated test program according to the functional test instructions under the operating system, perform automated judgment, obtain the test results and automatically save them.

[0115] Based on the above embodiment, the automated test program execution unit may include:

[0116] The first execution subunit is used for executing the automatic test program of the direct memory access interface if the test instruction is a direct memory access interface function test instruction, judging whether the direct memory access interface transmission mode of the universal asynchronous receiver and transmitter to be tested is enabled; if not enabled, terminating the test; if enabled, performing a direct memory access interface data transceiver test to judge whether the direct memory access interface is used for data transmission, and if so, the test is normal; if not, terminating the test and outputting abnormal information;

[0117] The second execution subunit is used for, if the test instruction is a flow control function test instruction, executing a test program of the flow control function test, judging whether the flow control function of the universal asynchronous receiver and transmitter to be tested is enabled according to the register information; if not enabled, terminating the test; if enabled, executing instructions for receiving and sending data, judging whether the reception and sending of data are normal, if normal, terminating the test and outputting abnormal information; if abnormal, turning off the flow control function of the universal asynchronous receiver and transmitter to be tested, judging whether the reception and sending of data are normal after turning off, if normal, the test passes; if abnormal, terminating the test and outputting abnormal information;

[0118] The third execution subunit is used to determine a basic test target according to the basic test function instruction if the test instruction is a basic function test instruction, and execute the automated test program corresponding to the basic test target.

[0119] Based on the above embodiment, the test device of the universal asynchronous receiver / transmitter may further include:

[0120] The repeat test module is used to automatically perform a corresponding repeat function test after obtaining a test result, when the test result is normal and a repeat test instruction is received.

[0121] Based on the above embodiment, the automated test program writing and executing module 400 may include:

[0122] The classification and storage unit is used to classify and archive the test results according to the test functions for storage.

[0123] It should be noted that the order of the modules and units in the above-mentioned UART test device can be changed without affecting the logic.

[0124] The test device for the universal asynchronous receiver and transmitter provided by the embodiment of the present invention is used to write an adapted driver in the kernel driver through a driver writing module 100; a kernel image file generating module 200 is used to compile the kernel, implant the written driver into the kernel, and generate an executable kernel image file; an operating system startup module 300 is used to implant the kernel image file into the test platform and start the operating system corresponding to the kernel; the test platform is connected to a board with a universal asynchronous receiver and transmitter to be tested; an automated test program writing and executing module 400 is used to write and execute an automated test program under the operating system, obtain the test result and automatically save it. The beneficial effect of the device is that by writing and executing an automated test program based on the operating system, the problems of low efficiency, unreliable test results, and inability to automatically save the test results of the universal asynchronous receiver and transmitter at the current stage can be solved. The present invention writes and tests the automated test program based on the operating system, and the test result is reliable; and the automated test program has a high degree of automation, can realize automatic judgment of the test result, and can also realize automatic saving of the data generated by the test process and the test result, saving the test time and improving the efficiency and accuracy. Moreover, when the automation program needs to be modified, it cannot be re-burned. The automation test program can be modified directly under the operating system, making the modification faster and more convenient.

[0125] Figure 7 A schematic diagram of the structure of a universal asynchronous receiver-transmitter test device provided by an embodiment of the present invention, such as Figure 7 The test equipment of the universal asynchronous receiver-transmitter shown comprises: a memory 60 for storing a computer program;

[0126] The processor 61 is used to implement the steps of the method for testing the universal asynchronous receiver / transmitter of the above embodiment when executing the computer program.

[0127] The test equipment of the universal asynchronous receiver / transmitter provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.

[0128] Among them, the processor 61 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 61 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 61 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 61 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 61 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0129] The memory 60 may include one or more computer-readable storage media, which may be non-transitory. The memory 60 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 60 is at least used to store the following computer program 601, wherein, after the computer program is loaded and executed by the processor 61, the relevant steps of the test method of the universal asynchronous receiver and transmitter disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 60 may also include an operating system 602 and data 603, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 602 may include Windows, Unix, Linux, etc. The data 603 may include, but is not limited to, test data of the universal asynchronous receiver and transmitter, etc.

[0130] In some embodiments, the UART test equipment may further include a display screen 62 , an input / output interface 63 , a communication interface 64 , a power supply 65 , and a communication bus 66 .

[0131] Those skilled in the art will understand that Figure 7 The structure shown in the figure does not constitute a limitation on the test equipment of the universal asynchronous receiver-transmitter, and may include more or less components than those shown in the figure.

[0132] It is understandable that if the test method of the universal asynchronous receiver-transmitter in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the current technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk or optical disk and other media that can store program codes.

[0133] Based on this, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the test method for the universal asynchronous receiver and transmitter are implemented.

[0134] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0135] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0136] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0137] The above is a detailed introduction to a test method, device, equipment and medium for a universal asynchronous receiver / transmitter provided by the present invention. Specific examples are used herein to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there may be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for testing a universal asynchronous receiver-transmitter, characterized in that: include: Write an adapted driver in the kernel driver; Compiling the kernel, implanting the written driver into the kernel, and generating an executable kernel image file; Implanting the kernel image file into the test platform, and starting the operating system corresponding to the kernel; The test platform is connected to a board with a universal asynchronous receiver-transmitter to be tested; Under the operating system, an automated test program is written and executed, and the test results are obtained and automatically saved.

2. The method for testing a universal asynchronous receiver-transmitter according to claim 1, wherein: Write an adapted driver in the kernel driver, including: Writing a driver program for direct memory access interface testing, a driver program for basic function testing, and a driver program for flow control function testing in the driver of the kernel; Accordingly, under the operating system, an automated test program is written, including: Under the operating system, write automated test programs for direct memory access interface testing, basic function testing, and flow control function testing.

3. The method for testing a universal asynchronous receiver-transmitter according to claim 2, wherein: Under the operating system, write automated test programs for direct memory access interface testing, basic function testing, and flow control function testing, including: Under the operating system, writing an automated test program for the direct memory access interface; Under the operating system, write an automated test program for a data bit test function, a stop bit test function, a parity bit test function, a start bit check function, and a baud rate test function; Under the operating system, write automated test programs for software flow control test functions and hardware flow control test functions.

4. The method for testing a universal asynchronous receiver-transmitter according to claim 2, wherein: Under the operating system, the automated test program is executed to obtain the test results and automatically save them, including: Under the operating system, the corresponding automatic test program is executed according to the functional test instruction, automatic judgment is performed, and the test results are obtained and automatically saved.

5. The method for testing a universal asynchronous receiver-transmitter according to claim 4, wherein: Under the operating system, the corresponding automated test program is executed according to the functional test instruction to perform automated judgment, including: If the test instruction is a direct memory access interface function test instruction, the automatic test program of the direct memory access interface is executed to determine whether the direct memory access interface transmission mode of the universal asynchronous receiver and transmitter to be tested is enabled; if not enabled, the test is terminated; if enabled, a direct memory access interface data transceiver test is performed to determine whether the direct memory access interface is used for data transmission, and if so, the test is normal; if not, the test is terminated and abnormal information is output; If the test instruction is a flow control function test instruction, a test program of the flow control function test is executed, and the flow control function of the universal asynchronous receiver and transmitter to be tested is judged according to the register information whether it is enabled; if it is not enabled, the test is terminated; if it is enabled, the instructions for receiving and sending data are executed to judge whether the reception and sending of data are normal, if it is normal, the test is terminated and abnormal information is output; if it is not normal, the flow control function of the universal asynchronous receiver and transmitter to be tested is turned off, and after turning it off, it is judged whether the reception and sending of data are normal, if it is normal, the test passes; if it is not normal, the test is terminated and abnormal information is output; If the test instruction is a basic function test instruction, a basic test target is determined according to the basic test function instruction, and an automated test program corresponding to the basic test target is executed.

6. The method for testing a universal asynchronous receiver-transmitter according to claim 2, wherein: After getting the test results, it also includes: When the test result is normal and a repeat test instruction is received, the corresponding repeat function test is automatically performed.

7. The method for testing a universal asynchronous receiver-transmitter according to claim 2, wherein: Test results are automatically saved, including: The test results are classified, archived and saved according to the test functions.

8. A test device for a universal asynchronous receiver-transmitter, characterized in that: include: The driver writing module is used to write the adapted driver in the kernel driver; A kernel image file generation module, used for compiling the kernel, implanting the written driver into the kernel, and generating an executable kernel image file; An operating system startup module, used to implant the kernel image file into the test platform and start the operating system corresponding to the kernel; The test platform is connected to a board with a universal asynchronous receiver-transmitter to be tested; The automated test program writing and execution module is used to write and execute automated test programs under the operating system, obtain test results and automatically save them.

9. A test device for a universal asynchronous receiver-transmitter, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for testing a universal asynchronous receiver-transmitter as claimed in any one of claims 1 to 7 when executing the computer program.

10. A medium, characterized in that The medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the method for testing a universal asynchronous receiver-transmitter transmitter as claimed in any one of claims 1 to 7 are implemented.