USB device identification circuit, USB device identification method, and electronic device

By monitoring the change in the power pin level of the USB port, the control unit, the current limiting unit, the voltage divider unit and the voltage regulator are used to realize the master-slave identity identification of the USB device, which solves the problem of relying on D+ and D-lead recognition in the prior art, and improves the accuracy and security of the identification.

WO2025139874A1PCT designated stage expired Publication Date: 2025-07-03HYTERA COMM CORP
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/139560
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-26
Filing Date
2024-12-16
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

In the prior art, when an electronic device recognizes the master and slave identity of a connected device through a USB port, it usually relies on the communication direction of D+ and D-leads, and there is difficulty in identifying, which may lead to damage to the device or communication failure.

Method used

By monitoring the change in the power pin level of the USB port, the control unit, current limiting unit, voltage divider unit and voltage regulator are used to realize the master-slave identity identification of the USB device, and the detection and enumeration of the master-slave device are carried out in different ways.

Benefits of technology

The USB device identification process is simplified, the accuracy and security of identification are improved, the device is damaged, and the normal establishment of communication connections is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024139560_03072025_PF_FP_ABST
    Figure CN2024139560_03072025_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a USB device identification circuit, a USB device identification method, and an electronic device. The USB device identification circuit comprises: a control unit, wherein a first port of the control unit is connected to a power pin of a USB port of the USB device identification circuit; a current limiting unit, wherein a first end of the current limiting unit is used for inputting a first voltage signal, and a second end of the current limiting unit is connected to the power pin; a voltage dividing unit, wherein a first end of the voltage dividing unit is connected to the power pin, and a second end of the voltage dividing unit is connected to a second port of the control unit; and a voltage regulator, wherein a first end of the voltage regulator is connected to the power pin, and a control end of the voltage regulator is connected to a third port of the control unit.
Need to check novelty before this filing date? Find Prior Art

Description

USB device identification circuit, identification method and electronic device

[0001] This application claims priority to Chinese patent application number 202311817253.3, filed on December 26, 2023, entitled “USB device identification circuit, identification method and electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of communications, more specifically to the field of wired communications, and in particular to a USB device identification circuit, a USB device identification method, and an electronic device. Background Art

[0003] Electronic devices can communicate with each other using the USB (Universal Serial Bus) protocol. Electronic devices can also receive or provide power through their own USB ports. USB communication is a serial, polling mechanism.

[0004] For an electronic device with a USB port (referred to as electronic device A), when another electronic device with USB communication functionality (referred to as electronic device B) is plugged into electronic device A's USB port, electronic device A must be able to detect that electronic device B is connected (plugged) into its own USB port and correctly identify whether electronic device B is a slave or master device. This is necessary to establish a communication connection between electronic devices A and B. If electronic device A cannot detect that another electronic device is connected to its own USB port, or cannot correctly identify the master / slave status of the other electronic device plugged into its own USB port, communication between electronic devices A and B cannot be established via the USB protocol. Furthermore, if electronic device A cannot correctly identify the master / slave status of electronic device B, it may cause electronic device A to mistakenly trigger slave mode, causing electronic device A to continuously supply power to its own USB port, potentially damaging at least one of electronic devices B or A.

[0005] Therefore, electronic devices with USB communication capabilities typically require connection (plug-in) detection and master / slave identification for their USB ports (with the exception of a PC (Personal Computer) using a Type-A USB port, where the PC is the master device by default). There are many types of USB ports, one of which is the Type-A. Type-A USB ports only have four leads: VBUS, D+, D-, and GND. Technically, master / slave identification for electronic devices connected to these ports is difficult. In the industry, master / slave identification is typically performed based on the communication direction of the D+ and D- leads. Summary of the Invention

[0006] The purpose of the embodiments of the present application is to provide a USB device identification circuit, a USB device identification method and an electronic device, which can identify the master and slave identities of electronic devices connected to the USB port on the electronic device, and the identification method is different from the identification method commonly used in the industry to perform master-slave identification based on the communication direction of the D+ and D- leads.

