A hardware-controlled USB device detection circuit

By designing a hardware-controlled USB device detection circuit, using the current detection module and the amplification module, the problem of difficult detection of the plug-in and unplugging status of the USB device is solved, and the stable and reliable detection function of the USB device is achieved.

CN111366777BActive Publication Date: 2025-03-04SHENZHEN EMDOOR DIGITAL TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010318298.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-21
Publication Date
2025-03-04
Estimated Expiration
2040-04-21

AI Technical Summary

Technical Problem

The prior art is difficult to effectively detect the plug-in and unplugging status of USB devices, especially when the current of USB devices is low, the motherboard cannot detect normally.

Method used

A hardware-controlled USB device detection circuit is designed, including a current detection module, an amplification module, a switch control module and an indication module. The current signal is amplified by two-stage op amps to realize normal detection of USB devices.

Benefits of technology

By reasonably building peripheral hardware lines, the function of whether the USB device is connected to the host is realized, the circuit is stable and reliable, and it can effectively detect the access status of low-current devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111366777B_ABST
    Figure CN111366777B_ABST
Patent Text Reader

Abstract

The present invention provides a hardware-controlled USB device detection circuit, which belongs to the field of detection circuits. The present invention includes a current detection module, an amplification module, a switch control module and an indication module, wherein the current detection module is used to detect the current between the mainboard output power supply and the USB interface power supply, the output end of the current detection module is connected to the input end of the amplification module, the output end of the amplification module is connected to the control end of the switch control module, the switch control module controls the switch of the indication module, and the detection pin of the mainboard is connected to the input end of the amplification module. The beneficial effects of the present invention are: the circuit is stable and reliable, and the normal detection function when a low-current device is connected is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a detection circuit, and in particular to a hardware-controlled USB device detection circuit. Background Art

[0002] Since there is no signal change from high level to low level or from low level to high level in the two states of USB insertion and removal, the motherboard cannot be used to detect whether there is a USB device inserted or removed. In addition, since the current passed by some USB devices is very low and cannot be detected normally, it is urgent to add a hardware detection circuit to detect USB devices. Summary of the invention

[0003] To solve the problems in the prior art, the present invention provides a hardware-controlled USB device detection circuit.

[0004] The present invention comprises a current detection module, an amplifying module, a switch control module and an indication module, wherein the current detection module is used to detect the current between the mainboard output power supply and the USB interface power supply, the output end of the current detection module is connected to the input end of the amplifying module, the output end of the amplifying module is connected to the control end of the switch control module, the switch control module controls the switch of the indication module, and the detection pin of the mainboard is connected to the input end of the amplifying module.

[0005] The present invention is further improved in that the switch control module is a two-stage control switch.

[0006] The present invention is further improved, the two-stage control module includes a switch tube Q2 and a switch tube Q1, the gate of the switch tube Q2 is connected to the output end of the amplification module, the source of the switch tube Q2 is grounded, and the drain is connected to a 3.3V power supply through a resistor R2, and the switch tube Q1, the gate of the switch tube Q1 is connected to the drain of the switch tube Q2, the source of the switch tube Q1 is grounded, the drain is connected to the negative electrode of the indication module, and the positive electrode of the indication module is connected to the 3.3V power supply.

[0007] The present invention is further improved in that the indication module includes an indicator light LED1 and a resistor R1 connected in series.

[0008] The present invention is further improved in that the amplification module includes more than two stages of amplification units connected in series.

[0009] The present invention is further improved, the amplification module includes a primary amplification unit and a secondary amplification unit arranged at the output end of the primary amplification unit, the primary amplification unit includes an operational amplifier U1, the non-phase input pin 3 of the operational amplifier U1 is connected to the voltage input end of the current detection module, the inverting input pin 4 of the operational amplifier U1 is connected to the voltage output end of the current detection module, the pin 5 of the operational amplifier U1 is connected to the mainboard output power supply, the pin 2 is grounded, and the pin 1 is the output pin.

[0010] The present invention is further improved, the secondary amplification unit includes an operational amplifier U2, the operational amplifier U2 includes an operational amplifier unit U2A, a back-end comparator U2B and peripheral resistor and capacitor components, wherein:

[0011] The inverting input pin 2 of the operational amplifier unit U2A is respectively connected to the grounding resistor R5 and one end of the resistor R4, the other end of the resistor R4 is connected to the output pin 1 of the operational amplifier unit U2A, the non-inverting input pin 3 of the operational amplifier unit U2A is respectively connected to the grounding capacitors C2 and C3, the grounding resistor R8 and the output end of the first-stage amplifier unit, the power pin 8 is connected to the mainboard output power supply, and the pin 4 is grounded;

[0012] The inverting input pin 6 of the back-end comparator U2B is connected to the output pin 1 of the operational amplifier unit U2A, the non-inverting input pin 5 of the back-end comparator U2B is connected to the reference voltage and grounded through the parallel capacitors C4 and C5, and the pin 7 of the back-end comparator U2B is the output pin.

[0013] The present invention is further improved in that the reference voltage is 0.6V.

[0014] The present invention is further improved in that the current detection module adopts a precision resistor R3 with a resistance of 50mΩ.

[0015] Compared with the prior art, the beneficial effects of the present invention are: through the reasonable construction of the peripheral hardware circuit, the function of whether the USB device is connected to the host is well realized, and the circuit is stable and reliable; the amplification multiples of the two-stage operational amplifier are reasonably distributed, which well realizes the normal detection function when the low-current device is connected. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a structural block diagram of the present invention;

[0017] Figure 2 This is a circuit diagram of an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0019] like Figure 1As shown, the present invention includes a current detection module, an amplification module, a switch control module and an indication module, wherein the current detection module is used to detect the current between the mainboard output power supply and the USB interface power supply, the output end of the current detection module is connected to the input end of the amplification module, the output end of the amplification module is connected to the control end of the switch control module, the switch control module controls the switch of the indication module, and the detection pin of the mainboard is connected to the input end of the amplification module.

[0020] The amplification module of this example includes a primary amplification unit and a secondary amplification unit arranged at the output end of the primary amplification unit. It is used to amplify the detected current, adopts the amplification multiple of the two-stage operational amplifier, and reasonably distributes it, so as to well realize the normal detection function when the low current device is connected, so as to be suitable for the normal detection of various small currents.

[0021] The present invention realizes the function of whether the USB device is connected to the host computer through the reasonable construction of the peripheral hardware circuit.

[0022] like Figure 2 As shown, the switch control module of this example is a two-stage control switch. The two-stage control module includes a switch tube Q2 and a switch tube Q1, the gate of the switch tube Q2 is connected to the output end of the amplifier module, the source of the switch tube Q2 is grounded, and the drain is connected to the 3.3V power supply through the resistor R2, and the switch tube Q1, the gate of the switch tube Q1 is connected to the drain of the switch tube Q2, the source of the switch tube Q1 is grounded, and the drain is connected to the negative electrode of the indication module, and the positive electrode of the indication module is connected to the 3.3V power supply.

[0023] The indicator module of this example includes an indicator LED1 and a resistor R1 connected in series. The reserved resistor R1 can adjust the brightness of the LED according to the needs of the user by adjusting its resistance. The indicator light of this example can also use other sound, light, and electrical indicator modules, such as a sound module.

[0024] like Figure 2 As shown, the first-stage amplification unit of this example includes an operational amplifier U1, a non-inverting input pin 3 of the operational amplifier U1 is connected to the voltage input end of the current detection module, an inverting input pin 4 of the operational amplifier U1 is connected to the voltage output end of the current detection module, a pin 5 of the operational amplifier U1 is connected to the mainboard output power supply, a pin 2 is grounded, and a pin 1 is an output pin.

[0025] The present invention is further improved, the secondary amplification unit includes an operational amplifier U2, the operational amplifier U2 includes an operational amplifier unit U2A, a back-end comparator U2B and peripheral resistor and capacitor components, wherein:

[0026] The inverting input pin 2 of the operational amplifier unit U2A is respectively connected to the grounding resistor R5 and one end of the resistor R4, the other end of the resistor R4 is connected to the output pin 1 of the operational amplifier unit U2A, the non-inverting input pin 3 of the operational amplifier unit U2A is respectively connected to the grounding capacitors C2 and C3, the grounding resistor R8 and the output end of the first-stage amplifier unit, the power pin 8 is connected to the mainboard output power supply, and the pin 4 is grounded;

[0027] The inverting input pin 6 of the back-end comparator U2B is connected to the output pin 1 of the operational amplifier unit U2A, the non-inverting input pin 5 of the back-end comparator U2B is connected to the reference voltage and grounded through the parallel capacitors C4 and C5, and the pin 7 of the back-end comparator U2B is the output pin.

