Device type recognition device and device type recognition method

By introducing a controller and detection circuit into the interface, and using a current detection unit and power control switch to identify the type of external device, the application limitations of traditional USB OTG function in the absence of ID pin interfaces are solved, realizing convenient USB OTG function identification and wide applicability.

CN120995444APending Publication Date: 2025-11-21SHENZHEN TOPBAND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410630111.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Traditional USB OTG functionality cannot be implemented in interfaces lacking ID pins, limiting the application of these interfaces in the USB field and causing inconvenience in use.

Method used

By introducing a controller, interface, and detection circuit into the interface, and utilizing a current detection unit and a power control switch, the type of external device is identified based on the on/off state of the detection circuit and electrical parameters, thus realizing the USB OTG function.

Benefits of technology

It can identify the interface type without detecting the ID signal, has a wide range of applications, is highly convenient to use, is suitable for a variety of interfaces, and realizes the widespread application of USB OTG function.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120995444A_ABST
    Figure CN120995444A_ABST
Patent Text Reader

Abstract

The invention relates to an equipment type identification device and an equipment type identification method, the equipment type identification device comprises a controller, an interface and a detection circuit, the interface is used for accessing external equipment and is connected with the controller and the detection circuit through different terminals, one end, far away from the interface, of the detection circuit is used for being connected with a power supply, and the control circuit is connected with the detection circuit. When different types of external devices are connected to the interface, the detection circuit has different electrical parameters in the on-off state, and the controller is used for identifying the types of the external devices according to the on-off state and the electrical parameters of the detection circuit. Therefore, the controller recognizes the type of the external equipment according to the on-off state and the electrical parameters of the detection circuit, the interface type is not limited, a line specially supporting the USB OTG function does not need to be applied, the type of the external equipment connected to the interface can be judged without detecting ID signals, the application range is wide, and use convenience is high.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, in particular to a device type identification device and a device type identification method. BACKGROUND

[0002] USB OTG is the abbreviation of USB On-The-Go, mainly applied to the connection between various devices or mobile devices for data exchange, allowing devices to communicate directly with other USB devices without a computer, which is convenient to use.

[0003] The traditional implementation method of USB OTG function needs the controller to detect the ID signal of the USB interface. When the ID signal is detected as floating or high level, the USB is used as a slave. When the ID signal is detected as low level, the USB is used as a master. In addition, the OTG function needs to be matched with a special line supporting USB OTG function.

[0004] However, in some emerging interfaces such as TYPE-C or other interfaces, there is no ID pin, so it cannot be used for USB OTG function, which greatly limits the application of such interfaces in the USB field and brings inconvenience to users. SUMMARY

[0005] Therefore, it is necessary to provide a device type identification device and a device type identification method which can help various interfaces to realize USB OTG function and improve the convenience of use.

[0006] A device type identification device includes a controller, an interface, and a detection circuit. The interface is used to access external devices and connects the controller and the detection circuit through different terminals. The end of the detection circuit away from the interface is used to connect a power supply, and the control circuit connects the detection circuit.

[0007] When the interface accesses different types of external devices, the detection circuit has different electrical parameters in the on-off state, and the controller is used to identify the type of the external device according to the on-off state and electrical parameters of the detection circuit.

[0008] In one embodiment, the detection circuit includes a current detection unit and a power supply control switch. The interface connects the power supply through the current detection unit and the power supply control switch in sequence. The common terminal of the interface and the current detection unit is used as a voltage detection point. The voltage detection point, the current detection unit, and the power supply control switch are all connected to the controller.

[0009] The controller is configured to identify the type of the external device according to the voltage of the voltage detection point, the current of the current detection unit and the on-off state of the power control switch.

[0010] In one of the embodiments,

[0011] The controller is configured to determine that the interface is not connected to an external device if the current detection unit has no current when the power control switch is open and the voltage detection point has no voltage when the power control switch is closed.

[0012] Or,

[0013] The controller is configured to determine that the external device is an active device if the current detection unit has no current when the power control switch is open and the voltage detection point has voltage when the power control switch is closed.

[0014] Or,

[0015] The controller is configured to determine that the external device is a load if the current detection unit has current when the power control switch is open and the voltage detection point has no voltage when the power control switch is closed.

[0016] In one of the embodiments, the current detection unit comprises a detection resistor, and the interface connects the power supply through the detection resistor and the power control switch in sequence.

[0017] In one of the embodiments, the power control switch comprises a control switch tube, a control end of the control switch tube is connected to the controller, a first end of the control switch tube is connected to the current detection unit, and a second end of the control switch tube is connected to the power supply.

[0018] In one of the embodiments, an amplification circuit is further included, and the controller is connected to the current detection unit through the amplification circuit.

[0019] In one of the embodiments, a voltage detection circuit is further included, and the controller is connected to the voltage detection point through the voltage detection circuit.

[0020] In one of the embodiments, the voltage detection circuit comprises a first resistor, a second resistor, a third resistor and a first switch tube.