[0007] A first aspect of an embodiment of the present application provides a USB device identification circuit, including:

[0008] a control unit, wherein a first port of the control unit is connected to a power pin of a USB port of the USB device identification circuit;

[0009] a current limiting unit, wherein a first end of the current limiting unit is used to input a first voltage signal, and a second end of the current limiting unit is connected to the power pin;

[0010] a voltage dividing unit, wherein a first end of the voltage dividing unit is connected to the power pin, and a second end of the voltage dividing unit is connected to the second port of the control unit;

[0011] A voltage regulator, wherein a first end of the voltage regulator is connected to the power pin, and a control end of the voltage regulator is connected to the third port of the control unit.

[0012] A second aspect of the embodiments of the present application provides an electronic device, which includes the USB device identification circuit described in the first aspect.

[0013] A third aspect of the present application provides a USB device identification method, which is applied to the USB device identification circuit described in the first aspect or the electronic device described in the second aspect. The method includes:

[0014] When the control unit detects that the level on the power pin is pulled low in the first monitoring mode, it controls the voltage regulator to start working;

[0015] The control unit switches to a master device mode and enumerates the USB devices;

[0016] If the enumeration is successful, the control unit determines that the USB device is a slave device;

[0017] The first monitoring mode is that the control unit monitors the change of the level on the power pin through the first port.

[0018] In an embodiment of the present application, a USB device identification circuit can detect changes in the power level of a USB port's power pin and, based on these changes, identify the USB device connected to the USB port as a master or slave. This circuit is relatively simple to implement and provides a novel, differentiating approach from the commonly used industry practice of identifying a master or slave based on the communication direction of the D+ and D- lines. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] FIG1 is a schematic structural diagram of a USB device identification circuit provided in an embodiment of the present application;

[0020] FIG2 is a schematic structural diagram of a USB device identification circuit provided in an embodiment of the present application;

[0021] FIG3 is a schematic structural diagram of a USB device identification circuit provided in an embodiment of the present application;

[0022] FIG4 is a schematic structural diagram of a USB device identification circuit provided in an embodiment of the present application;

[0023] FIG5 is a flow chart of a USB device identification method provided in an embodiment of the present application;

[0024] FIG6 is a schematic diagram of an application scenario of a USB device identification circuit provided in an embodiment of the present application;

[0025] FIG7 is a schematic diagram of the level change on the VBUS pin in the USB port 13 in the application scenario shown in FIG6 ;

[0026] FIG8 is a flowchart of a USB device identification method provided in an embodiment of the present application;

[0027] FIG9 is a flowchart of a USB device identification method provided in an embodiment of the present application;

[0028] FIG10 is a flowchart of a USB device identification method provided in an embodiment of the present application;

[0029] FIG11 is a flowchart of a USB device identification method provided in an embodiment of the present application;

[0030] FIG12 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.

[0032] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.

[0033] The embodiments of the present application provide a USB device identification circuit, a USB device identification method, and an electronic device, which are described below with reference to the accompanying drawings.

[0034] The present invention provides a USB device identification circuit. FIG1 is a schematic diagram of the structure of a USB device identification circuit according to an embodiment of the present invention. The USB device identification circuit 10 includes a control unit 11, a current limiting unit 14, a voltage divider 15, and a voltage regulator 12.

[0035] Optionally, the control unit 11 may be the main MCU (Microcontroller Unit) shown in FIG1 , or may be another type of chip. A first port of the control unit 11 (e.g., the INT port of the main MCU shown in FIG1 ) is connected to a power pin of the USB port 13 (e.g., the VBUS pin of the USB port 13 shown in FIG1 ), a second port of the control unit 11 (e.g., the ADC port of the main MCU shown in FIG1 ) is connected to a second end of the voltage divider unit 15 (e.g., the end of the resistor R2 connected to the third resistor R3 shown in FIG1 ), and a third port of the control unit 11 (e.g., the GPIO port of the main MCU shown in FIG1 ) is connected to a control end of the voltage regulator 12 (e.g., the EN pin of the voltage regulator 12 shown in FIG1 ).