[0028] This example works like this:

[0029] The present invention is composed of a pure hardware control circuit. The current detection resistor R3 in the hardware control unit circuit is connected in series between the mainboard power output terminal and the USB interface power supply. When current flows through the resistor R3, the operational amplifier U1 detects the voltage across the resistor R3, and amplifies the voltage signal as the in-phase input terminal of the rear-end second-stage amplifier circuit. After the second-stage amplification, the output signal is used as the inverting input terminal of the rear-end comparator. After comparison with the reference voltage +0P6V_REF, a high or low control signal is output to the gate of the switch tube Q2 to control the opening and closing of the switch tube Q2, and finally the on and off of the switch tube Q1 is controlled to realize the lighting of LED1, indicating whether a USB device is inserted.

[0030] This control circuit realizes two states: when the USB device is inserted, the indicator LED1 is on; when the USB device is unplugged, the indicator LED1 is off. The principle is described in detail below.

[0031] like Figure 2 In the circuit shown, power supply +V5P0A_USB_P1 is the power supply source end of the motherboard to the USB port, and power supply +V5P0A_USB_CN1 is the device end of the USB port. When a USB device is inserted into the host, the host needs to provide current to the USB device, that is, current will flow through resistor R3. The voltage detected by operational amplifier U1 is R3*the current provided by the host to the USB device. Here, the amplification factor is set to 100 times, so the voltage value output by the operational amplifier is 100*R3*the current provided by the host to the USB device. In this example, resistor R4 is set to 10 times of R5, so the second-stage amplification factor is 11 times; finally, the voltage signal collected by operational amplifier U2 is amplified by 100*11=1100 times.

[0032] The reference voltage of the back-end comparator in this example is 0.6V, so the resistor R3 uses a precision resistor with a resistance of 50mΩ. To make the back-end indicator LED1 light up normally when the USB device is inserted, the operational amplifier needs to output a voltage value greater than 0.6V. By reverse calculation, it can be obtained that the current value flowing through the resistor R2 at this time needs to be greater than 11mA. The actual USB devices with low power consumption, such as mice and keyboards, also require a current greater than this value, so this reference voltage can meet actual needs.

[0033] On the other hand, the resistance value of resistor R3 should not be too large. In this example, the resistance value is 50mΩ, and the 1206 package resistor is based on the following principles. First, to meet the maximum current of 1.5 amperes required by the back-end device, the device works normally, so its voltage drop cannot exceed 0.25V, that is, I*R<0.25V, and reverse deduction can get R<166.7mΩ; at this time, if the commonly used 100mΩ resistor is selected, then when the back-end load current is the largest, its power loss I2R=0.225; at this time, it is necessary to select a resistor with a power greater than this value. The corresponding package should be 1206 at the minimum. The power corresponding to this resistor is 0.25W. If this resistor is selected, the power margin left is small. If a larger resistor is selected, the motherboard space is not enough. Therefore, a precision resistor with a resistance value of 50mΩ is selected here. On the one hand, it meets the actual requirements. On the other hand, the smaller the resistance value, the higher the accuracy of the op amp detection, which meets the initial design requirements.

[0034] In the case of only two-stage amplification and relatively accurate amplification, the first stage op amp amplifies 100 times, the second stage op amp amplifies 11 times, and the total amplification is 1100 times. Here, the current collected by the source end is set to the minimum value of 11mA, the resistance is R, and the unit is Ω. Then the voltage value input to the 6th pin of U2 is 1100*0.011A*R=12.1R, and the unit is V. Since the reference voltage of the positive input end of the back-end comparator U2B is 0.6V, the U2B input signal is required to be low level at this time, so 12.1R>0.6V is required, and R>49.6mΩ is obtained by calculation. Therefore, through the above analysis and the standard resistance value, a 50mΩ precision resistor is selected as the detection resistor.

[0035] Similarly, if the above conditions are met, the number of amplification stages can be increased and resistors of other resistance values ​​can be selected through theoretical calculations. However, adding one stage of amplification will increase the corresponding product cost.

