Identification circuit and identification method for USB host and USB device, and USB chip
The connection status of the USB port is detected by a weakly driven source voltage output unit and a voltage comparator, which solves the problem of the existing technology that the host or device cannot be silently identified, realizes silent detection and accurate identification of the USB port, and improves compatibility.
Patent Information
- Application Number
- PCT/CN2024/108588
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-21
- Filing Date
- 2024-07-30
- Publication Date
- 2025-09-25
AI Technical Summary
In the prior art, USB ports cannot silently detect and identify a host or device, resulting in pin level states that do not comply with USB specifications, affecting compatibility and online monitoring.
A weak-driven source voltage output unit and a voltage comparator are combined with a control unit to detect the level status of the DP and DM pins to achieve silent detection of the connection status of the USB port, including idle, host and device identification.
It realizes continuous online monitoring during non-communication period, with accurate identification, good compatibility and compliance with USB specifications.
Smart Images

Figure CN2024108588_25092025_PF_FP_ABST
Abstract
Description
[Corrected 22.08.2024 according to Rule 26] Identification circuit and identification method of USB host and device, USB chip Technical Field
[0001] The present invention relates to USB communication technology, and in particular to a USB host and device identification circuit and identification method, and a USB chip. Background Art
[0002] USB communication is usually a point-to-point master-slave communication mode, where one device acts as the USB host and the other device acts as the USB device, equivalent to the slave.
[0003] Some microcontrollers (MCUs) have only one USB transceiver (PHY) and support only one USB port, but can choose to operate in USB host (Host) or device (Device) mode by writing registers.
[0004] By inserting a USB hub, a USB host can communicate with multiple USB devices. In this case, the hub's upstream port simulates a USB device connected to the USB host, while the hub's multiple downstream ports simulate the USB host connected to a USB device. Typically, the operating modes of a hub's upstream and downstream ports are fixed, but in certain application scenarios where a mobile device connects to a computer, the hub may need to switch the functions of the upstream port and a downstream port.
[0005] Most USB devices are fixed as either USB devices or USB hosts, while some support dynamic switching between host and device modes. USB supports dynamic plugging and unplugging while powered on. A previously connected USB device may disconnect and be replaced by a USB host. To facilitate automatic switching between host and device based on the type of device connected to its USB port, or to notify the microcontroller to write a register to select the mode, the USB device needs to identify the type of device connected to the USB port.
[0006] Existing technologies such as CN 106104504 B and CN 112041827 B provide a USB host and device identification scheme. When attempting to detect a USB host, the scheme detects the level status of the DP and DM pins by disabling the corresponding resistors and enabling the corresponding current sources. During the detection process, the DP and DM pins will continuously appear high level, while the USB device has not yet been inserted. This state does not meet the requirements of the USB specification and is an intrusive detection and identification method, which is not conducive to the compatibility of the USB interface. Because this technical solution generates pin level states that do not comply with the USB specification, it cannot be continuously monitored online and needs to be shut down in a timely manner according to the situation to avoid affecting normal USB communication.
[0007] Summary of the Invention
[0008] Purpose of the invention: In order to solve the problem in the prior art that a USB port cannot silently detect and identify a host or device, the present invention provides a USB host and device identification circuit and identification method, and a USB chip.
[0009] Technical solution: A USB host and device identification circuit, including:
[0010] control unit;
[0011] The USB transceiver includes a first single-ended receiver, a second single-ended receiver, a DP pin, and a DM pin, wherein the input ends of the first single-ended receiver and the second single-ended receiver are connected to the DP pin and the DM pin respectively, and the output ends of the first single-ended receiver and the second single-ended receiver are both connected to the control unit;
[0012] A first weak-drive source voltage output unit, an output end of which is connected to the DP pin;
[0013] A first voltage comparator, an input end of which is connected to the DP pin, and an output end of which is connected to the control unit;
[0014] Let the no-load output voltage of the first weak-driven source voltage output unit be V1, and the reference voltage of the first voltage comparator be V ref1 , the low-level threshold voltage of the first single-ended receiver is V th1 , there is V ref1 <V1<V th1 .
[0015] Furthermore, it also includes a second weak-driven source voltage output unit and a second voltage comparator, the output end of the second weak-driven source voltage output unit and the input end of the second voltage comparator are both connected to the DM pin, the output end of the second voltage comparator is connected to the control unit, the no-load output voltage of the second weak-driven source voltage output unit is V2, and the reference voltage of the second voltage comparator is V ref2, the low-level threshold voltage of the second single-ended receiver is V th2 , there is V ref2 <V2<V th2 .
[0016] Furthermore, a weak pull-down circuit is included, wherein the weak pull-down circuit is connected to the DM pin, and the weak pull-down circuit is a pull-down resistor or a pull-down current.
[0017] Furthermore, V1-V ref1 ≥0.1V.
[0018] Furthermore, the source current output capability of the first weak-driven source voltage output unit ranges from 2uA to 20uA.
[0019] Furthermore, the first weak-driven source voltage output unit includes a voltage source and a current limiting module, and the voltage source and the current limiting module are connected in series; or the first weak-driven source voltage output unit includes a high-voltage end resistor and a low-voltage end resistor, and the high-voltage end resistor and the low-voltage end resistor are connected in series, the high-voltage end resistor is connected to the power supply, and the low-voltage end resistor is connected to the ground, and the resistance range of the low-voltage end resistor is 30KΩ~300KΩ.
[0020] Furthermore, the control unit is a USB HUB controller or a USB controller, which is used to determine the connection status of the USB port according to the output signal of the single-ended receiver and the output signal of the first voltage comparator.
[0021] A USB chip includes the above-mentioned USB host and device identification circuit, including a USB controller, the control unit is connected to the USB controller, or the USB controller includes the control unit.
[0022] A method for identifying a USB host and a device using the aforementioned identification circuit comprises the following steps:
[0023] When the output signal of the first voltage comparator is at a high level and the output signal of the first single-ended receiver is at a low level, the USB port is in an idle state;
[0024] When the output signal of the first voltage comparator and the output signal of the first single-ended receiver are both at low levels, the USB port is connected to the USB host;
[0025] When the output signal of the first voltage comparator and the output signal of the first single-ended receiver are both at a high level, a non-low-speed USB device is connected to the USB port.
[0026] Furthermore, it also includes:
[0027] When the output signal of the first single-ended receiver is low and the output signal of the second single-ended receiver is high, the USB port is connected to a low-speed USB device.
[0028] Compared with the existing technology, the USB host and device identification circuit and identification method, and USB chip provided by the present invention have the following beneficial effects: they can detect the connection status of the USB port, including whether there is a device connected, and determine whether the connected device is a USB host or a USB device, and meet the parameter requirements of the USB specification. They can continue online monitoring during non-communication periods, realizing silent detection without any sense, accurate identification, and good compatibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] FIG1 is a schematic structural diagram of a USB host and device identification circuit according to an embodiment of the present invention;
[0030] FIG2 is a schematic structural diagram of a weak-driven source voltage output unit;
[0031] FIG3 is a schematic diagram of a second structure of a weak-driven source voltage output unit;
[0032] FIG4 is a schematic diagram of a third structure of a weak-driven source voltage output unit;
[0033] FIG5 is a connection diagram of the DM pins of the second embodiment;
[0034] FIG6 is another connection diagram of the DM pins of the second embodiment. DETAILED DESCRIPTION
[0035] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments.
[0036] Example 1
[0037] A USB host and device identification circuit comprises a control unit, a USB transceiver, a first weak-driven source voltage output unit, and a first voltage comparator.
[0038] The USB transceiver includes a first single-ended receiver, a second single-ended receiver, a DP pin and a DM pin. The input end of the first single-ended receiver is connected to the DP pin, and the input end of the second single-ended receiver is connected to the DM pin. The single-ended receiver can detect and output the logic levels of the DP and DM pins.
[0039] The first weak-drive source voltage output unit, as shown in FIG1 , has an output end connected to the DP pin.
[0040] A first voltage comparator, as shown in FIG1 , having an input connected to the DP pin and an output connected to the control unit;
[0041] Let the no-load output voltage of the first weak-driven source voltage output unit be V1, and the reference voltage of the first voltage comparator be V ref1 , the low-level threshold voltage of the first single-ended receiver is Vth1 , theoretically, V ref1 <V1<V th1 The reference voltage of the actual first voltage comparator is at least 0.1V lower than the no-load output voltage of the source voltage output unit of the first weak drive, so that the comparator can identify the no-load state of the DP pin. The value can be: 0.15V≤V ref1 ≤0.55V, and 0.3V≤V1≤0.75V. The source current output capability range of the first weak-driven source voltage output unit is 2uA~20uA. As in this embodiment, it is preferred that V ref1 is 0.35V, V1 is 0.6V, and the source current output capability is 8uA, which is equivalent to the maximum driving current of the source voltage output unit.
[0042] The control unit is configured to determine the connection status of the USB port according to the output signal DPI of the single-ended receiver and the output signal CMPO of the first voltage comparator. The control unit is a USB HUB controller or a USB controller.
[0043] Specifically in terms of circuit structure, the source voltage output unit of the first weak drive can have various structures, usually including a voltage source and a current limiting module. As shown in FIG2 , the voltage source and the current limiting module are connected in series.
[0044] As shown in Figure 3, the first weak-driven source voltage output unit includes a reference voltage, a current limiting module, a source follower module composed of an op amp and NMOS, and a pull-down module. Among them, the reference voltage is preferably 0.6V, the current limiting module can be implemented with a constant current mirror of about 8uA, and the pull-down module can be implemented with a pull-down resistor of about 400KΩ or a pull-down current of about 2uA. When the DP output is 0.6V when unloaded, when the USB host's own 15KΩ pull-down resistor is connected to the DP pin, the DP pin voltage drops to about 0.1V, which is lower than the reference voltage V of the first voltage comparator. ref1 .
[0045] As shown in Figure 4, the first weak-driven source voltage output unit can also be another simplified structure. The first weak-driven source voltage output unit includes a high-voltage end resistor and a low-voltage end resistor. The high-voltage end resistor and the low-voltage end resistor are connected in series. The other end of the high-voltage end resistor is connected to the USB standard 3.3V power supply. If the 5V power supply is changed, the resistance value needs to be recalculated proportionally; the other end of the low-voltage end resistor is connected to the ground (0V), and the resistance range of the low-voltage end resistor is 30KΩ~300KΩ. The voltage divider of the two resistors is preferably 0.6V, the low-voltage end resistor can be selected as 75K, and the high-voltage end resistor can be selected as 330K. When unloaded, DP outputs 0.6V. When the USB host's built-in 15KΩ pull-down resistor is connected to the DP pin, the DP pin voltage drops to about 0.12V, which is lower than the reference voltage V of the first voltage comparator ref1 .
[0046] A USB chip includes the above-mentioned USB host and device identification circuit. The USB chip also includes a USB controller, and the control unit is connected to the USB controller. In addition, the control unit can be integrated into the USB controller.
[0047] A method for identifying a USB host and device using the aforementioned USB host and device identification circuit includes the following steps: a control unit determines whether a USB port is idle, connected to a host, or connected to a non-low-speed device based on the output signal DPI of a single-ended receiver and the output signal CMPO of a first voltage comparator.
[0048] When the output signal of the first voltage comparator is at a high level and the output signal of the first single-ended receiver is at a low level, the USB port is in an idle state;
[0049] When the output signal of the first voltage comparator and the output signal of the first single-ended receiver are both at low levels, the USB port is connected to the USB host;
[0050] When the output signal of the first voltage comparator and the output signal of the first single-ended receiver are both at a high level, a non-low-speed USB device is connected to the USB port.
[0051] The working principle is as follows, see the table below:
[0052] When idle, the DP pin voltage is equivalent to the no-load output voltage V1 (0.6V) of the first weak-driven source voltage output unit, which complies with the USB specification and is lower than the low-level threshold voltage V of the USB single-ended receiver. th1 , but higher than the reference voltage V ref1 , so DPI is low (0) and CMPO is high (1), corresponding to the idle state.
[0053] When the USB host is connected to the USB port, the 15KΩ pull-down resistor of the USB host DP pin is also connected to the DP pin of the circuit. Since the source current output capability of the first weak drive source voltage output unit is limited, which is 8uA in this embodiment, the DP pin voltage drops to 0.12V, which is lower than the reference voltage V of the first voltage comparator. ref1 , so DPI is 0 and CMPO is 0. At this time, it can be determined that it is a USB host access.
[0054] When a non-low-speed USB device such as a full-speed or high-speed USB device is connected to the USB port, the 1.5KΩ pull-up resistor on the DP pin of the USB device is also connected to the DP pin, causing the DP pin voltage to rise to more than 2V, which is higher than the high-level threshold voltage V of the USB single-ended receiver. th1 , higher than the reference voltage V of the first voltage comparator ref1, so DPI is 1 and CMPO is 1. At this time, it can be determined that it is a non-low-speed USB device connected.
[0055] In practical applications, anti-interference measures such as re-inspection and filtering can be added as needed to avoid re-detection and identification during the communication transmission process, and the judgment can be made in combination with the connection status provided by the high-speed USB or super-speed USB transceiver.
[0056] Example 2
[0057] Example 2 builds on Example 1 by adding a weak pull-down circuit to the DM pin to support low-speed USB device access monitoring. As shown in Figure 5 , the weak pull-down circuit can be a weak pull-down resistor, typically in the range of 200kΩ to 1000kΩ, such as 400kΩ. Alternatively, as shown in Figure 6 , the weak pull-down current can be a weak pull-down current, typically in the range of 1uA to 5uA, such as 2uA.
[0058] When a low-speed USB device is connected to the USB port, the 1.5KΩ pull-up resistor on the DM pin of the low-speed USB device is also connected to DM, causing the DM pin voltage to rise above 2V, which is higher than the high-level threshold voltage of the USB single-ended receiver. Therefore, DMI is high, but DPI is low at this time, which can be used to determine that a low-speed USB device is connected.
[0059] At this time, the control unit obtains the connection status of the USB port and the type of the connected device according to the values of CMP0, DPI, and DMI, as shown in the following table.
[0060] This embodiment additionally supports access detection of low-speed USB devices. If, in certain scenarios, it is not necessary to support access of low-speed USB devices, the weak pull-down module can be omitted and the solution of the first embodiment can be selected.
[0061] Example 3:
[0062] Compared with the first embodiment, the third embodiment not only has a first weak-driven source voltage output unit and a first voltage comparator on the DP pin, but also has a second weak-driven source voltage output unit and a second voltage comparator on the DM pin. In this embodiment, there is no pull-down circuit on the DM pin.
[0063] The connection is similar to that in the first embodiment. The output terminal of the second weak-driven source voltage output unit and the input terminal of the second voltage comparator are both connected to the DM pin. The output terminal of the second voltage comparator is connected to the control unit. The no-load output voltage of the second weak-driven source voltage output unit is V2, and the reference voltage of the second voltage comparator is V ref2 , the low-level threshold voltage of the second single-ended receiver is V th2 , there is Vref2 <V2<V th2 . V2 can be the same as V1, V ref2 Can be used with V ref1 Same, V th2 Can be used with V th1 The same, or different.
[0064] This embodiment can be used to detect the disconnection of a connected USB host online after entering the USB device mode, and to detect the connection of a low-speed USB device with reference to the detection principle of the DP pin.
Claims
1. A USB host and device identification circuit, characterized in that: include: control unit; The USB transceiver includes a first single-ended receiver, a second single-ended receiver, a DP pin, and a DM pin, wherein the input ends of the first single-ended receiver and the second single-ended receiver are connected to the DP pin and the DM pin respectively, and the output ends of the first single-ended receiver and the second single-ended receiver are both connected to the control unit; A first weak-drive source voltage output unit, an output end of which is connected to the DP pin; A first voltage comparator, an input end of which is connected to the DP pin, and an output end of which is connected to the control unit; Let the no-load output voltage of the first weak-driven source voltage output unit be V1, and the reference voltage of the first voltage comparator be V ref1 , the low-level threshold voltage of the first single-ended receiver is V th1 , there is V ref1 <V1<V th1 .
2. The USB host and device identification circuit according to claim 1, wherein: The device further includes a second weakly driven source voltage output unit and a second voltage comparator. The output end of the second weakly driven source voltage output unit and the input end of the second voltage comparator are both connected to the DM pin. The output end of the second voltage comparator is connected to the control unit. The no-load output voltage of the second weakly driven source voltage output unit is V2. The reference voltage of the second voltage comparator is V ref2 , the low-level threshold voltage of the second single-ended receiver is V th2 , there is V ref2 <V2<V th2 .
3. The USB host and device identification circuit according to claim 1, wherein: It also includes a weak pull-down circuit, which is connected to the DM pin and is a pull-down resistor or a pull-down current.
4. The USB host and device identification circuit according to any one of claims 1 to 3, characterized in that: V1-V ref1 ≥0.1V。 5. The USB host and device identification circuit according to any one of claims 1 to 3, characterized in that: The source current output capability range of the first weak-driven source voltage output unit is 2uA to 20uA.
6. The USB host and device identification circuit according to any one of claims 1 to 3, characterized in that: The first weak-driven source voltage output unit includes a voltage source and a current limiting module, and the voltage source and the current limiting module are connected in series; or the first weak-driven source voltage output unit includes a high-voltage end resistor and a low-voltage end resistor, and the high-voltage end resistor and the low-voltage end resistor are connected in series, the high-voltage end resistor is connected to the power supply, and the low-voltage end resistor is connected to the ground, and the resistance range of the low-voltage end resistor is 30KΩ~300KΩ.
7. The USB host and device identification circuit according to any one of claims 1 to 3, characterized in that: The control unit is a USB HUB controller or a USB controller, and is configured to determine a connection state of the USB port according to an output signal of the single-ended receiver and an output signal of the first voltage comparator.
8. A USB chip, characterized in that: The USB host and device identification circuit comprises the USB controller as described in any one of claims 1 to 7, wherein the control unit is connected to the USB controller, or the USB controller comprises the control unit.
9. A method for identifying a USB host and a device using the identification circuit according to any one of claims 1 to 7, characterized in that: The following steps are involved: When the output signal of the first voltage comparator is at a high level and the output signal of the first single-ended receiver is at a low level, the USB port is in an idle state; When the output signal of the first voltage comparator and the output signal of the first single-ended receiver are both at a low level, the USB port is connected to the USB host; When the output signal of the first voltage comparator and the output signal of the first single-ended receiver are both at a high level, a non-low-speed USB device is connected to the USB port.
10. The identification method according to claim 9, characterized in that: Also includes: When the output signal of the first single-ended receiver is at a low level and the output signal of the second single-ended receiver is at a high level, a low-speed USB device is connected to the USB port.
Citation Information
Patent Citations
System and method for detecting disconnection on dual-mode ports of USB hubs
CN106104504B
Automatic USB host detection and port configuration method and device
CN112041827B
USB (Universal Serial Bus) interface circuit, terminal equipment, signal interface and external equipment
CN105740193A
System and method for disconnect detection on a dual mode port of a USB hub
CN106104504A
Automatic USB host detection and port configuration
CN112041827A