[0021] The first resistor and the second resistor are connected in series, one end of the series connection is connected to the voltage detection point, the other end of the series connection is grounded, the common end of the first resistor and the second resistor is connected to the control end of the first switch tube, the first end of the first switch tube and the common end of the third resistor are connected to the controller, one end of the third resistor away from the first switch tube is used for connecting voltage, the second end of the first switch tube is grounded.

[0022] In one of the embodiments, a switch control circuit is further included, and the controller is connected to the power control switch through the switch control circuit.

[0023] In one of the embodiments, the switch control circuit includes a fourth resistor, a fifth resistor, a sixth resistor and a second switch tube.

[0024] The first end of the second switch tube is connected to the power control switch through the fourth resistor, the second end of the second switch tube is grounded, the control end of the second switch tube is connected to the controller through the fifth resistor, the first end of the sixth resistor is connected to the control end of the second switch tube, and the second end of the sixth resistor is grounded.

[0025] A device type identification method is implemented based on the device type identification device, and the method includes:

[0026] Obtaining the on-off state and the electrical parameter of the detection circuit;

[0027] Identifying the type of the external device according to the on-off state and the electrical parameter of the detection circuit.

[0028] In one of the embodiments, the detection circuit includes a current detection unit and a power control switch, and identifying the type of the external device according to the on-off state and the electrical parameter of the detection circuit includes:

[0029] Identifying the type of the external device according to the voltage of the voltage detection point, the current of the current detection unit and the on-off state of the power control switch.

[0030] In one of the embodiments, identifying the type of the external device according to the voltage of the voltage detection point, the current of the current detection unit and the on-off state of the power control switch includes:

[0031] If the current detection unit has no current when the power control switch is open, and the voltage detection point has no voltage when the power control switch is closed, it is determined that the interface is not connected to an external device.

[0032] If the current detection unit has no current when the power control switch is opened, and the voltage detection point has voltage when the power control switch is closed, it is determined that the external device is a load.

[0033] If the current detection unit has current when the power control switch is opened, and the voltage detection point has no voltage when the power control switch is closed, it is determined that the external device is a load.

[0034] The device type identification apparatus and the device type identification method, the device type identification apparatus comprises a controller, an interface and a detection circuit, the interface is used for connecting an external device, and the controller and the detection circuit are connected through different terminals, one end of the detection circuit far from the interface is used for connecting a power supply, and a control circuit is connected to the detection circuit, when the interface connects different types of external devices, the detection circuit has different electrical parameters in on-off state, and the controller is used for identifying the type of the external device according to the on-off state and the electrical parameters of the detection circuit. Therefore, the controller identifies the type of the external device according to the on-off state and the electrical parameters of the detection circuit, the type of the interface is not limited, and a special USB OTG function supporting wire is not needed, the type of the external device connected by the interface can be determined without detecting the ID signal, the application range is wide, and the use convenience is high. BRIEF DESCRIPTION OF DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description only illustrate some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0036] Figure 1 It is a structural block diagram schematic view of the device type identification apparatus in one embodiment;

[0037] Figure 2 It is a structural block diagram schematic view of the device type identification apparatus in another embodiment;

[0038] Figure 3 It is a structural schematic view of the device type identification apparatus in one embodiment;

[0039] Figure 4 It is a flow schematic view of the device type identification method in one embodiment;

[0040] Figure 5 It is a flow schematic view of the device type identification method in another embodiment;

[0041] Figure 6 It is a detailed flow schematic view of the device type identification method in one embodiment. DETAILED DESCRIPTION

[0042] For the purpose of promoting an understanding of the application, the application will now be described in greater detail with reference to the figures. The embodiments shown in the figures are intended to explain the present application and are not meant to limit the present application. Rather, the present application can be implemented in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.