[0036] The first end of the current limiting unit 14 is used to input a first voltage signal V1. Optionally, the first voltage signal V1 is constant at 3.3V (volts). The second end of the current limiting unit 14 is connected to the power pin VBUS of the USB port 13. Exemplarily, the current limiting unit 14 includes the first resistor R1 shown in FIG1 , the first end of the first resistor R1 is used to input the first voltage signal V1, and the second end of the first resistor R1 is connected to the power pin VBUS of the USB port 13. Of course, the current limiting unit 14 is not limited to the embodiment shown in FIG1 , and can also be other embodiments. For example, the current limiting unit 14 can be composed of a variable resistor with a variable resistance, or can be composed of a plurality of fixed resistors with fixed resistances connected in series or in parallel, or can be other current limiting elements.

[0037] The first end of the voltage divider unit 15 is connected to the power pin VBUS of the USB port 13, the second end of the voltage divider unit 15 is connected to the second port of the control unit 11, and the third end of the voltage divider unit 15 is coupled to the ground. Exemplarily, the voltage divider unit 15 includes the second resistor R2 and the third resistor R3 shown in FIG1 , wherein the first end of the second resistor R2 is connected to the power pin VBUS of the USB port 13, the second end of the second resistor R2 is connected to the first end of the third resistor R3, and the second end of the third resistor R3 is coupled to the ground. Of course, the voltage divider unit 15 is not limited to the embodiment shown in FIG1 , and may also be other embodiments. For example, the second resistor R2 may be a variable resistor, or may be a plurality of fixed resistors connected in series or in parallel with a total resistance of R2, or may be other voltage divider elements.

[0038] The first end of the voltage regulator 12 is used to input the second voltage signal V2. Optionally, the second voltage signal V2 is constant at 12V. The second end of the voltage regulator 12 is connected to the power pin VBUS of the USB port 13. In the default state, the voltage regulator 12 remains in the off state; it is turned on in response to receiving the start signal sent by the control unit 11, and converts the second voltage signal V2 into a third voltage signal V3 and outputs it to the power pin VBUS of the USB port 13 through the second end; it is turned off in response to receiving the shutdown signal sent by the control unit 11. In some optional embodiments, the voltage regulator 12 can be a DC-DC converter. In other optional embodiments, the voltage regulator 12 can be an LDO (low dropout regulator) regulator. Of course, in some other optional embodiments, the voltage regulator 12 can also be implemented based on other voltage transformation and voltage regulation principles. Those skilled in the art can flexibly choose based on their needs, and will not be elaborated here.

[0039] A second pin of the USB port 13 (eg, a GND pin of the USB port 13 shown in FIG. 1 ) is coupled to ground.

[0040] As shown in Figure 2, Figure 2 is a schematic diagram of the structure of a USB device identification circuit provided in an embodiment of the present application. This USB device identification circuit 20 differs primarily from the USB device identification circuit 10 shown in Figure 1 in that it further includes a first diode D1. The first end (i.e., the positive end) of the first diode D1 is connected to the first port of the control unit 11, and the first end (i.e., the negative end) of the first diode D1 is connected to the power pin VBUS of the USB port 13.

[0041] As shown in Figure 3, a schematic diagram of the structure of a USB device identification circuit provided in an embodiment of the present application is shown. This USB device identification circuit 30 differs primarily from the USB device identification circuit 10 shown in Figure 1 in that it further includes a second diode D2. The first end (i.e., the positive end) of the second diode D2 is connected to the second end of the voltage regulator 12, and the second end (i.e., the negative end) of the second diode D2 is connected to the power pin VBUS of the USB port 13 (i.e., connected to the first end of the second resistor R2).

