The present invention relates to a system and method for testing a serial port.
A serial port is a port or interface that can be used for serial communication in which only data is transmitted in or out one bit at a time. Most serial ports on personal computers conform to the RS-232C or RS-422 standards. A serial port can be used for almost any type of device, including modems, scanners, mice, handwriting boards, and printers. A serial port can typically be either a male connector or a female cable connector. The serial port can consist of either 25 pins or 9 pins. Whether the serial port is a 9-pin or 25-pin they both can accomplish the same set of tasks. However, nowadays, 9-pin serial ports are more common than 25-pin serial ports.
The serial ports need to be tested before being put into market. The purpose of the serial port test is to test functions of the serial ports installed in a computer. Typically, the serial port test is done by utilizing a test device that can support a serial port communication, such as a serial mouse or a serial modem.
However, the above mentioned test practice has many disadvantages. For example, each computer requires one serial device for each test, when a mass of serial ports need to be tested, the peripheral devices are prone to be destroyed easily, resulting in testing costs increase and testing efficiency affected significantly. Furthermore, such test does not provide any intuitive interface for a tester. The tester cannot view actual values of corresponding testing parameters at any moment in the testing process, such as changes of baud rates during testing.
What is needed, therefore, is a system and method that can test serial ports of a computer without any peripheral devices, and can provide an intuitive user interface for displaying actual values of corresponding testing parameters in real time.
A system for testing a serial port is provided. The system includes a creating module, a configuration module, a transmitting module, an analyzing module, and a receiving module. The creating module is configured for creating a transmission loop by connecting pins of the serial port. The configuration module is configured for defining testing parameters and reference values corresponding to the testing parameters. The transmitting module is configured for importing a test file that comprises test data, for transmitting the test data into the transmission loop according to the reference values of the testing parameters. The receiving module is configured for acquiring actual values of the testing parameters during transmitting, for receiving data from the transmission loop. The analyzing module is configured for comparing the transmitted data with the received data, for comparing the actual values with the reference values of the testing parameters, and for analyzing whether the serial port is in a good working condition according to comparison results.
Furthermore, a method for testing a serial port is provided. The method includes the steps of: creating a transmission loop by connecting pins of the serial port; defining testing parameters, and reference values corresponding to the testing parameters; importing a test file that comprises test data; transmitting the test data into the transmission loop according to the reference values of the testing parameters; acquiring actual values of the testing parameters during transmitting; receiving data from the transmission loop; comparing the transmitted data with the received data and comparing the actual values with the reference values of the testing parameters; and analyzing whether the serial port is in a good working condition according to comparison results.
Moreover, another system for testing a serial port is provided. The system includes a creating module, a configuration module, a transmitting module, an analyzing module, and a receiving module. The creating module is configured for creating a transmission loop by connecting pins of the serial port. The configuration module is configured for defining testing parameters and reference values corresponding to the testing parameters, and for defining a user interface comprising a plurality of dialogue boxes for displaying the testing parameters and the corresponding reference values. The transmitting module is configured for importing a test file that comprises test data, for transmitting the test data into the transmission loop according to the reference values of the testing parameters. The receiving module is configured for acquiring actual values of the testing parameters during transmitting, for receiving data from the transmission loop. The analyzing module is configured for comparing the actual values with the reference values of the testing parameters, and for analyzing whether the serial port is in a good working condition according to a comparison result.
Other advantages and novel features of the present invention will become more apparent from the following detailed description of preferred embodiments when taken in conjunction with the accompanying drawings.
A 9-pin serial port 3 conforming to the recommended standard-232C (RS-232C) is selected for an example in the preferred embodiment. The RS-232C is a standard that describes a physical interface and a communications protocol. The RS-232C is commonly used in the computers to communicate and exchange data with modems and other serial devices, and it specifies signal levels, data formats, maximum transmission distance, etc.
As shown in
The configuration module 120 is configured for defining testing parameters and reference parameters according to testing requirements, and for defining reference values corresponding to the testing parameters. The reference parameters are configured for recording related parameters corresponding to the testing process, such as a start time and an end time of the testing process. A tester may modify the reference values through the configuration module 120. The testing parameters include a baud rate, a parity bit, a size of a test file, a data bit, a stop bit, etc. For example, the baud rate indicating a speed of data transmission is set to be 9600.
The configuration module 120 is further configured for defining a user interface, various dialogue boxes in the user interface, and functions corresponding to the dialogue boxes. For example, the configuration module 120 defines functions to the dialogue boxes for displaying different information (described in detail in relation to
For example, since the pins of the serial port 3 have different signal statuses, the configuration module 120 defines a signal status dialogue box to display different colors corresponding to different signal statuses of the pins of the serial port 3. The signal statuses of the pins of the serial port 3 include a high level status, a low level status, and a twinkling status. After the creating module 110 creates the transmission loop, before data is transmitted, the signal status of the DCD pin 31, the DTR pin 34, and the DSR pin 36 are in the high level status, and the signal statuses of the other pins are in the low level status. Once data transmission begins, the signal statuses of the RTS pin 37 and the CTS pin 38 change to the high level statuses, and the signal statuses of the RxD pin 32 and the TXD pin 33 change to the twinkling statuses. After data transmission has finished, the signal statuses of the RTS pin 37 and the CTS pin 38 change to the low level statuses. The configuration module 120 defines red color representing the high level statuses, and defines white color representing the low level statuses. Thus, the signal status dialogue box displays different colors or twinkles according to the signal statuses of the pins of the serial port 3.
The transmitting module 130 is configured for importing a test file that includes test data, and for transmitting the test data into the transmission loop according to the reference values of the testing parameters. The test file is stored in the computer 1, and may use an American national standards institute (ANSI) character set. For example, the transmitting module 130 transmits the test data with a baud rate of 9600. The data transmitted, a percentage of the transmission successfully transmitted, and a baud rate curve that shows changes of the baud rate during transmitting are defined to be displayed on the user interface (as shown in
The receiving module 140 is configured for acquiring actual values of the testing parameters and the reference parameters during transmitting, and for receiving data from the transmission loop and storing the received data in the computer 1. If the serial port 3 is in a good working condition, the data transmitted by the transmitting module 130 are first transmitted out the TxD pin 33 of the serial port 3, then through the loop back plugs 4, and finally received by the RxD pin 32 of the serial port 3. Otherwise, the data received by the RxD pin 32 may be not identical with the data transmitted by the transmitting module 130, or even worst, the serial port 3 may not receive any data at all.
The analyzing module 150 is configured for analyzing whether the signal statuses of pins of the serial port 3 are correct according to the colors displayed in the predefined signal status dialogue box. The analyzing module 150 is further configured for comparing the transmitted data and the received data, for comparing the actual values and the reference values of the testing parameters, and for analyzing whether the serial port 3 is in a good working condition according to comparison results.
If the signal statuses of the pins of the serial port 3 are incorrect, if the transmitted data and the received data are not identical, or if the actual values and the reference values are not identical, the analyzing module 150 analyzes that the serial port 3 has errors and prompts the tester about the errors. Otherwise, if the signal statuses of the pins of the serial port 3 are correct, the transmitted data and the received data are identical, and the actual values and the reference values are identical, the analyzing module 150 analyzes the serial port 3 is in a good working condition.
The analyzing module 150 compares the above information according to one or more verification means. The verification means includes a parity check, a cyclic redundancy check (CRC), or a checksum verification. For example, the analyzing module 150 utilizes the verification means by following steps of: executing the checksum verification before the transmitting module 130 transmits the test data; acquiring a first checksum result; adding CRC codes in the data to be transmitted; executing the CRC after the data transmitted is received; deleting the CRC codes from the data received; executing the checksum verification for a second time; acquiring a second checksum result; comparing the first checksum result and the second checksum result; and analyzing whether the received data are identical with the transmitted data.
The testing parameters dialogue box 101 displays the testing parameters defined by the configuration module 120, such as the serial port 3 to be tested, the baud rate, etc. The data-transmitting dialogue box 102 displays the data being transmitting and provides three clickable options: a first clickable option for importing a test file, a second clickable option to start transmitting the test data in the test file, and a third clickable option for clearing the displayed data. As shown in
The data-receiving dialogue box 103 displays the received data. The status bar 104 displays the percentage of the transmission successfully transmitted. The baud rate curve 105 displays the changes of the baud rate during transmitting. The signal status dialogue box 106 displays different colors or twinkles indicating different signal statuses of the pins of the serial port 3.
The data verification dialogue box 107 provides statistics data assisting the tester to analyze whether the transmission is normal. The statistics data include a data-transmitting amount and a data-receiving amount. The statistics data are updated in real time. The data verification dialogue box 107 also provides three clickable options for verifying the received data: a parity check option, a checksum verification option, and a cyclic redundancy check option. The reference parameter dialogue box 108 displays other reference parameters related with the testing process, such as an input buffer, an output buffer, etc.
All the functions of the dialogue boxes, the testing parameters, and the reference parameters shown in
In step S3, the configuration module 120 defines the testing parameters and reference parameters according to testing requirements, and defines the reference values corresponding to the testing parameters. The testing parameters and the reference parameters are shown in corresponding dialogue boxes on the user interface 100, and the reference values are modifiable in corresponding dialogue boxes on the user interface 100 through the configuration module 120.
In step S5, the transmitting module 130 imports the test file that includes the test data, and transmits the test data into the transmission loop according to the reference values of the testing parameters. While transmitting the test data, the predefined dialogue boxes on the user interfaces 100 displays different relating information in real time. For example, the data-transmitting dialogue box 102 displays the transmitted data, the baud rate curve 105 shows changes of the baud rate while transmitting the test data, and the signal status dialogue box 106 displays different colors indicating different signal statuses of the pins of the serial port 3 (as shown in
In step S7, the receiving module 140 receives data from the transmission loop, and acquires the actual values of the testing parameters.
In step S9, the analyzing module 150 analyzes whether the signal statuses of the pins of the serial port 3 are correct according to the colors displayed in the signal status dialogue box 106. If the signal statuses of the pins of the serial port 3 are correct, in step S11, the analyzing module 150 compares the actual values with the reference values of the testing parameters, and analyzes whether the actual values and the reference values are identical. Otherwise, if the signal statuses of the pins of the serial port 3 are incorrect, the procedure goes directly to step S17.
If the actual values and the reference values are identical, in step S13, the analyzing module 150 compares the received data with the transmitted data according to the verification means, and analyzes whether the received data and the transmitted data are identical. Otherwise, if the actual values and the reference values are not identical, the procedure directly goes to step S17.
If the received data and the transmitted data are identical, the analyzing module 150 analyzes the serial port 3 to be in a good working condition. Otherwise, if the received data and the transmitted data are not identical, in step S17, the analyzing module 150 analyzes that the serial port has errors, and prompts the errors on the user interface.
The testing procedure can be defined to repeat one more times for obtaining more accurate test results.
It should be emphasized that the above-described embodiments, particularly, any “preferred” embodiments, are merely possible examples of implementations, merely set forth for a clear understanding of the principles of the invention. Many variations and modifications may be made to the above-described preferred embodiment(s) without departing substantially from the spirit and principles of the invention. All such modifications and variations are intended to be included herein within the scope of this disclosure and the above-described preferred embodiment(s) and protected by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
200510100589.3 | Oct 2005 | CN | national |