[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.

[0044] It should be understood that the terms "first", "second" and so on used herein can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element. For example, without departing from the scope of the application, a first resistor can be referred to as a second resistor, and similarly, a second resistor can be referred to as a first resistor. Both the first resistor and the second resistor are resistors, but they are not the same resistor.

[0045] It should be understood that "connection" in the following embodiments means that the circuits, modules, units, etc. connected to each other have electrical signal or data transmission.

[0046] It should be understood that "at least one" means one or more, and "multiple" means two or more. "At least part of the element" means part or all of the element.

[0047] As used herein, the singular forms "a", "an" and "the" can include plural forms unless the context clearly indicates otherwise. It should also be understood that the terms "comprise / comprising" or "have / having" specify the presence of stated features, integers, steps, operations, components, parts, or combinations thereof, but do not exclude the presence or addition of one or more other features, integers, steps, operations, components, parts, or combinations thereof. At the same time, the term "and / or" used in the specification includes any and all combinations of the related listed items.

[0048] The device type identification apparatus provided by the embodiments of the application is used to identify the type of the accessed external device. It can be understood that the device type identification apparatus can identify whether an external device is accessed, and when an external device is accessed, the type of the accessed external device is identified. The type of the external device can be a load or an active device, and the active device can be a PC, for example.

[0049] In one embodiment, referring to Figure 1 , there is provided a device type identification apparatus, comprising a controller 100, an interface 200 and a detection circuit 300, the interface 200 is used to access an external device, and the controller 100 and the detection circuit 300 are connected through different terminals of the interface 200, one end of the detection circuit 300 away from the interface 200 is used to connect a power supply, and the control circuit is connected to the detection circuit 300. When the interface 200 accesses different types of external devices, the detection circuit 300 has different electrical parameters in the on-off state, and the controller 100 is used to identify the type of the external device according to the on-off state and the electrical parameters of the detection circuit 300.

[0050] Specifically, the interface 200 is an external interface of the device type identification apparatus, and is used to connect an external device. The interface 200 can be a USB interface of the controller, or other types of interfaces. The interface 200 is provided with a plurality of terminals, and different terminals can be used to connect different devices. In the embodiment, the interface 200 is connected to the external device, the controller 100 and the detection circuit 300 through different terminals. It can be understood that in other embodiments, the terminals of the interface 200 can also be connected to other devices, for example, the interface 200 also includes a terminal connected to the ground to ensure the normal operation of the interface 200.

[0051] The detection circuit 300 is connected to the interface 200 at one end, and is connected to a power supply at the other end, and the detection circuit 300 is also connected to the controller 100. When the interface 200 accesses different types of external devices, the detection circuit 300 has different electrical parameters in the on-off state. The on-off state means that the detection circuit 300 has two states of conduction and disconnection. The electrical parameters include but are not limited to voltage and current. When accessing different types of external devices, the detection circuit 300 has different electrical parameters based on the difference in the on-off state of the detection circuit 300. For example, if the accessed external device is a class A device, the detection circuit 300 has an electrical parameter a1 in the conduction state, and the detection circuit 300 has an electrical parameter a2 in the disconnection state; if the accessed external device is a class B device, the detection circuit 300 has an electrical parameter b1 in the conduction state, and the detection circuit 300 has an electrical parameter b2 in the disconnection state; wherein a1, a2, b1 and b2 can be different from each other.

[0052] The controller 100 is connected to the detection circuit 300, and can acquire the on-off state of the detection circuit 300 and the electrical parameter of the detection circuit 300. Based on the acquired on-off state of the detection circuit 300 and the electrical parameter of the detection circuit 300, and in combination with the existing circuit structure and control logic, the type of the external device connected to the interface 200 can be identified. Generally, when the type of the external device connected to the interface 200 is a load, the controller 100 is a host; and when the type of the external device connected to the interface 200 is an active device, the controller 100 is a slave. The type of the controller 100 is not unique, and can be, for example, an MCU or a CPU.

[0053] The above device type identification apparatus includes the controller 100, the interface 200, and the detection circuit 300. The interface 200 is used to connect to an external device, and is connected to the controller 100 and the detection circuit 300 through different terminals. The end of the detection circuit 300 away from the interface 200 is used to connect to a power supply. The control circuit is connected to the detection circuit 300. The detection circuit 300 has different electrical parameters in different on-off states when the interface 200 connects to different types of external devices. The controller 100 is used to identify the type of the external device according to the on-off state and the electrical parameter of the detection circuit 300. Thus, the controller 100 identifies the type of the external device according to the on-off state and the electrical parameter of the detection circuit 300. The type of the interface 200 is not limited, and no special USB OTG function supporting wire is needed. The type of the external device connected to the interface 200 can be determined without detecting the ID signal, and the apparatus has a wide application range and high convenience.

[0054] In one embodiment, referring to Figure 2 The detection circuit 300 includes a current detection unit 310 and a power supply control switch 320. The interface 200 is connected to the power supply through the current detection unit 310 and the power supply control switch 320 in sequence. The common terminal of the interface 200 and the current detection unit 310 is used as a voltage detection point. The voltage detection point, the current detection unit 310, and the power supply control switch 320 are all connected to the controller 100. The voltage detection point can also be the power terminal of the interface. The controller 100 is used to identify the type of the external device according to the voltage of the voltage detection point, the current of the current detection unit 310, and the on-off state of the power supply control switch 320.

[0055] Specifically, the controller 100 can control the on-off state of the detection circuit 300 by controlling the on-off state of the power supply control switch 320. When the power supply control switch 320 is turned on, the detection circuit 300 is turned on, and can access the power provided by the power supply. When the power supply control switch 320 is turned off, the detection circuit 300 is turned off, and cannot access the power provided by the power supply.

[0056] Based on the on-off state of the power control switch 320, the on-off state of the detection circuit 300 is different, and the current of the current detection unit 310 is also different. In addition, when the external device accessed by the interface 200 is an active device, the active device can supply power to the controller 100 through the interface 200, and there is voltage at the voltage detection point; when the external device accessed by the interface 200 is a load, the load cannot supply power through the interface 200. Based on the above analysis, the controller 100 can identify the type of the external device according to the voltage of the voltage detection point, the current of the current detection unit 310, and the on-off state of the power control switch 320.

[0057] In this embodiment, the detection circuit 300 includes a current detection unit 310 and a power control switch 320, and the interface 200 connects the power supply through the current detection unit 310 and the power control switch 320 in sequence. The common terminal of the interface 200 and the current detection unit 310 serves as a voltage detection point, and the voltage detection point, the current detection unit 310, and the power control switch 320 are all connected to the controller 100. Based on the above structure, the controller 100 can identify the type of the external device according to the voltage of the voltage detection point, the current of the current detection unit 310, and the on-off state of the power control switch 320, without the need to configure a specific function line or detect an ID signal, and has good versatility.

[0058] In one embodiment, the controller 100 is configured to determine that the interface 200 is not connected to an external device if the current detection unit 310 has no current when the power control switch 320 is open, and the voltage detection point has no voltage when the power control switch 320 is closed. Alternatively, the controller 100 is configured to determine that the external device is an active device if the current detection unit 310 has no current when the power control switch 320 is open, and the voltage detection point has voltage when the power control switch 320 is closed. Alternatively, the controller 100 is configured to determine that the external device is a load if the current detection unit 310 has current when the power control switch 320 is open, and the voltage detection point has no voltage when the power control switch 320 is closed.

[0059] Specifically, when the interface 200 is not connected to an external device, that is, the interface 200 is suspended, no current flows through the detection circuit 300 even if the power control switch 320 is open, and the current detection unit 310 has no current. When the power control switch 320 is closed, the voltage detection point has no voltage because the interface 200 is not connected to a device that can supply power.

[0060] When the interface 200 is connected to an active device, the active device can supply power to the controller 100 through the interface 200. At this time, if the power control switch 320 is open, the current detection unit 310 has no current; if the power control switch 320 is closed, the voltage detection point has voltage.

[0061] When the interface 200 is connected to the load, the load cannot supply power to the controller 100 through the interface 200. At this time, if the power control switch 320 is opened, the current flows through the detection circuit 300, and the current detection unit 310 has current; if the power control switch 320 is closed, the voltage detection point has no voltage.

[0062] In this embodiment, the controller 100 can determine whether the external device is connected according to the voltage of the voltage detection point, the current of the current detection unit 310, and the on-off state of the power control switch 320, and identify whether the external device is an active device or a load, so as to facilitate the controller 100 to adjust its working state according to the type of the external device and realize the OTG function.

[0063] The structure of the current detection unit 310 is not unique. In an embodiment, please refer to Figure 3 The current detection unit 310 includes a detection resistor R5, and the interface 200 is connected to the power supply VOUT through the detection resistor R5 and the power control switch 320 in sequence. By detecting the current flowing through the two ends of the detection resistor R5, the current of the current detection unit 310 can be obtained, which facilitates the controller 100 to realize subsequent judgment. It can be understood that in other embodiments, the current detection unit 310 can also have other structures as long as it is considered to be realized by those skilled in the art.

[0064] In this embodiment, the current detection unit 310 includes a detection resistor R5, and by detecting the current flowing through the two ends of the detection resistor R5, the current of the current detection unit 310 can be obtained, and the detection resistor R5 has a simple structure.

[0065] The structure of the power control switch 320 is also not unique. In an embodiment, please refer to Figure 3 The power control switch 320 includes a control switch tube Q1, the control end of the control switch tube Q1 is connected to the controller 100, the first end of the control switch tube Q1 is connected to the current detection unit 310, and the second end of the control switch tube Q1 is connected to the power supply. The controller 100 can send high and low level signals to the control end of the control switch tube Q1 to make the control switch tube Q1 in the on or off state. Exemplarily, the controller 100 can send a PWM signal to the control switch tube Q1 to realize the on-off control of the control switch tube Q1. The type of the control switch tube Q1 is not limited, for example, it can be a MOS tube or a triode, etc. as long as it is considered to be realized by those skilled in the art.

[0066] In this embodiment, the power control switch 320 includes a control switch transistor Q1. The control terminal of the control switch transistor Q1 is connected to the controller 100, the first terminal of the control switch transistor Q1 is connected to the current detection unit 310, and the second terminal of the control switch transistor Q1 is connected to the power supply. The controller 100 can make the control switch transistor Q1 be in a conducting or disconnected state by sending high and low level signals to the control terminal of the control switch transistor Q1. The control switch transistor Q1 has a simple structure and a wide range of options.

[0067] In one embodiment, the device type identification device further includes an amplifier circuit, through which the controller 100 is connected to the current detection unit 310. The amplifier circuit connects the current detection unit 310 and the controller 100, amplifying the current at the current detection unit 310 and converting it into a corresponding signal, which is then sent to the controller 100. This allows the controller 100 to promptly and accurately acquire the current from the current detection unit 310, improving detection sensitivity.

[0068] The structure of amplifier circuits is not unique; for example, please refer to [link to example circuit]. Figure 3 The amplifier circuit includes a differential amplifier U1, resistors R1, R2, R3, and R4, and capacitors C1 and C2. The IN- terminal of the differential amplifier U1 is connected to the first terminal of the current detection unit 310 through resistor R2, and the IN+ terminal of the differential amplifier U1 is connected to the second terminal of the current detection unit 310 through resistor R3. The OUT terminal of the differential amplifier U1 is connected to the controller 100 through resistor R1. The first terminal of resistor R1 is grounded through resistor R4, and the second terminal of resistor R1 is grounded through capacitor C1. The two ends of capacitor C2 are connected to the VCC terminal and VREF terminal of the differential amplifier U1, respectively. The VREF terminal and GND terminal of the differential amplifier U1 are grounded. Based on the above structure, the current signal can be converted and amplified, which is beneficial to improving the accuracy of the current detection result. It is understood that in other embodiments, the amplifier circuit may also have other structures, which are not limited here.

[0069] In one embodiment, the device type identification device further includes a voltage detection circuit 300, through which the controller 100 connects to a voltage detection point. The voltage detection circuit 300 connects the voltage detection point and the controller 100, and can process the voltage at the voltage detection point, converting it into a corresponding signal that the controller 100 can recognize before sending it to the controller 100. This allows the controller 100 to obtain the voltage at the voltage detection point accurately and promptly, improving detection sensitivity.

[0070] In one exemplary embodiment, please refer to Figure 3The voltage detection circuit 300 comprises a first resistor R10, a second resistor R11, a third resistor R12 and a first switch tube Q3. The first resistor R10 and the second resistor R11 are connected in series, one end of the series connection is connected to the voltage detection point, the other end of the series connection is grounded, the common end of the first resistor R10 and the second resistor R11 is connected to the control end of the first switch tube Q3, the first end of the first switch tube Q3 and the common end of the third resistor R12 are connected to the controller 100, one end of the third resistor R12 away from the first switch tube Q3 is used for connecting the voltage, and the second end of the first switch tube Q3 is grounded.

[0071] Specifically, the first resistor R10 can play a role of current limiting, and the second resistor R11 cooperates with the first switch tube Q3 to work and help the first switch tube Q3 to work normally. In the case that the structure and type of the first switch tube Q3 are determined, based on different voltages of the voltage detection point, for example, in the case that there is voltage and in the case that there is no voltage, the on-off state of the first switch tube Q3 is different. The controller 100 is connected to the common end of the third resistor R12 and the first end of the first switch tube Q3, and the voltage level state at this position can be used to determine whether there is voltage at the voltage detection point. For example, when there is voltage at the voltage detection point, the common end of the third resistor R12 and the first end of the first switch tube Q3 is at a low voltage level, and when there is no voltage at the voltage detection point, the common end of the third resistor R12 and the first end of the first switch tube Q3 is at a high voltage level. The type of the first switch tube Q3 is not limited, for example, it can be a MOS tube or a triode, as long as it can be realized by those skilled in the art.

[0072] In the embodiment, the voltage detection circuit 300 comprises the first resistor R10, the second resistor R11, the third resistor R12 and the first switch tube Q3, the first resistor R10 and the second resistor R11 are connected in series, one end of the series connection is connected to the voltage detection point, the other end of the series connection is grounded, the common end of the first resistor R10 and the second resistor R11 is connected to the control end of the first switch tube Q3, the first end of the first switch tube Q3 and the common end of the third resistor R12 are connected to the controller 100, one end of the third resistor R12 away from the first switch tube Q3 is used for connecting the voltage, and the second end of the first switch tube Q3 is grounded. Based on the above structure, the controller 100 can determine whether there is voltage at the voltage detection point by detecting the voltage level state of the common end of the third resistor R12 and the first end of the first switch tube Q3, which is convenient for detecting the voltage.

[0073] In one embodiment, the device type identification apparatus further comprises a switch control circuit, and the controller 100 is connected to the power supply control switch 320 through the switch control circuit. The controller 100 can control the switch control circuit, thereby controlling the on-off state of the power supply control switch 320, which is conducive to improving the working stability.

[0074] In one exemplary embodiment, please refer toFigure 3 The switch control circuit comprises a fourth resistor R7, a fifth resistor R8, a sixth resistor R9 and a second switch tube Q2. The first end of the second switch tube Q2 is connected to the power supply control switch 320 through the fourth resistor R7, the second end of the second switch tube Q2 is grounded, the control end of the second switch tube Q2 is connected to the controller 100 through the fifth resistor R8, the first end of the sixth resistor R9 is connected to the control end of the second switch tube Q2, and the second end of the sixth resistor R9 is grounded.

[0075] Specifically, the fifth resistor R8 can play a role of current limiting, and the sixth resistor R9 works with the second switch tube Q2 to help the second switch tube Q2 work normally. In the case where the structure and type of the second switch tube Q2 are determined, based on different levels of the control end of the second switch tube Q2 transmitted by the controller 100, for example, when the level is high or low, the on-off state of the second switch tube Q2 is different, so that the level of the first end of the second switch tube Q2 output to the power supply control switch 320 is different, so as to control the on-off state of the power supply control switch 320. For example, when the second switch tube Q2 outputs a low level, the power supply control switch 320 is closed, and when the second switch tube Q2 outputs a high level, the power supply control switch 320 is opened. The type of the second switch tube Q2 is not limited, for example, it can be a MOS tube or a triode, as long as it is considered to be realized by those skilled in the art.

[0076] In the embodiment, the switch control circuit comprises a fourth resistor R7, a fifth resistor R8, a sixth resistor R9 and a second switch tube Q2. The first end of the second switch tube Q2 is connected to the power supply control switch 320 through the fourth resistor R7, the second end of the second switch tube Q2 is grounded, the control end of the second switch tube Q2 is connected to the controller 100 through the fifth resistor R8, the first end of the sixth resistor R9 is connected to the control end of the second switch tube Q2, and the second end of the sixth resistor R9 is grounded. Based on the above structure, the controller 100 can control the on-off state of the power supply control switch 320 by controlling the on-off state of the second switch tube Q2, and the control process is simple and stable.

[0077] In one embodiment, referring to Figure 4 A device type identification method is provided, which is implemented based on the device type identification device of any of the above embodiments and can be performed by the controller 100 of the device type identification device, and comprises the following steps:

[0078] In step 402, the on-off state and electrical parameters of the detection circuit are obtained.

[0079] The detection circuit 300 is connected to the interface 200 at one end and connected to the power supply at the other end, and is also connected to the controller 100. When the interface 200 is connected to different types of external devices, the detection circuit 300 has different electrical parameters in the on-off state. The on-off state refers to the two states of the detection circuit 300, i.e., the on state and the off state. The electrical parameters include, but are not limited to, voltage and current. When the interface 200 is connected to different types of external devices, the detection circuit 300 has different electrical parameters based on the different on-off states of the detection circuit 300. For example, if the connected external device is a type A device, the detection circuit 300 has an electrical parameter a1 in the on state, and has an electrical parameter a2 in the off state. If the connected external device is a type B device, the detection circuit 300 has an electrical parameter b1 in the on state, and has an electrical parameter b2 in the off state. The electrical parameters a1, a2, b1 and b2 can be different from each other. The controller 100 is connected to the detection circuit 300 and can obtain the on-off state of the detection circuit 300 and the electrical parameters of the detection circuit 300.

[0080] In step 404, the type of the external device is identified according to the on-off state and the electrical parameters of the detection circuit.

[0081] Based on the obtained on-off state of the detection circuit 300 and the electrical parameters of the detection circuit 300, and in combination with the existing circuit structure and control logic, the type of the external device connected to the interface 200 can be identified. Generally, when the type of the external device connected to the interface 200 is a load, the controller 100 acts as a host; and when the type of the external device connected to the interface 200 is an active device, the controller 100 acts as a slave.

[0082] The above device type identification method obtains the on-off state and the electrical parameters of the detection circuit 300, and identifies the type of the external device according to the on-off state and the electrical parameters of the detection circuit 300. Thus, the type of the interface 200 is not limited, and no special USB OTG function supporting cable is needed. The type of the external device connected to the interface 200 can be determined without detecting the ID signal, which has a wide application range and high convenience.

[0083] In one embodiment, referring to Figure 5 Step 404 includes step 504: identifying the type of the external device according to the voltage of the voltage detection point, the current of the current detection unit, and the on-off state of the power supply control switch.

[0084] The controller 100 controls the on-off state of the detection circuit 300 by controlling the power supply control switch 320. When the power supply control switch 320 is turned on, the detection circuit 300 is turned on and can access the power provided by the power supply. When the power supply control switch 320 is turned off, the detection circuit 300 is turned off and cannot access the power provided by the power supply.

[0085] Based on the on-off state of the power control switch 320, the on-off state of the detection circuit 300 is different, and the current of the current detection unit 310 is also different. In addition, when the external device accessed by the interface 200 is an active device, the active device can supply power to the controller 100 through the interface 200, and there is voltage at the voltage detection point; when the external device accessed by the interface 200 is a load, the load cannot supply power through the interface 200. Based on the above analysis, the controller 100 can identify the type of the external device according to the voltage at the voltage detection point, the current of the current detection unit 310, and the on-off state of the power control switch 320.

[0086] In this embodiment, the detection circuit 300 includes the current detection unit 310 and the power control switch 320, and the controller 100 can identify the type of the external device according to the voltage at the voltage detection point, the current of the current detection unit 310, and the on-off state of the power control switch 320, without the need to configure a specific function line or detect an ID signal, and the versatility is good.

[0087] In one embodiment, step 504 includes the following steps:

[0088] If the current detection unit 310 has no current when the power control switch 320 is open, and the voltage detection point has no voltage when the power control switch 320 is closed, it is determined that the interface 200 is not connected to an external device;

[0089] If the current detection unit 310 has no current when the power control switch 320 is open, and the voltage detection point has voltage when the power control switch 320 is closed, it is determined that the external device is an active device;

[0090] If the current detection unit 310 has current when the power control switch 320 is open, and the voltage detection point has no voltage when the power control switch 320 is closed, it is determined that the external device is a load.

[0091] Specifically, when the interface 200 is not connected to an external device, that is, the interface 200 is suspended, at this time, even if the power control switch 320 is open, no current flows through the detection circuit 300, and the current detection unit 310 has no current. When the power control switch 320 is closed, because the interface 200 is also not connected to a device that can supply power, the voltage detection point has no voltage.

[0092] When the interface 200 accesses an active device, the active device can supply power to the controller 100 through the interface 200. At this time, if the power control switch 320 is open, the current detection unit 310 has no current; if the power control switch 320 is closed, the voltage detection point has voltage.

[0093] When the interface 200 is connected to the load, the load cannot supply power to the controller 100 through the interface 200. If the power control switch 320 is turned on at this time, the current flows through the detection circuit 300, and the current detection unit 310 has current; if the power control switch 320 is turned off, there is no voltage at the voltage detection point.

[0094] In this embodiment, the controller 100 can determine whether the external device is connected according to the voltage at the voltage detection point, the current of the current detection unit 310, and the on-off state of the power control switch 320, and identify whether the external device is an active device or a load, so that the controller 100 can adjust its working state according to the type of the external device to realize the OTG function.

[0095] It should be understood that, although each step in the flowchart involved in each of the above embodiments is shown in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise stated herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.

[0096] In order to better understand the above embodiments, a specific embodiment is explained in detail as follows. In one embodiment, referring to Figure 2 , the device type identification apparatus includes a controller 100, an interface 200, and a detection circuit 300, wherein the detection circuit 300 includes a current detection unit 310 and a power control switch 320, and the interface 200 is a USB interface 200. The interface 200 includes terminals VBUS, GND, DP, and DM, wherein VBUS is a power terminal, DP and DM are USB signal terminals, and are connected to the controller 100, which can be an MCU or a CPU. The current detection unit 310 is used to detect the line current value of the branch in which the VBUS terminal is located, and the power control switch 320 controls the conduction and shutdown of the power Vout under the control of the controller 100.

[0097] When the device connected to the interface 200 is a load, the controller 100 acts as a Host (i.e., the controller 100 acts as a USB host); when the device connected to the interface 200 is an active device, the controller 100 acts as a Device (i.e., the controller 100 acts as a USB slave).

[0098] The specific method is as follows:

[0099] When the interface 200 is suspended (not connected to any device), the power control switch 320 is opened, and the current detection unit 310 does not detect current; the power control switch 320 is closed, and the VBUS does not detect voltage.

[0100] When the interface 200 is connected to a PC or other active device, the PC provides power to the controller 100 through the interface 200, i.e., the VBUS has voltage. At this time, the power control switch 320 is operated. When the power control switch 320 is opened, the current detection unit 310 does not detect current; when the power control switch 320 is closed, the VBUS has voltage. This part is defined as process A. Repeating the A process several times, the PC or other active device is identified as being connected, and the controller works in the Device mode.

[0101] When the interface 200 is connected to a load, no power is provided to the controller 100. At this time, the power control switch 320 is operated. When the power control switch 320 is opened, the current detection unit 310 detects current; when the power control switch 320 is closed, the VBUS is not detected. Repeating several times, the load is identified as being connected, and the controller works in the Host mode.

[0102] Based on this, please refer to Figure 6 , the working process of the device type identification device includes: after starting, firstly judging whether the power control switch is closed, if closed, further judging whether the current detection unit detects current, if detecting, judging that the connected external device is a load, and the controller is a host. If the current detection unit does not detect current, returning to the starting step. If the power control switch is not closed, judging whether the voltage detection point detects voltage, if detecting, judging that the connected external device is an active device, and the controller is a slave. If the voltage detection point does not detect voltage, returning to the starting step.

[0103] Further, please refer to Figure 3 , the device type identification device further includes an amplification circuit, a voltage detection circuit 300 and a switch control circuit, and the interface 200 is a USB interface J1. The amplification circuit includes a differential amplifier U1, resistors R1, R2, R3, R4, capacitors C1 and C2, the voltage detection circuit 300 includes first, second and third resistors R10, R11 and R12, and the switch control circuit includes fourth, fifth and sixth resistors R7, R8 and R9 and a second switch tube Q2.

[0104] The differential amplifier U1 is used to detect the current flowing through the resistors R5, the first switch tube Q3 is used to detect whether the VBUS voltage detection point has voltage, and the Q2 is used to control the conduction and shutdown of the Q1.

[0105] When Q2 outputs low level, Q1 is off, during Q2 low level, P2 detects low level; when Q2 outputs high level, Q1 is on, during Q2 high level, the current flowing through R5 is 0. It is considered that PC is connected, the controller USB switches to Device mode.

[0106] When Q2 outputs low level, Q1 is off, during Q2 low level, P2 detects low level; when Q2 outputs high level, Q1 is on, during Q2 high level, the current flowing through R5 is 0. It is considered that PC is connected, the controller USB switches to Device mode.

[0107] The device type identification apparatus and the device type identification method provided by the application can judge the USB device type without detecting the ID signal, so that many interfaces can be applied to the USB interface.

[0108] In the description of the present specification, the description referring to the terms "some embodiments", "other embodiments", and the like means that the specific features, structures, materials or characteristics described in connection with the embodiments or examples are contained in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily mean the same embodiment or example.

[0109] The technical features of the above-described embodiments can be combined arbitrarily, and in order to make the description simple, all possible combinations of the technical features in the above-described embodiments are not described, however, as long as the combinations of the technical features do not contradict, it should be considered that they are within the scope of the present application.

[0110] The above-described embodiments only express several implementation manners of the present application, the description is more specific and detailed, but it should not be understood as the limitation of the scope of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which are within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A device type identification device, characterized in that, The device includes a controller, an interface, and a detection circuit. The interface is used to connect to an external device and connects the controller and the detection circuit through different terminals. The end of the detection circuit away from the interface is used to connect to a power supply. The control circuit is connected to the detection circuit. When different types of external devices are connected to the interface, the detection circuit has different electrical parameters in the on / off state. The controller is used to identify the type of external device based on the on / off state of the detection circuit and the electrical parameters.

2. The device type identification device according to claim 1, characterized in that, The detection circuit includes a current detection unit and a power control switch. The interface is connected to the power supply in sequence through the current detection unit and the power control switch. The common terminal of the interface and the current detection unit serves as a voltage detection point. The voltage detection point, the current detection unit, and the power control switch are all connected to the controller. The controller is used to identify the type of the external device based on the voltage of the voltage detection point, the current of the current detection unit, and the on / off state of the power control switch.

3. The device type identification device according to claim 2, characterized in that, The controller is configured to determine that the interface is not connected to an external device if the current detection unit has no current when the power control switch is on, and the voltage detection point has no voltage when the power control switch is off. or, The controller is configured to determine that the external device is an active device if the current detection unit has no current when the power control switch is on, and the voltage detection point has voltage when the power control switch is off. or, The controller is configured to determine that the external device is a load if the current detection unit has current when the power control switch is on, and the voltage detection point has no voltage when the power control switch is off.

4. The device type identification device according to claim 2, characterized in that, The circuit detection unit includes a detection resistor, and the interface is connected to the power supply in sequence through the detection resistor and the power control switch.

5. The device type identification device according to claim 2, characterized in that, The power control switch includes a control switch transistor. The control terminal of the control switch transistor is connected to the controller, the first terminal of the control switch transistor is connected to the current detection unit, and the second terminal of the control switch transistor is connected to the power supply.

6. The device type identification device according to claim 2, characterized in that, It also includes an amplifier circuit, through which the controller is connected to the current detection unit.

7. The device type identification device according to claim 2, characterized in that, It also includes a voltage detection circuit, through which the controller is connected to the voltage detection point.

8. The device type identification device according to claim 7, characterized in that, The voltage detection circuit includes a first resistor, a second resistor, a third resistor, and a first switching transistor; The first resistor and the second resistor are connected in series. One end of the series connection is connected to the voltage detection point, and the other end is grounded. The common terminal of the first resistor and the second resistor is connected to the control terminal of the first switch transistor. The first terminal of the first switch transistor and the common terminal of the third resistor are connected to the controller. The end of the third resistor away from the first switch transistor is used to connect to the voltage. The second terminal of the first switch transistor is grounded.

9. The device type identification device according to claim 2, characterized in that, It also includes a switch control circuit, through which the controller is connected to the power control switch.

10. The device type identification device according to claim 9, characterized in that, The switch control circuit includes a fourth resistor, a fifth resistor, a sixth resistor, and a second switch transistor; The first terminal of the second switching transistor is connected to the power control switch through the fourth resistor, the second terminal of the second switching transistor is grounded, the control terminal of the second switching transistor is connected to the controller through the fifth resistor, the first terminal of the sixth resistor is connected to the control terminal of the second switching transistor, and the second terminal of the sixth resistor is grounded.

11. A method for identifying device type, characterized in that, Based on the device type identification device according to any one of claims 1-10, the method includes: Acquire the on / off state and electrical parameters of the detection circuit; The type of external device is identified based on the on / off state and electrical parameters of the detection circuit.

12. The device type identification method according to claim 11, characterized in that, The detection circuit includes a current detection unit and a power control switch. Identifying the type of the external device based on the on / off state and electrical parameters of the detection circuit includes: The type of external device is identified based on the voltage at the voltage detection point, the current of the current detection unit, and the on / off state of the power control switch.

13. The device type identification method according to claim 12, characterized in that, The step of identifying the type of external device based on the voltage at the voltage detection point, the current of the current detection unit, and the on / off state of the power control switch includes: If the current detection unit has no current when the power control switch is on, and the voltage detection point has no voltage when the power control switch is off, it is determined that the interface is not connected to an external device. If the current detection unit has no current when the power control switch is on, and the voltage detection point has voltage when the power control switch is off, then the external device is determined to be an active device. If the current detection unit has current when the power control switch is on, and the voltage detection point has no voltage when the power control switch is off, then the external device is determined to be a load.