[0042] The first diode D1 and the second diode D2 can, to a certain extent, prevent the current from flowing back and burning out the control unit 11 and the voltage regulator 12 when the power pin VBUS on the USB port 13 in the USB device identification circuit is reversely connected, thereby protecting the safety of the USB device identification circuit.

[0043] FIG4 is a schematic diagram of the structure of a USB device identification circuit provided in an embodiment of the present application. This USB device identification circuit 40 differs primarily from the USB device identification circuit 10 shown in FIG1 in that it further includes a first diode D1 and a second diode D2. For a description of the first diode D1 and the second diode D2, please refer to the description of the embodiments shown in FIG2 and FIG3 , and will not be repeated here.

[0044] An embodiment of the present application provides an electronic device, which includes any one of the aforementioned USB device identification circuits.

[0045] An embodiment of the present application provides a USB device identification method, which is applied to the aforementioned USB device identification circuit or electronic device, and is used to detect whether another electronic device is connected (plugged in) to the USB port 13, and when an electronic device is detected to be connected to the USB port 13, identify the master and slave identities of the electronic device connected to the USB port 13. As shown in Figure 5, Figure 5 is a flow chart of a USB device identification method provided by an embodiment of the present application. The USB device identification method is described below in conjunction with Figures 1 and 5. The USB device identification method includes the following steps:

[0046] S101: When the control unit 11 detects that the voltage level on the power pin VBUS is pulled low in a first monitoring mode, it controls the voltage regulator 12 to start operating. The first monitoring mode involves the control unit 11 monitoring a voltage level change on the power pin VBUS of the USB port 13 (e.g., the VBUS pin of the USB port 13 shown in FIG1 ) via a first port (e.g., the INT port of the main MCU shown in FIG1 ).

[0047] S102, the control unit 11 switches to the master device mode and enumerates the USB device; if the enumeration is successful, execute step S103.

[0048] S103: The control unit 11 determines that the USB device is a slave device.

[0049] It should be noted that, by default, the control unit 11 monitors the voltage level changes on the power pin VBUS of the USB port 13 through the first port. Furthermore, by default, the voltage regulator 12 remains off, meaning it is inoperative and does not convert the second voltage signal V2 into the third voltage signal V3 for output. Therefore, by default, the voltage level on the power pin VBUS of the USB port 13 is equal to the voltage of the first voltage signal V1. For example, V1 = 3.3V.

[0050] After other electronic devices are connected to the USB port 13, the VBUS pin of the other electronic device will be connected to the power pin VBUS of the USB port 13, and the GND pin of the other electronic device will be connected to the second pin of the USB port 13. If the electronic device connected to the USB port 13 is a slave device, it will generally pull the voltage level on the VBUS pin of the USB port 13 down from the first voltage signal V1 (e.g., 3.3V). The control unit 11 can detect this change in the voltage level on the VBUS pin of the USB port 13 from the first voltage signal V1 (e.g., 3.3V) from its own first port (e.g., the INT port), and therefore can preliminarily assume that the USB device connected to the USB port 13 is a slave device.

[0051] The control unit 11 sends an activation command to the voltage regulator 12 via the third port to activate the voltage regulator 12. In response to receiving the activation command, the voltage regulator 12 activates, converts the second voltage signal (e.g., 12V) into a third voltage signal V3, and outputs the third voltage signal V3 to the power pin VBUS of the USB port 13 to power the device plugged into the USB port 13. The main MCU then performs USB enumeration on the USB device connected to the USB port 13 in master device mode.

[0052] USB enumeration is part of the USB communication protocol. For details, see the USB Communication Protocol and will not be discussed here. It should be noted that USB enumeration can only be initiated by the master device. Slave devices passively wait to be enumerated.

[0053] If the enumeration is successful, it is determined that the USB device connected to the USB port 13 is a slave device.

