CN105718012B - Method and circuit for automatically switching Vbus voltage in master-slave mode of OTG (on-the-go) equipment - Google Patents
Method and circuit for automatically switching Vbus voltage in master-slave mode of OTG (on-the-go) equipment Download PDFInfo
- Publication number
- CN105718012B CN105718012B CN201410718827.6A CN201410718827A CN105718012B CN 105718012 B CN105718012 B CN 105718012B CN 201410718827 A CN201410718827 A CN 201410718827A CN 105718012 B CN105718012 B CN 105718012B
- Authority
- CN
- China
- Prior art keywords
- voltage
- window comparator
- otg
- vbus
- pin
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 10
- 230000005669 field effect Effects 0.000 claims description 44
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 239000000725 suspension Substances 0.000 description 1
Images
Landscapes
- Manipulation Of Pulses (AREA)
- Direct Current Feeding And Distribution (AREA)
Abstract
The invention relates to a method for automatically switching Vbus voltage in a master-slave mode of OTG equipment, wherein when the OTG equipment is in the master mode, the voltage of an usb _ id pin outputs low level through a window comparator, a control switch circuit is conducted, and the Vbus pin outputs the working voltage of slave equipment; when the OTG equipment is in a slave mode, the voltage of the usb _ id pin outputs high level through the window comparator, the control switch circuit is cut off, and the Vbus pin does not output. A circuit for automatically switching Vbus voltage in a master-slave mode of OTG equipment comprises a window comparator and a switch circuit, wherein a usb _ id pin is connected with an access end Vid of the window comparator, and an output end Vout of the window comparator is connected with the switch circuit; when the OTG equipment is in a master mode, the window comparator controls a Vbus pin of the switch circuit to output the working voltage of the slave equipment; when the OTG device is in slave mode, the window comparator controls the Vbus pin of the switching circuit to have no output.
Description
Technical Field
The invention relates to the field of detection of OTG (on-the-go) equipment, in particular to a method and a circuit for automatically switching Vbus voltage in a master-slave mode of OTG equipment.
Background
In the prior art, a device with an OTG function determines whether to operate as host (master mode/usb _ id floating) or device (slave mode/usb _ id grounded/pulled high) by detecting a state of an usb _ id pin. When the OTG device works as a host, the OTG device provides a Vbus power supply for the peripheral and works in a master mode, and when the OTG device works as a device, the OTG device cuts off the supply of the Vbus power supply and works in a slave mode.
However, the above-mentioned determination method needs to have Vbus monitoring and power supply circuit (Ldo, current-limiting Ic), and at the same time needs software cooperation to implement power supply switching, and cannot achieve several kinds of compatible designs of usb _ id trigger states (high, low, floating), and under the application environment that needs to quickly and simply determine the OTG working mode, it appears that the mechanism is complex and the cost is increased.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method and a circuit for automatically switching Vbus voltage in a master-slave mode of OTG equipment, which are realized by a pure circuit structure.
The technical scheme of the invention is as follows:
when the OTG equipment is in a master mode, the voltage of an usb _ id pin outputs a low level through a window comparator, a switch circuit is controlled to be conducted, and the Vbus pin outputs the working voltage of slave equipment; when the OTG equipment is in a slave mode, the voltage of the usb _ id pin outputs high level through the window comparator, the control switch circuit is cut off, and the Vbus pin does not output.
Preferably, after voltage of the usb _ id pin is divided by the resistor, the voltage of the usb _ id pin is compared with low threshold voltage and high threshold voltage of the window comparator, when the OTG device is in the master mode, the divided voltage of the usb _ id pin is between the low threshold voltage and the high threshold voltage, and the window comparator outputs a low level; when the OTG device is in the slave mode, the voltage of the usb _ id pin after voltage division is lower than the low threshold voltage or higher than the high threshold voltage, and the window comparator outputs a high level.
Preferably, the switch circuit comprises a cascade triode and a field effect transistor, when the window comparator outputs a high level, the cascade triode controls the field effect transistor to be cut off, and the Vbus pin has no output voltage; when the window comparator outputs a low level, the cascade triode controls the field effect transistor to be conducted, and the Vbus pin outputs voltage as the working voltage of the slave device.
A circuit for automatically switching Vbus voltage in a master-slave mode of OTG equipment comprises a window comparator and a switch circuit, wherein a usb _ id pin is connected with an access end Vid of the window comparator, and an output end Vout of the window comparator is connected with the switch circuit; when the OTG equipment is in a master mode, the window comparator controls a Vbus pin of the switch circuit to output the working voltage of the slave equipment; when the OTG device is in slave mode, the window comparator controls the Vbus pin of the switching circuit to have no output.
Preferably, the window comparator comprises a voltage dividing resistor, and after the usb _ id pin is connected from the connecting end Vid, the voltage divided by the resistor enters the double-limit comparison circuit of the window comparator from the input end Vin of the window comparator.
Preferably, the switching circuit comprises a cascade triode and a field effect transistor, wherein in the cascade triode, the collector of the former stage is connected with the base of the latter stage, the collector of the latter stage is connected with the grid of the field effect transistor, and the drain of the field effect transistor is connected with the Vbus pin.
Preferably, when the OTG device is in the master mode, the field effect transistor is turned on, a source electrode of the field effect transistor is connected to a working voltage, and an output voltage of the Vbus pin is equal to the working voltage loaded on the source electrode; when the OTG equipment is in a slave mode, the field effect tube is cut off, the drain electrode and the source electrode of the field effect tube are reversely conducted through the body diode, the Vbus pin is connected with working voltage from the main equipment, and power is supplied to the OTG equipment through the source electrode.
The invention has the following beneficial effects:
according to the method, a simple and practical circuit structure is built, a window comparator is adopted to be matched with a field effect transistor (P-MOSFET), the state of usb _ id is automatically detected to control supply of a Vbus power supply, hardware switching of the OTG equipment master-slave mode under the condition that the trigger state is uncertain is further achieved, a software judgment mechanism is removed, and the cooperation of the software judgment mechanism is not needed, so that CPU resources are saved. Meanwhile, the self body diode of the P-MOSFET is utilized to realize the supply of the working power supply of the equipment in the slave mode. The invention realizes the compatibility judgment of the master-slave working mode, and simultaneously realizes the supply of the working power supply of the equipment in the device slave mode by matching with the special performance of simple components (the body diode of the field effect tube).
Drawings
Fig. 1 is a circuit block diagram of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
In the invention, the OTG device judges whether the operation is host (master mode/usb _ id suspension) or device (slave mode/usb _ id grounding/pulling-up) by detecting the state of the usb _ id pin. When the OTG equipment works as a host, the OTG equipment provides a Vbus power supply for the peripheral equipment and works in a master mode, and when the OTG equipment works as a device, the OTG equipment cuts off the Vbus power supply and works in a slave mode;
the invention provides a method for automatically switching Vbus voltage in a master-slave mode of OTG equipment, wherein when the OTG equipment is in the master mode, the voltage of an usb _ id pin outputs low level through a window comparator, a switch circuit is controlled to be conducted, and the Vbus pin outputs the working voltage of slave equipment; when the OTG equipment is in a slave mode, the voltage of the usb _ id pin outputs high level through the window comparator, the control switch circuit is cut off, and the Vbus pin does not output.
After voltage of the usb _ id pin is subjected to resistance voltage division, the voltage of the usb _ id pin is compared with low threshold voltage and high threshold voltage of the window comparator, when the OTG device is in a master mode, the voltage of the usb _ id pin subjected to voltage division is located between the low threshold voltage and the high threshold voltage, and the window comparator outputs a low level; when the OTG device is in the slave mode, the voltage of the usb _ id pin after voltage division is lower than the low threshold voltage or higher than the high threshold voltage, and the window comparator outputs a high level.
The switching circuit comprises a cascade triode and a field effect transistor, when the window comparator outputs a high level, the cascade triode controls the field effect transistor to be cut off, and the Vbus pin has no output voltage; when the window comparator outputs a low level, the cascade triode controls the field effect transistor to be conducted, and the Vbus pin outputs voltage as the working voltage of the slave device.
A circuit for automatically switching Vbus voltage in a master-slave mode of OTG equipment comprises a window comparator and a switch circuit, wherein a usb _ id pin is connected with an access end Vid of the window comparator, and an output end Vout of the window comparator is connected with the switch circuit; when the OTG equipment is in a master mode, the window comparator controls a Vbus pin of the switch circuit to output the working voltage of the slave equipment; when the OTG device is in slave mode, the window comparator controls the Vbus pin of the switching circuit to have no output.
The window comparator comprises a voltage division resistor, and after a usb _ id pin is connected from a connecting end Vid, voltage after voltage division through the resistor enters a double-limit comparison circuit of the window comparator from an input end Vin of the window comparator.
The switching circuit comprises a cascade triode and a field effect transistor, wherein in the cascade triode, a collector of a front stage is connected with a base of a rear stage, a collector of the rear stage is connected with a grid electrode of the field effect transistor, and a drain electrode of the field effect transistor is connected with a Vbus pin.
When the OTG equipment is in a master mode, the field effect tube is conducted, the source electrode of the field effect tube is connected with working voltage, and the output voltage of the Vbus pin is equal to the working voltage loaded on the source electrode; when the OTG equipment is in a slave mode, the field effect tube is cut off, the drain electrode and the source electrode of the field effect tube are reversely conducted through the body diode, the Vbus pin is connected with working voltage from the main equipment, and power is supplied to the OTG equipment through the source electrode.
Examples
As shown in fig. 1, the window comparator is a double-threshold comparator circuit, mainly including an operational amplifier a1 and an operational amplifier a2, and sets the values of a reference comparison voltage high threshold voltage VH and a reference comparison voltage low threshold voltage VL through resistors. The resistance relationship shown in FIG. 1 can be calculated
If Vin < VL or Vin > VH, Vout outputs high level;
if VL is less than or equal to Vin and less than or equal to VH, Vout outputs low level.
The switch circuit is a two-stage reverse switch circuit and mainly comprises a triode T1, a triode T2 and a field effect transistor (P-MOSFET) N1.
When Vout is high, the transistor T1 is turned on, the transistor T2 is turned off, the collector of the transistor T2 is pulled high, the field-effect transistor (P-MOSFET) N1 is turned off, and VBUS _5V0 is 0V; when the field effect transistor (P-MOSFET) N1 is turned off, the drain and source are turned on in reverse direction due to the self-contained body diode of the field effect transistor (P-MOSFET) N1. When the OTG device operates in the slave mode and is connected to the master device, VBUS _5V0 obtains an operating voltage from the master device, that is, VBUS _5V0 is 5V, and at this time, VCC _5V0 connected to the source electrode is approximately equal to VBUS _5V0 is 5V (in actual use, an error caused by electrical characteristics of components can be ignored), so that the OTG device is set in the slave mode, and the external master device provides a power supply for the OTG device.
When Vout is low, the transistor T1 is turned off, the transistor T2 is turned on, the collector of the transistor T2 is pulled down to low, the field effect transistor (P-MOSFET) N1 is turned on, and VBUS _5V0 is 5V (the standard operating voltage of USB is 5V, so the loaded voltage will finally output 5V at VBUS _5V 0).
The OTG equipment has two working modes of a master mode and a slave mode, and has three states in total, specifically as follows:
state 1:
when usb _ id is grounded, the OTG device operates in the slave mode, and then Vid is 0V, that is, Vin is 0V < VL;
the operational amplifier A1 outputs low level, the operational amplifier A2 outputs high level; diode D1 is off and diode D2 is on;
vout outputs high; the triode T1 is turned on, the triode T2 is cut off, and the field effect transistor (P-MOSFET) N1 is cut off;
state 2:
the operational amplifier A1 outputs high level, and the operational amplifier A2 outputs low level; diode D1 is on and diode D2 is off;
vout outputs high; the triode T1 is turned on, the triode T2 is cut off, and the field effect transistor (P-MOSFET) N1 is cut off;
for the above state 1 and state 2, the OTG device operates in device slave mode, where the field effect transistor (P-MOSFET) N1 is turned off, VBUS _5V0 ≠ VCC _5V 0. If the OTG device is connected to a host device (for example, a PC), VBUS _5V0 ═ 5V (obtained from the host device), the drain and source are reversely conducted through the body diode of the field-effect transistor (P-MOSFET) N1, typically Vds ≈ 0.3V, then VCC _5V0 ≈ 4.7V is accurate, the OTG device is powered on, and the operating voltage is provided by the external host device.
State 3:
when usb _ id is empty, the OTG device works in the master mode, and VL < Vid < VH;
the operational amplifier A1 outputs low, the operational amplifier A2 outputs low; diode D1 turns off, and diode D2 turns off;
vout outputs low; the triode T1 is cut off, and the triode T2 is conducted; field effect transistor (P-MOSFET) N1 is on;
for state 3, the OTG device operates in host master mode, where a field effect transistor (P-MOSFET) N1 is turned on, VBUS _5V0 is VCC _5V0 is 5V, and the OTG device may provide a 5V power supply for an external device (a slave device, such as a usb disk).
The field effect transistor (P-MOSFET) N1 in this embodiment may also be replaced by another type of MOS transistor, and a specific circuit structure may be implemented by those skilled in the art based on the embodiments disclosed in the present invention, in combination with the characteristics of the replaced MOS transistor, without performing creative work.
The above examples are provided only for illustrating the present invention and are not intended to limit the present invention. Changes, modifications, etc. to the above-described embodiments are intended to fall within the scope of the claims of the present invention as long as they are in accordance with the technical spirit of the present invention.
Claims (5)
1. A method for automatically switching Vbus voltage in a master-slave mode of an OTG device is characterized in that the OTG device adopts a window comparator to match with a switch circuit, automatically detects the state of usb _ id to judge whether the OTG device works in the master mode or the slave mode, realizes hardware switching of the master-slave mode of the OTG device under the condition of uncertain triggering state, and controls the supply of a Vbus power supply; when the OTG equipment is in a master mode, the voltage of the usb _ id pin after voltage division is positioned between the low threshold voltage and the high threshold voltage, the window comparator outputs a low level, the low level controls the switch circuit to be conducted, and the Vbus pin outputs the working voltage of the slave equipment; when the OTG equipment is in a slave mode, the voltage of the divided usb _ id pin is lower than a low threshold voltage or higher than a high threshold voltage, the window comparator outputs a high level, the high level controls the switch circuit to be cut off, and the Vbus pin does not output.
2. The method for automatically switching the Vbus voltage in the master-slave mode of the OTG device according to claim 1, wherein the switch circuit comprises a cascade triode and a field effect tube, when the window comparator outputs a high level, the cascade triode controls the field effect tube to be cut off, and the Vbus pin has no output voltage; when the window comparator outputs a low level, the cascade triode controls the field effect transistor to be conducted, and the Vbus pin outputs voltage as the working voltage of the slave device.
3. A circuit for automatically switching Vbus voltage in a master-slave mode of OTG equipment is characterized by comprising a window comparator and a switch circuit, wherein the window comparator comprises a divider resistor, an usb _ id pin is connected with an access end Vid of the window comparator, after the usb _ id pin is accessed from the access end Vid, the voltage divided by the resistor enters a double-limit comparison circuit of the window comparator from an input end Vin of the window comparator, and an output end Vout of the window comparator is connected with the switch circuit; the OTG equipment adopts a window comparator to match with a switch circuit, automatically detects the state of usb _ id to judge whether the OTG equipment works in a master mode or a slave mode, realizes hardware switching of the master mode and the slave mode of the OTG equipment under the condition of uncertain triggering states, and controls the supply of a Vbus power supply; when the OTG equipment is in a master mode, the voltage of the usb _ id pin after voltage division is positioned between the low threshold voltage and the high threshold voltage, the window comparator outputs a low level, the low level controls the switching circuit to be conducted, and the window comparator controls the Vbus pin of the switching circuit to output the working voltage of the slave equipment; when the OTG equipment is in a slave mode, the voltage of the usb _ id pin after voltage division is lower than a low threshold voltage or higher than a high threshold voltage, the window comparator outputs a high level, the high level controls the switch circuit to be cut off, and the window comparator controls the Vbus pin of the switch circuit to have no output.
4. The circuit for automatically switching the Vbus voltage in the master-slave mode of an OTG device according to claim 3, wherein the switching circuit comprises a cascade triode and a field effect transistor, wherein in the cascade triode, the collector of the previous stage is connected with the base of the next stage, the collector of the next stage is connected with the gate of the field effect transistor, and the drain of the field effect transistor is connected with the Vbus pin.
5. The circuit for automatically switching the Vbus voltage in the master-slave mode of the OTG device according to claim 4, wherein when the OTG device is in the master mode, the field effect transistor is turned on, the source of the field effect transistor is connected with the working voltage, and the output voltage of the Vbus pin is equal to the working voltage loaded on the source; when the OTG equipment is in a slave mode, the field effect tube is cut off, the drain electrode and the source electrode of the field effect tube are reversely conducted, the Vbus pin is connected to working voltage from the main equipment, and power is supplied to the OTG equipment through the source electrode.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410718827.6A CN105718012B (en) | 2014-12-02 | 2014-12-02 | Method and circuit for automatically switching Vbus voltage in master-slave mode of OTG (on-the-go) equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410718827.6A CN105718012B (en) | 2014-12-02 | 2014-12-02 | Method and circuit for automatically switching Vbus voltage in master-slave mode of OTG (on-the-go) equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105718012A CN105718012A (en) | 2016-06-29 |
CN105718012B true CN105718012B (en) | 2020-02-18 |
Family
ID=56146260
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410718827.6A Active CN105718012B (en) | 2014-12-02 | 2014-12-02 | Method and circuit for automatically switching Vbus voltage in master-slave mode of OTG (on-the-go) equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105718012B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106855848B (en) * | 2017-03-13 | 2023-05-09 | 和远智能科技股份有限公司 | OTG power supply control system and method |
CN107480086B (en) * | 2017-08-04 | 2020-11-03 | 青岛海信移动通信技术股份有限公司 | Terminal and control method thereof |
CN110932712B (en) * | 2018-09-19 | 2023-05-05 | 青岛海信移动通信技术有限公司 | Interface circuit of connector and electronic device |
CN111339007B (en) * | 2020-02-28 | 2021-10-08 | 深圳市广和通无线股份有限公司 | USB device control method and device, computer device and storage medium |
CN112086830B (en) * | 2020-07-23 | 2022-12-06 | 福建联迪商用设备有限公司 | Data line circuit communicating with iOS device |
CN112234704B (en) * | 2020-10-12 | 2022-08-02 | 维沃移动通信有限公司 | Flash lamp power supply switching circuit, flash lamp control method and electronic equipment |
CN112187252A (en) * | 2020-10-12 | 2021-01-05 | 深圳市道通科技股份有限公司 | Interface identification circuit, method, equipment and electronic equipment |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1085356C (en) * | 1997-09-23 | 2002-05-22 | 微星科技股份有限公司 | The method of protecting CPU from being damaged by overvoltage and overcurrent |
JP3654274B2 (en) * | 2002-08-30 | 2005-06-02 | セイコーエプソン株式会社 | Data transfer control device, electronic device, and power supply switching method |
US8028178B2 (en) * | 2008-09-09 | 2011-09-27 | Freescale Semiconductor, Inc. | System and method for providing external power on a universal serial bus |
CN103365388B (en) * | 2012-04-09 | 2017-02-22 | 华为终端有限公司 | Power supply method of terminal device and terminal device |
CN203387203U (en) * | 2013-05-09 | 2014-01-08 | 上海斐讯数据通信技术有限公司 | Charging switching system possessing USB on-the-go (OTG) function |
-
2014
- 2014-12-02 CN CN201410718827.6A patent/CN105718012B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN105718012A (en) | 2016-06-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105718012B (en) | Method and circuit for automatically switching Vbus voltage in master-slave mode of OTG (on-the-go) equipment | |
US9182799B2 (en) | USB OTG device with power mode switch function | |
EP2698969B1 (en) | Electronic device having usb interface and usb communication start method thereof | |
CN104375616A (en) | adaptive universal serial bus charging method and system | |
DE602008002223D1 (en) | DETECT CONNECTION TO A USB HOST OR HUB WITHOUT USING AN EXTRASTAT INPUT | |
CN104113211B (en) | Low-power-dissipation hysteresis voltage detection circuit applied to energy acquisition system | |
CN112380080B (en) | USB equipment detection system and method | |
CN103376873A (en) | Minimum load current adapter circuit and mainboard | |
CN105186598A (en) | USB insertion automatic identification and power supply system and chip integrated with the same | |
US20130300213A1 (en) | Identification circuit | |
US20130162298A1 (en) | Identifying circuit | |
US9477297B2 (en) | Computer system and matching circuit thereof | |
CN203054660U (en) | Rapid power-cut controlling circuit applied to power supply managing circuit | |
TW201416845A (en) | Motherboard | |
US9954359B2 (en) | Power supply circuit and power supply method | |
CN107885304B (en) | Voltage sudden change detection circuit | |
CN104635907A (en) | Energy-saving circuit of computer | |
US20160274613A1 (en) | Interface supply circuit | |
CN105591637B (en) | The module that automatically resets in integrated circuit | |
CN103135645B (en) | Rapid disconnection control circuit applied to power management circuit | |
CN201541247U (en) | A power-on reset device for an integrated circuit chip | |
US20150089266A1 (en) | Switch circuit and computing device having same | |
CN203535416U (en) | A digital signal processing chip power supply circuit | |
CN108197057B (en) | Portable equipment | |
CN204258758U (en) | A kind of power down does not produce the reset circuit of reset signal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP03 | Change of name, title or address | ||
CP03 | Change of name, title or address |
Address after: 303-e, Zone C, innovation building, software park, Xiamen Torch hi tech Zone, Xiamen, Fujian, 361000 Patentee after: Xiamen Yaxun Zhilian Technology Co.,Ltd. Country or region after: China Address before: No.46 guanri Road, phase II, software park, Xiamen City, Fujian Province, 361000 Patentee before: XIAMEN YAXON NETWORK Co.,Ltd. Country or region before: China |