USB host and device identification circuit and USB chip
By designing the identification circuit of USB host and device, using the control unit, USB transceiver, weakly driven source voltage output unit and voltage comparator, the problem that the USB port cannot silently detect and identify the host or device is solved, and insensitive silent detection and high compatibility monitoring are realized.
Patent Information
- Application Number
- CN202420568536.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-21
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2034-03-21
AI Technical Summary
In the prior art, USB ports cannot silently detect and identify the host or device, resulting in pin level status that does not comply with USB specifications, affecting compatibility and continuous monitoring.
An identification circuit for a USB host and device is designed, including a control unit, a USB transceiver, a first weakly driven source voltage output unit and a first voltage comparator. Through the cooperation of these components, the type of device connected to the USB port can be silently detected and identified without affecting normal communication.
It realizes sensorless silent detection of USB port connection, complies with the parameter requirements of USB specifications, can continuously monitor online during non-communication periods, accurately identify and have good compatibility.
Smart Images

Figure CN222562037U_ABST
Abstract
Description
Technical Field
[0001] The utility model relates to USB communication technology, in particular to an identification circuit of a USB host and a device, and a USB chip. Background Art
[0002] USB communication is usually a point-to-point master-slave communication mode, where one device acts as a USB host and the other device acts as a USB device, equivalent to a 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 or device mode by writing registers.
[0004] By inserting a USB HUB (hub), a USB host can communicate with multiple USB devices. In this case, the upstream port of the HUB imitates the USB device connecting to the USB host, and the multiple downstream ports of the HUB imitate the USB host connecting to a USB device. Usually, the working mode of the upstream port and each downstream port of the HUB is fixed, but in certain specific application scenarios where mobile devices are connected to computers, the HUB may need to exchange the functions of the upstream port and a downstream port.
[0005] Most USB devices are fixed as USB devices or USB hosts, and some USB devices support dynamic switching between host and device modes. USB supports dynamic plugging and unplugging with power on. Previously connected USB devices may be disconnected and replaced by USB host devices. In order for the USB device to automatically switch between host and device according to the type of device connected to its USB port, or notify the microcontroller to write registers to select mode, it is necessary to identify the type of device connected to the USB port.
[0006] Existing technologies such as CN 106104504B and CN 112041827B provide a USB host and device identification scheme, which detects the level status of DP and DM pins by disabling corresponding resistors and enabling corresponding current sources in the process of trying to detect the USB host. During the detection process, the DP and DM pins will continue to have high levels, while the USB device has not been inserted yet. 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. Also, because this technical solution produces a pin level state that does not meet the definition of the USB specification, it cannot be continuously monitored online and needs to be turned off in time according to the situation to avoid affecting normal USB communication. Summary of the invention
[0007] 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 a device, the utility model provides a USB host and device identification circuit and a USB chip.
[0008] Technical solution: A USB host and device identification circuit, comprising:
[0009] Control unit;
[0010] The USB transceiver comprises 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 respectively connected to the DP pin and the DM pin, and the output ends of the first single-ended receiver and the second single-ended receiver are both connected to the control unit;
[0011] A first weak-drive source voltage output unit, an output end of which is connected to the DP pin;
[0012] 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;
[0013] Let the no-load output voltage of the first weakly driven source voltage output unit be V 1 , the reference voltage of the first voltage comparator is V ref1 , the low level threshold voltage of the first single-ended receiver is V th1 , with V ref1 <V 1 <V th1 .
[0014] Furthermore, it also 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, and the no-load output voltage of the second weakly driven source voltage output unit is V 2 , 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 , with V ref2 <V 2 <V th2 .
[0015] Furthermore, 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.
[0016] Furthermore, V 1 -V ref1 ≥0.1V.
[0017] Furthermore, 0.15V≤V ref1 ≤0.55V, and 0.3V≤V1 ≤0.75V.
[0018] Furthermore, the source current output capability range of the first weak drive source voltage output unit is 2uA to 20uA.
[0019] Further, 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.
[0021] A USB chip comprises the above-mentioned identification circuit of the USB host and the device, and comprises a USB controller. The control unit is connected to the USB controller, or the USB controller comprises the control unit.
[0022] Compared with the prior art, the USB host and device identification circuit and USB chip provided by the utility model have the following beneficial effects: the connection of the USB port can be detected and the parameter requirements of the USB specification are met, and continuous online monitoring can be performed during non-communication, realizing non-sense silent detection, accurate identification and good compatibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a schematic diagram of the structure of the identification circuit of the USB host and the device in Example 1;
[0024] Figure 2 It is a structural schematic diagram of a weakly driven source voltage output unit;
[0025] Figure 3 It is a schematic diagram of the second structure of the weak-driven source voltage output unit;
[0026] Figure 4 It is a schematic diagram of the third structure of the weak-driven source voltage output unit;
[0027] Figure 5 This is a connection diagram of the DM pins of Embodiment 2;
[0028] Figure 6 Another connection diagram of the DM pin of the second embodiment. DETAILED DESCRIPTION
[0029] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments.
[0030] Embodiment 1
[0031] A USB host and device identification circuit comprises a control unit, a USB transceiver, a first weak drive source voltage output unit, and a first voltage comparator.
[0032] 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, the input end of the second single-ended receiver is connected to the DM pin, and the single-ended receiver can detect and output the logic levels of the DP and DM pins.
[0033] The first weakly driven source voltage output unit, such as Figure 1 As shown, the output end is connected to the DP pin.
[0034] The first voltage comparator, such as Figure 1 As shown, the input end is connected to the DP pin, and the output end is connected to the control unit;
[0035] Let the no-load output voltage of the first weakly driven source voltage output unit be V 1 , the reference voltage of the first voltage comparator is V ref1 , the low level threshold voltage of the first single-ended receiver is V th1 , theoretically, V ref1 <V 1 <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≤V 1 ≤0.75V. The source current output capability range of the first weakly driven source voltage output unit is 2uA to 20uA. As in this embodiment, it is preferred that V ref1 is 0.35V, V 1 It 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.
[0036] The control unit is a USB HUB controller or a USB controller.
[0037] Specifically in terms of circuit structure, the source voltage output unit of the first weak drive can have a variety of structures, usually including a voltage source and a current limiting module, such as Figure 2 As shown, the voltage source is connected in series with the current limiting module.
[0038] like Figure 3As shown, the source voltage output unit of the first weak drive 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 no-load, DP outputs 0.6V. When the USB host comes with a 15KΩ pull-down resistor 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 .
[0039] like Figure 4 As shown, 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 division 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 own 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 .
[0040] The control unit is used to determine the connection state 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.
[0041] The working principle is as follows, see the table below:
[0042] CMPO DPI DMI Judgment results 1 0 0 idle 0 0 0 Host access 1 1 0 Non-low-speed device access
[0043] When idle, the DP pin voltage is equivalent to the no-load output voltage V of the first weakly driven source voltage output unit. 1 (0.6V), in compliance with USB specifications, this voltage is lower than the low-level threshold voltage V of the USB single-ended receiver th1 , but higher than the reference voltage V of the voltage comparator ref1 , so DPI is low (0) and CMPO is high (1), corresponding to the idle state.
[0044] 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 source voltage output unit of the first weak drive 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.
[0045] 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 of the USB device DP pin 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.
[0046] In practical applications, anti-interference measures such as re-inspection and filtering can be added as needed to avoid detection and identification during the communication transmission process, and the connection status provided by the high-speed USB or super-speed USB transceiver can be combined for judgment.
[0047] A USB chip includes the above-mentioned USB host and device identification circuit. The USB chip also includes a USB controller, the control unit is connected to the USB controller, or the USB controller includes the control unit, that is, the control unit is integrated into the USB controller.
[0048] Embodiment 2
[0049] Embodiment 2 is based on embodiment 1, and adds a weak pull-down circuit to the DM pin to support access monitoring of low-speed USB devices. Figure 5 As shown, the weak pull-down circuit can be a weak pull-down resistor, which generally has a value range of 200KΩ to 1000KΩ, such as taking the weak pull-down resistor as 400kΩ. Figure 6 As shown, it is a weak pull-down current, and the general value range is 1uA to 5uA, such as using a pull-down current of about 2uA.
[0050] When a low-speed USB device is connected to the USB port, the 1.5KΩ pull-up resistor of the DM pin of the low-speed USB device is also connected to DM, causing the DM pin voltage to rise to 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 determine that a low-speed USB device is connected.
[0051] 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.
[0052] CMPO DPI DMI Judgment results 1 0 0 idle 0 0 0 Host access 1 1 0 Non-low-speed device access X 0 1 Low-speed device access
[0053] This embodiment additionally supports access detection of low-speed USB devices. If in some 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.
[0054] Embodiment 3
[0055] 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.
[0056] The connection is similar to that in the first embodiment. 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 V 2 , 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 , with V ref2 <V 2 <V th2 . V 2 Can be used with V 1 Same, V ref2 Can be used with V ref1 Same, V th2 Can be used with V th1 The same, or different.
[0057] 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 access 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 comprises 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 respectively connected to the DP pin and the DM pin, 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 weakly driven source voltage output unit be V1, and the reference voltage of the first voltage comparator be V refl , the low level threshold voltage of the first single-ended receiver is V th1 , with V refl <V1<Vt h1 .
2. The USB host and device identification circuit according to claim 1, characterized in that: The system also 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 , with V ref2 <V2<V th2 .
3. The USB host and device identification circuit according to claim 1, characterized in that: 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 refl ≥0.1V。 5. The USB host and device identification circuit according to any one of claims 1 to 3, characterized in that: 0.15V≤V refl ≤0.55V, and 0.3V≤V1≤0.75V.
6. 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 drive source voltage output unit is 2uA to 20uA.
7. The USB host and device identification circuit according to any one of claims 1 to 3, characterized in that: The first weakly 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 weakly 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Ω.
8. 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.
9. A USB chip, characterized in that: A USB host and device identification circuit comprising any one of claims 1 to 8, including a USB controller, wherein the control unit is connected to the USB controller, or The USB controller contains a control unit.
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