[0054] The following describes S101 using an exemplary application of the USB device identification circuit shown in FIG1 . As shown in FIG6 , FIG6 is a schematic diagram of an application scenario of a USB device identification circuit provided by an embodiment of the present application. After the USB flash drive 50 is connected (plugged in) to the USB port 13, the VBUS pin of the USB flash drive 50 will be connected to the power pin VBUS of the USB port 13, and the GND pin of the USB flash drive 50 will be connected to the second pin of the USB port 13. The USB flash drive 50 also includes a capacitor C connected between the VBUS pin of the USB flash drive 50 and the GND pin of the USB flash drive 50, as well as a Flash memory and a Controller controller connected to the VBUS pin of the USB flash drive 50.

[0055] FIG7 illustrates the voltage change on the power pin VBUS of USB port 13 in the scenario shown in FIG6 . Line 71 in FIG7 reflects the voltage change on the power pin VBUS of USB port 13, and line 72 is a reference for the rollover test. Referring to FIG6 and FIG7 , the USB device identification circuit 10 defaults to the first monitoring mode. The default voltage level on the power pin VBUS of USB port 13 is V1. The moment a USB flash drive 50 is inserted into USB port 13 (i.e., time t1 shown in FIG7 ), capacitor C of USB flash drive 50 begins charging, causing the voltage level on the power pin VBUS of USB port 13 to drop momentarily. The INT port of the master MCU detects this voltage change on the power pin VBUS of USB port 13. Upon detecting this voltage change, the master MCU preliminarily confirms that the USB flash drive 50 inserted into USB port 13 is a slave device.

[0056] In some optional implementations, as shown in FIG8 , FIG8 is a flowchart of a USB device identification method provided in an embodiment of the present application. The main difference between the USB device identification method provided in the embodiment of FIG8 and the USB device identification method provided in the embodiment of FIG5 is that the method further includes the following steps:

[0057] S104, after the enumeration is successful, the control unit 11 periodically performs enumeration or reading operations on the USB device. When the enumeration or reading fails, it is determined that the USB device has been unplugged and the voltage regulator 12 is controlled to stop working.

[0058] After further determining through enumeration that the device plugged into USB port 13 is a slave device, control unit 11 (e.g., the master MCU in the example of FIG1 ) can communicate with the slave device. Control unit 11 periodically enumerates or reads the slave device to determine the connection status between the slave device and USB port 13. If enumeration or reading fails, it is determined that the USB device connected to USB port 13 has been unplugged. The master MCU then switches to the first monitoring mode to monitor the voltage level on the USB port's power pin, VBUS, and controls voltage regulator 12 to cease operation.

[0059] In some optional implementations, as shown in FIG9 , FIG9 is a flowchart of a USB device identification method provided in an embodiment of the present application. The main difference between the USB device identification method provided in the embodiment of FIG9 and the USB device identification method provided in the embodiment of FIG5 is that the method further includes the following steps:

[0060] S105, when the control unit 11 detects that the level on the power pin VBUS is pulled high in the first monitoring mode, it switches to monitoring the level on the power pin VBUS through the second monitoring mode; the second monitoring mode is that the control unit 11 monitors the change of the level on the power pin VBUS of the USB port 13 through the second port (for example, the ADC port of the main MCU shown in Figure 1).

[0061] When the main MCU detects that the level on the power pin VBUS of the USB port 13 is pulled up from the first voltage signal V1 (for example, 3.3V), it switches to continue monitoring the level change on the power pin VBUS of the USB port 13 through the second port (for example, the ADC port).

[0062] S106: When the control unit 11 detects that the voltage level on the power pin VBUS is greater than a first threshold value in the second monitoring mode, the control unit 11 switches to the slave mode and executes step S107 if the USB device enumeration succeeds. If the USB device enumeration fails, the control unit 11 executes step S108.

[0063] The first threshold can be flexibly set according to needs, and is usually set to 4V, but can also be set to 5V or other values ​​according to actual needs.

