Patent Publication Number: US-6701401-B1

Title: Method for testing a USB port and the device for the same

Description:
BACKGROUND OF THE INVENTION 
     1. Field of Invention 
     The present invention relates to a method for testing the connection between a USB port and a USB host controller through a simple circuit and the device for the same. 
     2. Related Art 
     The universal serial bus (USB) is a new generation peripheral interface, which is set forth by seven software and hardware companies, including Intel, Compaq, NEC, DEC (Digital), IBM, Northern Telecom, and Microsoft. The transmission speed of this interface can be either 1.5 Mbps or 12 Mbps. It can connect at most 127 peripheral devices. Since its transmission speed is much faster than a parallel port or a serial port used in a personal computer (PC), therefore the USB significantly increases the transmission efficiency between the computer and its peripheral devices. 
     The Windows 98 operating system supports the USB interface. It sets a unified specification for the peripheral communications port of a PC and supports almost all peripheral devices, such as the USB interface network card, keyboard, mouse, joystick, optical disk drive, tape drive, printer, scanner, digital camera, etc. These USB devices do not only support the plug-and-play function but also the hot-plug function. 
     Through the USB, peripheral devices of different types (such as the mouse, keyboard, joystick, speaker, modem, scanner, optical disk drive, etc) can be connected to a PC through the same interface, simplifying the PC interface type. Moreover, the USB has such advantages of a lower cost, more connections, occupying less system resources and supporting a plurality of transmission protocols (at most four different protocols). 
     The current test method is to plug a USB device (such as a USB mouse) to the USB port on a PC to check the connection of the USB port by testing the USB device. However, there are the following problems: 
     1. The test cost increases because it needs a USB device. 
     2. When the USB device does not function normally, it is impossible to determine whether it is because improper connection of the port or the USB device does not function correctly. This may leads to incorrect test conclusion. 
     3. When the condition in 2 happens, one needs to further check the function of the USB device in order to have a correct test result. This definitely lowers the efficiency of the tests. 
     SUMMARY OF THE INVENTION 
     It is a primary object of the present invention to provide a simple but effective test method to test the connection of a USB port on a personal computer main board. Using a simple hardware circuit to test the connection can avoid the complication of the current test methods and using a USB device. It can greatly save the cost and prevent incorrect judgments due to improper functioning of the USB device. 
     Further scope of applicability of the present invention will become apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The present invention will become more fully understood from the detailed description given hereinbelow illustration only, and thus are not limitative of the present invention, and wherein: 
     FIG. 1 is a working flow chart of the disclosed method for testing a USB port according to the present invention; 
     FIG. 2 is a schematic view of a test device that connects a USB port and a parallel port according to the invention; and 
     FIG. 3 is a schematic view of a USB port connection. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The invention provides a simple method for testing a USB port and the device for the same. The USB port  201  is connected with a parallel port  202 , as in FIG.  2 . 
     The USB port has four lines, VCC, GND, D+ and D−. VCC and GND are power lines, D+ and D− are twisted paired signal lines. The port status/control register of a USB host controller contains a D+ line status and a D− line status. These two reflect the statuses of the two signal lines, D+ and D−, on the USB port. When the signal line connects to a high voltage, the corresponding location in the register is 1 or otherwise 0. When testing, the signal lines on the USB port and the corresponding terminals on the parallel port are connected (FIG.  2 ). 
     A preferred embodiment of the invention is described as follows. The four lines, VCC, D+, D− and GND, are connected to the pins, D 0 , D 1 , D 2  and D 3 , on the parallel port, respectively. In particular, the VCC terminal is connected with a 100K pull-down resistor, the GND terminal is connected with a 33K pull-up resistor, a 1.5K resistor is connected between the D+ terminal and the D 1  terminal, a 1.5K resistor is connected between the D− terminal and the D 2  terminal (FIG.  2 ). The pull-down and pull-up resistors are mainly for establishing different voltages to generate connection and disconnection signals. The data lines are kept at a default voltage when not being driven. 
     The flow of the disclosed method for testing a USB port is shown in FIG.  1 . 
     First, the test system is initialized (step  101 ). This process mainly tests whether a USB host controller exists, reads the I/O base address of the USB host controller and initializes a parallel port. 
     The method then checks whether the GND signal line is disconnected (step  102 ). Both D 1  and D 2  on the parallel port are set at high voltages and the potential of D 3  of the parallel port is measured. If the potential is at a high voltage, then the GND of the USB port is disconnected, and a disconnection message will be displayed (step  103 ) and the procedure returns back to the step  101 . Otherwise, GND is not disconnected and other tests follow. 
     The method then checks whether the VCC signal line is disconnected. The D 1  and D 2  of the parallel port are set at low voltages and the potential of D 0  of the parallel port is measured. If the potential is at a low voltage, then the VCC is disconnected, and a disconnection message will be displayed (step  105 ) and the procedure returns back to the step  101 . Otherwise, VCC is not disconnected and other tests follow. 
     Step  106  tests whether D+ and D− form a short circuit with GND. D 1  and D 2  of the parallel port are set at high voltages. The USB host controller reads the statuses of D+ and D−. If one of them is at a low voltage, then the potential and GND form a short circuit. A short circuit message is displayed (step  107 ) and the procedure returns back to step  101 . If both of them are at high voltages, then no short circuit occurs and other tests follow. 
     Step  108  tests whether D+ and D− form a short circuit with VCC. D 1  and D 2  of the parallel port are set at low voltages. The USB host controller reads the statuses of D+ and D−. If one or both of them are at high voltages, then the potential and VCC form a short circuit. A short circuit message is displayed (step  109 ) and the procedure returns back to step  101 . If one or both of them are at low voltages, then no short circuit occurs and other tests follow. 
     Step  110  checks whether D+ and D− are disconnected. D 1  and D 2  of the parallel port are both set first at low voltages and then at low voltages. The D+ and D− potentials in the USB host controller are measured simultaneously. If one or both of the potentials do not show such a change, then they are disconnected. A disconnection message is displayed (step  111 ) and the procedure returns back to step  101 . If such a change is detected in one or both of the potentials, then there is no disconnection and other tests follow. Step  112  checks whether D+ and D− form a short circuit. D 1  and D 2  of the parallel port are set at a high voltage and a low voltage, respectively. The D+ and D− potentials in the USB host controller are measured. If they have the same status, then D+ and D− are short. A short circuit message is displayed (step  113 ) and the procedure returns back to step  101 . Otherwise, the system displays a successful test (step  114 ) and returns back to the initial test. 
     If there is no short circuit message throughout the above-described series of tests, then the USB port is functioning normally. The system goes on testing the next USB port. 
     The present invention provides a simple but effective method for testing the connection of a USB port. This method avoids such drawbacks as higher costs in conventional test methods. The hardware employed is more reliable and the corresponding software is simpler. 
     FIG. 3 is a schematic view of a USB port connection. The power supply  301  couples to the USB port through VCC and GND. The USB host controller  303  couples to the USB port through D+ and D−. 
     The invention being thus described, it will be obvious that the same may be varied in many ways. Such variations are not to be regarded as a departure from the spirit and scope of the invention, and all such modifications as would be obvious to one skilled in the art are intended to be included within the scope of the following claims.