[0036] In this example, the output level of the operational amplifier is connected to the inverting input of the back-end comparator. If it is connected to the non-inverting input, if a mechanical hard disk or a USB device that requires a large current supply is inserted into the host USB end, the voltage of the front-end operational amplifier U1 to the input of the back-end comparator will be a very large value calculated according to the above calculation formula, which will make it impossible for the motherboard to provide a suitable reference voltage because this voltage must be set very large. On the other hand, if the output signal of the operational amplifier is directly connected to the non-inverting input of the back-end comparator, although the back-end can save a level of control MOS, the signal output by the comparator is not well isolated from the output end, which may cause the MOS to open by mistake, and LED1 will be mistakenly lit.

[0037] In addition, when the customer needs to make dual indicator lights to indicate the charging status on a motherboard platform that only has a single control of the charging status, by adding the hardware control circuit of the present invention, and by reasonable cooperation with the software, it can well achieve the indication status requirements of the charging lights of different colors in the two different states of charging and full charge. For example, different colors of indicator lights can be added, and the different color display effects of the indicator light LED1 can be controlled by software. The circuit is stable and reliable, and has a wide range of applications.

[0038] The specific implementation modes described above are preferred implementation modes of the present invention, and are not intended to limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to the specific implementation modes, and all equivalent changes made according to the present invention are within the protection scope of the present invention.

Claims

1. A hardware-controlled USB device detection circuit, characterized in that: It includes a current detection module, an amplification module, a switch control module and an indication module, wherein the current detection module is used to detect the current between the mainboard output power supply and the USB interface power supply, the output end of the current detection module is connected to the input end of the amplification module, the output end of the amplification module is connected to the control end of the switch control module, the switch control module controls the switch of the indication module, and the detection pin of the mainboard is connected to the input end of the amplification module. The switch control module is a two-stage control switch; the amplification module includes more than two stages of amplification units connected in series, the amplification module includes a primary amplification unit and a secondary amplification unit arranged at the output end of the primary amplification unit, the primary amplification unit includes an operational amplifier U1, the non-phase input pin 3 of the operational amplifier U1 is connected to the voltage input end of the current detection module, the inverting input pin 4 of the operational amplifier U1 is connected to the voltage output end of the current detection module, the pin 5 of the operational amplifier U1 is connected to the mainboard output power supply, the pin 2 is grounded, and the pin 1 is the output pin.

2. The hardware-controlled USB device detection circuit according to claim 1, wherein: The two-stage control switch includes a switch tube Q2 and a switch tube Q1, the gate of the switch tube Q2 is connected to the output end of the amplifier module, the source of the switch tube Q2 is grounded, and the drain is connected to a 3.3V power supply through a resistor R2, and the switch tube Q1, the gate of the switch tube Q1 is connected to the drain of the switch tube Q2, the source of the switch tube Q1 is grounded, the drain is connected to the negative electrode of the indication module, and the positive electrode of the indication module is connected to the 3.3V power supply.

3. The hardware-controlled USB device detection circuit according to claim 2, wherein: The indication module comprises an indicator light LED1 and a resistor R1 connected in series.

4. The hardware-controlled USB device detection circuit according to any one of claims 1 to 3, characterized in that: The secondary amplification unit includes an operational amplifier U2, and the operational amplifier U2 includes an operational amplifier unit U2A, a back-end comparator U2B and peripheral resistors and capacitors, wherein: The inverting input pin 2 of the operational amplifier unit U2A is respectively connected to the grounding resistor R5 and one end of the resistor R4, the other end of the resistor R4 is connected to the output pin 1 of the operational amplifier unit U2A, the non-inverting input pin 3 of the operational amplifier unit U2A is respectively connected to the grounding capacitors C2 and C3, the grounding resistor R8 and the output end of the first-stage amplifier unit, the power pin 8 is connected to the mainboard output power supply, and the pin 4 is grounded; The inverting input pin 6 of the back-end comparator U2B is connected to the output pin 1 of the operational amplifier unit U2A, the non-inverting input pin 5 of the back-end comparator U2B is connected to the reference voltage and grounded through the parallel capacitors C4 and C5, and the pin 7 of the back-end comparator U2B is the output pin.

5. The hardware-controlled USB device detection circuit according to claim 4, characterized in that: The reference voltage is 0.6V.

6. The hardware-controlled USB device detection circuit according to claim 5, characterized in that: The current detection module uses a precision resistor R3 with a resistance of 50mΩ.

Citation Information

Patent Citations

  • Hardware-controlled USB device detection circuit

    CN212275839U