[0064] When the master MCU detects through the second port (eg, ADC port) that the level on the power pin VBUS of the USB port 13 is greater than a first threshold (eg, 4V), the master MCU switches to slave mode and waits for USB enumeration.

[0065] S107: The control unit 11 determines that the USB device is a master device.

[0066] When the USB device plugged into the USB port 13 successfully enumerates the master MCU (ie, the master MCU detects that it has been successfully enumerated), it is determined that the USB device connected to the USB port 13 is the master device. For example, the master device may be a PC.

[0067] S108 , the control unit 11 controls the voltage stabilizer 12 to start working.

[0068] S109: The control unit 11 switches to the master device mode and enumerates the USB devices.

[0069] S110: If the enumeration is successful, the control unit 11 determines that the USB device is a slave device.

[0070] Optionally, the slave device may be a USB HUB.

[0071] For steps S108-S110, reference may be made to the related descriptions of steps S101-S103, which will not be repeated here.

[0072] In some optional implementations, as shown in FIG10 , FIG10 is a flowchart of a USB device identification method provided in an embodiment of the present application. The main difference between the USB device identification method provided in the embodiment of FIG10 and the USB device identification method provided in the embodiment of FIG9 is that the method further includes the following steps:

[0073] If the enumeration fails in step S012 or S109, execute S111.

[0074] S111, the control unit 11 determines that the USB device is an invalid device and controls the voltage regulator 12 to stop working;

[0075] S112 , the control unit 11 switches to the first monitoring mode and continues to monitor the voltage level on the power pin VBUS.

[0076] If enumeration fails, the USB device connected to USB port 13 is determined to be an invalid device, and the main MCU switches to the first monitoring mode to monitor the voltage level on the power pin VBUS of USB port 13. That is, the main MCU continues to detect the voltage level on USB port 13 through the INT port and sends a shutdown signal to the voltage regulator 12 to shut down the voltage regulator 12 and stop supplying power to the power pin VBUS of USB port 13. The main MCU switches to the first monitoring mode and continues to monitor the voltage level on the power pin VBUS of USB port 13.

[0077] In some optional implementations, as shown in FIG11 , FIG11 is a flowchart of a USB device identification method provided in an embodiment of the present application. The main difference between the USB device identification method provided in the embodiment of FIG11 and the USB device identification method provided in the embodiment of FIG9 is that the method further includes the following steps:

[0078] S113 , when the control unit 11 detects in the second monitoring mode that the voltage level on the power pin VBUS of the USB port 13 is not greater than a first threshold, it determines that the USB device has been unplugged.

[0079] After further determining through enumeration whether the device plugged into USB port 13 is a master device or a slave device (of the USB hub type), control unit 11 (e.g., the main MCU in the example of FIG1 ) can communicate with the master device or slave device (of the USB hub type). Control unit 11 continuously monitors the voltage level on power pin VBUS of USB port 13 via a second port (e.g., an ADC port). If, through the second monitoring mode, the voltage level on power pin VBUS of USB port 13 is subsequently determined to be no greater than a first threshold (e.g., 4V), control unit 11 determines that the USB device connected to USB port 13 has been ejected from USB port 13.

[0080] When the control unit 11 detects in the second monitoring mode that the level on the power pin VBUS of the USB port 13 is not greater than the first threshold, it determines that the USB device connected to the USB port 13 is an invalid device, and switches to the first monitoring mode to monitor the level on the power pin VBUS of the USB port 13.

[0081] Upon detecting that the voltage level on the power pin VBUS of the USB port 13 has been pulled higher than the first voltage signal V1 (e.g., 3.3V), the main MCU switches to continuing to monitor the voltage level changes on the power pin VBUS of the USB port 13 through the second port (e.g., the ADC port). However, if the control unit 11 detects that the voltage level on the power pin VBUS of the USB port 13 is not greater than the first threshold value in the second monitoring mode, the control unit 11 determines that the USB device connected to the USB port 13 is an invalid device and switches to the first monitoring mode to continue monitoring the voltage level on the power pin VBUS of the USB port 13.

[0082] In some optional implementations, those skilled in the art may flexibly combine the USB device identification methods described in Figures 5 to 12 , for example, combining the implementation shown in Figure 10 with the implementation shown in Figure 11 , and the resulting implementations are also within the scope of protection of this application. For relevant descriptions, please refer to the above and will not be repeated here.

[0083] In an embodiment of the present application, a USB device identification circuit can detect changes in the voltage level on the power pin VBUS of the USB port and use this voltage level change to identify the master and slave devices connected to the USB port. This is a relatively simple implementation and provides a novel and differentiating method from the commonly used industry method of identifying master and slave devices based on the communication direction of the D+ and D- pins.

[0084] FIG12 is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.

[0085] The electronic device 140 includes, but is not limited to, components such as a radio frequency unit 141, a network module 142, an audio output unit 143, an input unit 144, a sensor 145, a display unit 146, a user input unit 147, an interface unit 148, a memory 149, and a processor 1410. Those skilled in the art will appreciate that the electronic device 140 may also include a power supply (e.g., a battery) to power the various components. The power supply may be logically connected to the processor 1410 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The electronic device structure shown in FIG15 does not limit the electronic device. The electronic device may include more or fewer components than shown, or may combine certain components or arrange the components differently, which will not be further described here.

[0086] The processor 1410 includes the aforementioned control unit 11, which is configured to:

[0087] In the first monitoring mode, when the level on the power pin is detected to be pulled low, the control regulator starts to work;

[0088] Switch to master device mode and enumerate the USB device;

[0089] If the enumeration is successful, determining that the USB device is a slave device;

[0090] The first monitoring mode is that the control unit monitors the change of the level on the power pin through the first port.

[0091] It should be understood that, in the embodiment of the present application, the network module 142 may include any one of the USB device identification circuits in FIG. 1 to FIG. 4 .

[0092] The input unit 144 may include a graphics processing unit (GPU) 1441 and a microphone 1442. The GPU 1441 processes image data of still images or videos captured by an image capture device (e.g., a camera) in video capture mode or image capture mode. The display unit 146 may include a display panel 1461, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 147 includes a touch panel 1471 and at least one of other input devices 1472. The touch panel 1471, also known as a touch screen, may include a touch detection device and a touch controller. Other input devices 1472 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on / off keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.

[0093] Memory 149 can be used to store software programs and various data. Memory 149 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store an operating system, applications or instructions required for at least one function (such as sound playback or image playback), and the like. Furthermore, memory 149 may include volatile memory or non-volatile memory, or both. Non-volatile memory may include read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 149 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memory.

[0094] Processor 1410 may include one or more processing units. Optionally, processor 1410 integrates an application processor and a modem processor. The application processor primarily handles operations related to the operating system, user interface, and application programs, while the modem processor primarily processes wireless communication signals, such as a baseband processor. It is understood that the modem processor may not be integrated into processor 1410.

[0095] Any of the above product embodiments can implement the various processes of the above USB device identification method embodiment through its own processor operation, and can achieve the same technical effect. To avoid repetition, they will not be described one by one.

[0096] In the embodiments provided in the examples of the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0097] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of this embodiment.

[0098] In addition, each functional unit in each implementation of the embodiment of the present application may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The above-mentioned integrated units may be implemented in the form of hardware or software functional units.

[0099] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0100] The above description is only an implementation method of the embodiment of the present application, and does not limit the patent scope of the embodiment of the present application. The above specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can make equivalent structural or equivalent process changes using the description and drawings of the embodiment of the present application, or directly or indirectly apply them in other related technical fields. Without departing from the scope of protection of the purpose of this application and the claims, many forms can be made, which are also included in the patent protection scope of the embodiment of the present application.

Claims

1. A USB device identification circuit, characterized in that, Comprising: A control unit, the first port of the control unit being connected to the power supply pin of the USB port of the USB device identification circuit; A current limiting unit, the first end of the current limiting unit being used for inputting a first voltage signal, and the second end of the current limiting unit being connected to the power supply pin; A voltage dividing unit, the first end of the voltage dividing unit being connected to the power supply pin, and the second end of the voltage dividing unit being connected to the second port of the control unit; A voltage regulator, the first end of the voltage regulator being connected to the power supply pin, and the control end of the voltage regulator being connected to the third port of the control unit.

2. The USB device recognition circuit according to claim 1, wherein The current limiting unit includes: A first resistor, the first end of the first resistor being used for inputting a first voltage signal, and the second end of the electrical instrument resistor being connected to the power supply pin.

3. The USB device recognition circuit according to claim 1, wherein The voltage dividing unit includes: A second resistor, the first end of the second resistor being connected to the power supply pin, and the second end of the second resistor being connected to the second port of the control unit; A third resistor, the first end of the third resistor being connected to the second end of the second resistor, and the second end of the third resistor being coupled to the ground.

4. The USB device identification circuit according to claim 1, characterized in that, Further comprising: A first diode, the first end of the first diode being connected to the first port of the control unit, and the second end of the first diode being connected to the power supply pin.

5. The USB device identification circuit according to claim 1, wherein Further comprising: A second diode, the first end of the second diode being connected to the second end of the voltage regulator, and the second end of the second diode being connected to the first end of the voltage dividing unit.

6. An electronic device, characterized in that, Comprising the USB device identification circuit according to any one of claims 1 to 5.

7. A method for identifying a USB device, characterized in that, Applied to the USB device identification circuit according to any one of claims 1 to 5 or the electronic device according to claim 6, the method comprising: When the control unit monitors that the level on the power supply pin is pulled low in the first monitoring mode, controlling the voltage regulator to start working; The control unit switches to the master device mode and enumerates the USB device; If the enumeration is successful, the control unit determines that the USB device is a slave device; Wherein, the first monitoring mode is that the control unit monitors the change of the level on the power supply pin through the first port.

8. The USB device identification method according to claim 7, wherein The method further comprises: After the enumeration is successful, the control unit periodically enumerates or reads the USB device, and when the enumeration fails or the reading fails, determines that the USB device has been unplugged and controls the voltage regulator to stop working.

9. The USB device recognition method according to claim 7, wherein, The method further comprises: When the control unit monitors that the level on the power supply pin is pulled high in the first monitoring mode, switching to monitoring the level on the power supply pin through the second monitoring mode; the second monitoring mode is that the control unit monitors the change of the level on the power supply pin through the second port; When the control unit monitors that the level on the power supply pin is greater than a first threshold in the second monitoring mode, the control unit switches to the slave device mode and determines that the USB device is the master device when the enumeration of the USB device is successful.

10. The USB device identification method according to claim 9, characterized in that, The method further comprises: When the enumeration of the USB device fails, the control unit controls the voltage regulator to start working; The control unit switches to the master device mode and enumerates the USB device; If the enumeration is successful, the control unit determines that the USB device is a slave device.

11. The USB device identification method according to claim 7 or 10, characterized in that, The method further includes: If the enumeration fails, the control unit determines that the USB device is an invalid device and controls the voltage regulator to stop working; The control unit switches to the first monitoring mode to continue monitoring the level on the power supply pin.

12. The USB device recognition method according to claim 9, wherein, The method further includes: When the control unit monitors that the level on the power supply pin of the USB port is not greater than the first threshold in the second monitoring mode, it determines that the USB device has been unplugged.

Citation Information

Patent Citations

  • Interface identification circuit, method and device and electronic device

    CN112187252A

  • Interface circuit, electronic equipment, and insertion identification method

    CN113641609A

  • Electronic equipment, equipment identification method and charging system

    CN114967894A

  • Access identification method of electronic equipment interface and electronic equipment

    CN116049055A

  • Master-slave device detection circuit and electronic device

    CN219497051U