WO2021082731A1 - Electronic device and reverse charging method - Google Patents

Electronic device and reverse charging method Download PDF

Info

Publication number
WO2021082731A1
WO2021082731A1 PCT/CN2020/113319 CN2020113319W WO2021082731A1 WO 2021082731 A1 WO2021082731 A1 WO 2021082731A1 CN 2020113319 W CN2020113319 W CN 2020113319W WO 2021082731 A1 WO2021082731 A1 WO 2021082731A1
Authority
WO
WIPO (PCT)
Prior art keywords
voltage
pin
circuit
usb interface
pull
Prior art date
Application number
PCT/CN2020/113319
Other languages
French (fr)
Chinese (zh)
Inventor
李成亚
马鹏飞
栗忠明
Original Assignee
华为技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021082731A1 publication Critical patent/WO2021082731A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02JCIRCUIT ARRANGEMENTS OR SYSTEMS FOR SUPPLYING OR DISTRIBUTING ELECTRIC POWER; SYSTEMS FOR STORING ELECTRIC ENERGY
    • H02J7/00Circuit arrangements for charging or depolarising batteries or for supplying loads from batteries
    • H02J7/007Regulation of charging or discharging current or voltage
    • HELECTRICITY
    • H01ELECTRIC ELEMENTS
    • H01MPROCESSES OR MEANS, e.g. BATTERIES, FOR THE DIRECT CONVERSION OF CHEMICAL ENERGY INTO ELECTRICAL ENERGY
    • H01M10/00Secondary cells; Manufacture thereof
    • H01M10/42Methods or arrangements for servicing or maintenance of secondary cells or secondary half-cells
    • H01M10/44Methods for charging or discharging
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E60/00Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation
    • Y02E60/10Energy storage using batteries

Definitions

  • This application relates to the field of reverse charging technology, and in particular to an electronic device and a reverse charging method.
  • an electronic device such as a mobile phone
  • a reverse charging function it can charge another electronic device (such as a tablet computer) via a universal serial bus (USB) movable (on the go, OTG) cable.
  • USB universal serial bus
  • the electronic device that provides charging can be used as a host device, and the electronic device that is charged can be used as a slave device (device).
  • the USB OTG cable includes a master device end (end A) and a slave device end (end B).
  • the A end of the USB OTG line is connected to the USB interface of the master device
  • the B end of the USB OTG line is connected to the USB interface of the slave device.
  • the master device determines that it is connected to end A of the USB OTG line
  • it can provide charging power to the slave device through the USB OTG line.
  • the slave device determines to connect to the B end of the USB OTG line, it can recognize the USB interface of the master device as a standard downstream port (SDP) through the USB OTG line, and then receive the charging provided by the master device based on the SDP protocol Electrical energy.
  • SDP standard downstream port
  • the SDP protocol stipulates that the maximum charging current is 500mA, so the slave device will limit the charging current to 500mA, resulting in a lower reverse charging speed. Therefore, the existing reverse charging technology needs to be further studied.
  • this application provides an electronic device and a reverse charging method that integrates a pull-up circuit in the electronic device, so that the electronic device can connect to the main device end of the USB OTG line through the DM pin of the USB interface
  • the first voltage is provided so that the slave device can recognize the USB interface of the electronic device as a CDP port. Furthermore, it can realize high-current reverse charging based on the CDP protocol.
  • an embodiment of the present application provides an electronic device, which includes: a universal serial bus USB interface, a pull-up circuit, and a control circuit; wherein the USB interface is a standard downstream port SDP, and the pull-up circuit in the electronic device They are respectively coupled with the digital negative DM pin of the USB interface and the control circuit; the control circuit is used to control the pull-up circuit to provide the first DM pin to the DM pin after determining that the USB interface is connected to the main device end of the USB movable OTG line Voltage, the first voltage is used to indicate that the USB interface is a charging downstream port CDP.
  • the DM pin of the USB interface of the master device can be coupled with the DM pin of the USB interface of the slave device through the USB OTG line, and the DP pin of the USB interface of the master device can pass through
  • the USB OTG line is coupled with the DP pin of the USB interface of the slave device.
  • the slave device can execute the BC1.2 protocol, and identify the type of the USB interface of the master device through the voltage change of the DM pin of the USB interface and the voltage change of the DP pin. Specifically, the slave device will apply the DP voltage to the DP pin of its USB interface.
  • the slave device can determine that the USB interface of the master device is an SDP interface. Conversely, if the voltage of the DM pin in the USB interface of the slave device is pulled up, the slave device will apply the DM voltage to the DM pin. If the voltage of the DP pin is pulled up, the slave device It can be determined that the USB interface of the master device is a DCP port. On the contrary, if the DP pin in the USB interface of the slave device is not pulled up accordingly, the slave device can determine that the USB interface of the master device is a CDP port.
  • the control circuit controls the pull-up circuit to provide the first voltage to the DM pin.
  • the slave device end of the USB OTG line is connected to the USB interface of the slave device. Since the DM pin of the master device is applied with the first voltage, the voltage of the DM pin of the slave device is pulled up accordingly. Furthermore, when the slave device recognizes the USB interface of the master device, after applying the DP voltage to the DP pin, the slave device can detect that the voltage of the DM pin of its USB interface is pulled up, so the slave device will not transfer the master device The USB interface is recognized as an SDP port. The slave device instead applies the DM voltage to the DM pin.
  • USB interface of the electronic device is actually an SDP port, the voltage of the DP pin of the slave device will not be pulled up accordingly, so that the slave device can connect the master device
  • the USB interface is recognized as a CDP port, and then large current reverse charging can be realized based on the CDP protocol.
  • control circuit can determine whether the USB interface is connected to the main device end of the USB OTG line at least in the following two ways:
  • the electronic device further includes a power management circuit coupled to the trigger pin of the USB interface of the electronic device; the power management circuit can detect that the voltage of the trigger pin is lower than the first threshold After the voltage is applied, the first detection signal is sent to the control circuit; after receiving the first detection signal, the control circuit may determine that the USB interface is connected to the main device end of the USB OTG line.
  • the trigger pin of the USB interface is determined by the specific type of the USB interface.
  • the trigger pin in the USB 2.0 interface may be an identification (ID) pin
  • the trigger pin in the USB Type-C interface may be a configuration channel (configuration channel, CC) pin.
  • control circuit is also coupled with the trigger pin of the USB interface; the control circuit can also determine that the USB interface is connected to the USB OTG line after detecting that the voltage of the trigger pin is lower than the first threshold voltage The main equipment side.
  • the electronic device further includes a charging management circuit, which is coupled to the VBUS pin of the USB interface; the control circuit can also control the USB port after it is connected to the main device end of the USB OTG line
  • the charging management circuit outputs the charging voltage to the VBUS pin of the USB interface. Controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface can cause the voltage of the VBUS pin of the slave device to be pulled up accordingly, so that the slave device can recognize the slave device connected to the USB OTG line.
  • control circuit can more accurately control the time when the pull-up circuit outputs the first voltage in at least the following two ways:
  • control circuit may turn on the DP comparator for executing the BC1.2 protocol after the time for controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface reaches the first time delay; After receiving the third detection signal provided by the DP comparator, the pull-up circuit is controlled to provide the first voltage to the DM pin.
  • the slave device applies a DP voltage to the DP pin of the slave device, and identifies the type of the USB interface of the master device through the voltage change of the DM pin of the slave device.
  • the control circuit receives the third detection signal provided by the DP comparator, it indicates that the voltage of the DP pin of the electronic device (master device) is pulled up. At this time, the pull-up circuit is turned on to become the master device.
  • the DM pin provides the first voltage, so that the slave device can detect that the voltage of the DM pin of the slave device is pulled up, which can not only prevent the slave device from recognizing the USB interface of the master device as an SDP port, but also can control it more accurately.
  • the time for the pull circuit to output the first voltage can not only prevent the slave device from recognizing the USB interface of the master device as an SDP port, but also can control it more accurately.
  • control circuit can detect the voltage of the digital positive DP pin of the USB interface after determining that the USB interface is connected to the main device end of the USB OTG line; after detecting that the voltage of the DP pin is greater than the first After the three threshold voltages, the pull-up circuit is controlled to provide the first voltage to the DM pin.
  • control circuit may also control the pull-up circuit to stop providing the first voltage to the DM pin after the time for controlling the pull-up circuit to provide the first voltage to the DM pin reaches the second time delay.
  • the duration of the second delay can be determined according to the BC 1.2 protocol. For example, after the slave device applies the DP voltage to the DP pin, and then applies the DM voltage to the DM pin after an interval of 40ms, the second delay in the embodiment of this application is not less than 40ms to ensure that the slave device can apply the DP pin to the DP pin. After the DP voltage, it can be detected that the voltage of the DM pin of the slave device is pulled up accordingly.
  • the pull-up circuit includes a first switch tube and a first resistor; wherein, the control electrode of the first switch tube is coupled to the control circuit, and the first electrode of the first switch tube is connected to one end of the first resistor. Coupling, the second electrode of the first switch tube is coupled with the DM pin, and the other end of the first resistor is used to receive the basic voltage; the control circuit can turn on the first terminal after confirming that the USB interface is connected to the main device end of the USB OTG line turning tube.
  • the above-mentioned pull-up circuit may further include a second resistor, one end of the second resistor is coupled with the control circuit, and the other end of the second resistor is coupled with the control electrode of the first switch tube.
  • the above-mentioned first switch tube may be a bipolar transistor or a field effect transistor.
  • the above-mentioned basic voltage may be a voltage provided by a control circuit or a power management circuit for the pull-up circuit.
  • the pull-up circuit includes a third resistor; one end of the third resistor is coupled to the control circuit, and the other end of the third resistor is coupled to the DM pin; the control circuit can determine whether the USB interface is connected After the main device end of the USB OTG line, it outputs the basic voltage to the third resistor.
  • the embodiments of the present application provide a reverse charging method, which can be applied to a control circuit, the control circuit is coupled with a pull-up circuit, and the pull-up circuit is connected to the digital negative DM pin of the universal serial bus USB interface
  • the type of the USB interface is a standard downstream port SDP;
  • the reverse charging method provided in the embodiment of the present application includes: after determining that the USB interface is connected to the main device end of the USB movable OTG line, control the pull-up circuit to lead to the DM
  • the pin provides a first voltage, where the first voltage is used to indicate that the USB interface is a charging downstream port CDP.
  • control circuit is also coupled with the power management circuit, and the power management circuit is coupled with the trigger pin of the USB interface; the power management circuit is used to detect that the voltage of the trigger pin is lower than the first threshold voltage Then, the first detection signal is sent to the control circuit; the reverse charging method provided in the embodiment of the present application further includes: after receiving the first detection signal, determining that the USB interface is connected to the main device end of the USB OTG line.
  • control circuit is also coupled with the trigger pin of the USB interface;
  • reverse charging method provided in the embodiment of the present application further includes: after detecting that the trigger pin is lower than the first threshold voltage, Make sure that the USB interface is connected to the main device end of the USB OTG line.
  • control circuit is also coupled with the charging management circuit, and the charging management circuit is coupled with the VBUS pin of the USB interface; after determining that the USB interface is connected to the main device end of the USB OTG line, it also includes: controlling charging The management circuit outputs the charging voltage to the VBUS pin of the USB interface.
  • the pull-up circuit is controlled to provide a first voltage to the DM pin, and the first voltage is used to indicate that the USB interface is
  • the charging downstream port CDP includes: after the time for controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface reaches the first time delay, turning on the DP comparator for executing the BC1.2 protocol; after receiving the DP comparator After the third detection signal is provided, the pull-up circuit is controlled to provide the first voltage to the DM pin.
  • the pull-up circuit is controlled to provide the first voltage to the DM pin, and the first voltage is used to indicate that the USB interface is a charging downstream port CDP , Including: after determining that the USB interface is connected to the main device end of the USB OTG line, detecting the voltage of the digital positive DP pin of the USB interface; after detecting that the voltage of the DP pin is greater than the third threshold voltage, controlling the pull-up circuit to The DM pin provides the first voltage.
  • the method further includes: controlling the pull-up circuit to provide the first voltage to the DM pin after the second time delay reaches the second time delay, controlling the pull-up circuit to provide the first voltage to the DM pin.
  • the pull circuit stops supplying the first voltage to the DM pin.
  • the pull-up circuit includes a first switch tube and a first resistor; the control electrode of the first switch tube is coupled with the control circuit, and the first electrode of the first switch tube is coupled with one end of the first resistor, The second electrode of the first switch tube is coupled to the DM pin, and the other end of the first resistor is used to receive the basic voltage; after confirming that the USB interface is connected to the main device end of the USB OTG line, the pull-up circuit is controlled to provide the DM pin
  • the first voltage includes: after it is determined that the USB interface is connected to the main device end of the USB OTG line, the first switch tube is turned on.
  • the pull-up circuit further includes a second resistor, one end of the second resistor is coupled to the control circuit, and the other end of the second resistor is coupled to the control electrode of the first switch tube.
  • the first switch tube is a bipolar transistor or a field effect transistor.
  • the base voltage is the voltage provided by the control circuit or the power management circuit for the pull-up circuit.
  • the pull-up circuit includes a third resistor; one end of the third resistor is coupled to the control circuit, and the other end of the third resistor is coupled to the DM pin; after determining that the USB interface is connected to the main USB OTG line After the device end, controlling the pull-up circuit to provide the first voltage to the DM pin includes: after determining that the USB interface is connected to the main device end of the USB OTG line, outputting the basic voltage to the third resistor.
  • FIG. 1 is a schematic diagram of a reverse charging applicable to an embodiment of this application
  • FIG. 2 is a schematic diagram of the structure of an electronic device to which an embodiment of the application is applicable;
  • FIG. 3 is a schematic flow chart of a slave device identifying the USB interface of the master device
  • FIG. 4 is a schematic structural diagram of a pull-up circuit provided by an embodiment of the application.
  • FIG. 5 is a schematic structural diagram of a pull-up circuit provided by an embodiment of the application.
  • FIG. 6 is a schematic structural diagram of a pull-up circuit provided by an embodiment of the application.
  • FIG. 7 is a schematic flowchart of a reverse charging method provided by an embodiment of the application.
  • Coupled in the embodiments of this application refers to the energy transfer relationship.
  • the coupling of A and B means that energy can be transferred between A and B.
  • energy can be transferred between A and B.
  • specific forms of energy For example, electric energy, magnetic field potential energy, etc.
  • electric energy can be transferred between A and B, it is reflected in the circuit connection relationship, that is, A and B can be directly electrically connected, or indirectly electrically connected through other conductors or circuit elements.
  • access in the embodiment of this application refers to the realization of a coupling connection between the two interfaces, and the corresponding pins of the two interfaces are coupled one by one.
  • the specific coupling and connection methods are not limited.
  • the coupling connection may be insertion, docking, and so on. Taking insertion as an example, the interface 1 is connected to the interface 2. It can be that the interface 1 is inserted into the interface 2, or the interface 2 is inserted into the interface 1.
  • the USB OTG line 300 mainly includes an A terminal and a B terminal. Before performing reverse charging, the user can connect the A terminal of the USB OTG cable 300 to the USB interface 101 of the electronic device 100, and connect the B terminal of the USB OTG cable 300 to the USB interface 201 of the electronic device 200.
  • the electronic device 100 can output electric energy from the USB interface 101 to the A end of the USB OTG line, and the electric energy received by the A end of the USB OTG line is transmitted to the B end of the USB OTG line, and is input to the electronic device 200 through the USB interface 201.
  • the electronic device 200 can then use the power input from the USB interface 201 to operate or charge.
  • the shape of the USB OTG line 300 in the embodiment of the present application may be linear, or a non-linear shape such as a square or a circle, and the embodiment of the present application does not limit the shape of the USB OTG line 300.
  • the electronic device 100 is taken as an example to further describe the electronic device to which the embodiments of the present application are applied.
  • FIG. 2 exemplarily shows the structure of the electronic device to which the embodiment of the present application is applicable.
  • the electronic device may be an electronic device such as a smart phone or a tablet computer that supports reverse charging.
  • the electronic device 100 mainly includes a universal serial bus USB interface 101, a control circuit 102, a power management circuit 103, a battery 104, and a charging management circuit 106.
  • the electronic device 100 may include more or fewer components than those shown in FIG. 2, or combine certain components, or split certain components, or arrange different components.
  • the components shown in Figure 2 can be implemented in hardware, software or a combination of software and hardware.
  • the electronic device 100 may also include a central processing unit, an external memory interface, an internal memory, an antenna, a mobile communication module, a wireless communication module, an audio module, a speaker, a receiver, a microphone, a headphone jack, a sensor module, buttons, a motor, and an indicator , Camera, display, and subscriber identification module (SIM) card interface, etc.
  • SIM subscriber identification module
  • the sensor module may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
  • the control circuit 102 may include one or more processing units, which may be a central processing unit (CPU) of the electronic device 100 or a system on chip (SOC) of the electronic device 100.
  • the control circuit 102 may include an application processor (application processor, AP), a controller, a memory, a digital signal processor (digital signal processor, DSP), and so on.
  • the different processing units may be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 100.
  • the controller can generate control signals according to the instruction operation code and timing signals.
  • the controller in the control circuit 102 in the embodiment of the present application can generate a control signal, and the control circuit 102 can control the operation of the power management circuit 103 and the USB interface 101 through the control signal.
  • a memory can also be provided in the control circuit 102 for storing instructions and data.
  • the memory in the control circuit 102 is a cache memory.
  • the memory can store instructions or data that the control circuit 102 has just used or used cyclically. If the control circuit 102 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • control circuit 102 may include one or more interfaces.
  • the interface may include a control bus interface, a general-purpose input/output (GPIO) interface, and the like.
  • GPIO general-purpose input/output
  • control bus interface may be an integrated circuit (inter-integrated circuit, I2C) interface, a serial peripheral interface (serial peripheral interface, SPI), a system power management interface (system power management interface, SPMI), etc.
  • I2C integrated circuit
  • SPI serial peripheral interface
  • SPMI system power management interface
  • the control circuit 102 may couple the power management circuit 103 and the charging management circuit 106 through a control bus interface to realize the reverse charging function of the electronic device 100.
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal interface, can also be configured as a data signal interface, and can also be configured as a power supply interface.
  • the GPIO interface can be used to connect the control circuit 102 with other circuit structures in the electronic device 100, and the GPIO interface can be flexibly configured according to the type of the connected circuit structure.
  • the power management circuit 103 may be a power management unit (power management unit, PMU), and an integrated power management circuit (power management IC, PMIC).
  • the power management circuit 103 can receive electric energy provided by the battery 104 and/or the charging management circuit 106 to supply power to the control circuit 102 and other circuit structures in the electronic device.
  • the power management circuit 103 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management circuit 103 can also detect the voltage of each pin in the USB interface, and send a detection signal to the control circuit 102 when the voltage state of each pin changes.
  • the power management circuit 103 and the control circuit 102 may also be integrated in the same chip.
  • a charging management circuit (charger IC) 106 may receive charging power through the USB interface 101, and store the received charging power in the battery 104. While the charging management circuit 106 is charging the battery 104, it can also supply power to the power management circuit 103, so that the power management circuit 103 can simultaneously supply power to other circuit structures in the electronic device. When the electronic device is used as the main device in wireless charging, the control circuit 102 can control the charging management circuit 106 to output a charging voltage to the USB interface 101, and the charging voltage is generally 5V.
  • the USB interface 101 is an interface that complies with the USB standard specifications, and specifically can be a Micro USB interface, a USB Type C interface, and so on.
  • the USB interface 101 can be used to connect a charger to charge the electronic device 100, and can also be used to connect the electronic device 100 to the A terminal of the USB OTG cable 300, so that the electronic device 100 can charge other electronic devices.
  • the USB interface 101 mainly includes a ground (GND) pin, a trigger pin, a data positive (DP) pin, a data negative (DM) pin, and a power supply bus (VBUS) pin.
  • the DP pin can also be referred to as the D+ pin
  • the DM pin can also be referred to as the D- pin.
  • the trigger pin can trigger the control circuit 102 to determine that the USB interface 101 is connected to the main device end of the USB OTG line 300 (end A of the USB OTG line 300).
  • the trigger pin may be the identification (ID) pin of the Micro USB interface
  • the trigger pin may be control (CC) Pin.
  • the specific implementation of the trigger pin is determined by the specific type of the USB interface 101 and the specific identification logic inside the control circuit 102, which is not limited in the embodiment of the present application.
  • the embodiment of the present application uses the ID pin as the trigger pin in the following to exemplarily further illustrate the embodiment of the present application.
  • the GND pin is coupled with the ground circuit and is maintained at a zero potential state.
  • the ID pin is applied with a stable pull-up voltage by the power management circuit 103, and the voltage value of the pull-up voltage is generally 1.8V.
  • the VBUS pin is coupled with the power management circuit 103. During the charging process, the VBUS pin can receive the charging power input by the charger or other electronic devices, and provide the received charging power to the charging management circuit 106. During the reverse charging process, the VBUS pin can receive and output the electric energy provided by the charging management circuit 106.
  • the ID pin can be used to trigger the control circuit 102 to determine that the USB interface 101 is connected to the host device end of the USB OTG line 300 (end A of the USB OTG line 300). in particular:
  • Both ends A and B of the USB OTG line 300 can be understood as different types of USB interfaces.
  • the A end and the B end of the USB OTG line 300 respectively have pins adapted to the USB interface 101 of the electronic device 100.
  • the GND pin of the A end is coupled to the GND pin of the USB interface 101
  • the ID pin of the A end is coupled to the ID pin of the USB interface 101
  • the DP pin of the A terminal is coupled with the DP pin of the USB interface 101
  • the DM pin of the A terminal is coupled with the DM pin of the USB interface 101
  • the VBUS pin of the A terminal is coupled with the VBUS pin of the USB interface.
  • the B side so I won't repeat it here.
  • the difference between the A terminal and the B terminal of the USB OTG line 300 is that the ID pin of the A terminal is coupled with the ground circuit, while the ID pin of the B terminal is left floating.
  • end A of the USB OTG line 300 is connected to the USB interface 101 of the electronic device 100
  • the ID pin of the USB interface 101 is grounded through the ID pin of the end A of the USB OTG line 300, so the ID pin of the USB interface 101 The voltage is pulled down accordingly.
  • the voltage of the ID pin of the USB interface 101 is pulled down to be less than the first threshold voltage, it can be considered that the USB interface 101 is connected to the A terminal of the USB OTG line 300.
  • the USB interface 101 The voltage of the ID pin will be pulled down to 0V.
  • the ID pin of the USB interface 101 is coupled with the ID pin of the B end. Since the ID pin of the B terminal is suspended, the voltage of the ID pin of the USB interface 101 can still be maintained at 1.8V.
  • control circuit 102 in the embodiment of the present application can determine that the USB interface 101 is connected to the A terminal of the USB OTG line 300 through at least the following two possible implementation manners:
  • the power management circuit 103 can detect the voltage of the ID pin in the USB interface 101. When the voltage of the ID pin is detected to be pulled down, that is, after the voltage of the ID pin is detected to be lower than the first threshold voltage, the power management circuit 103 sends the first detection signal to the control circuit 102. Exemplarily, the power management circuit 103 may send a first detection signal to the control circuit 102 through the control bus, and the first detection signal may indicate to the control circuit 102 that the USB interface 101 is connected to the A terminal of the USB OTG line 300.
  • the control circuit 102 can determine according to the first detection signal that the USB interface 101 is connected to end A of the USB OTG line 300, and can then determine that the electronic device belongs to the main device, and continue to implement the battery charging specification (battery charging specification, BC) 1.2 protocol, complete the handshake with the slave device.
  • the battery charging specification battery charging specification, BC
  • the control circuit 102 is coupled with the ID pin, and the control circuit 102 can detect the voltage of the ID pin.
  • the control circuit 102 can determine that the USB interface 101 is connected to the A terminal of the USB OTG line 300, and the control circuit 102 can then determine that the electronic device belongs to as the master device, and continue to execute the 1.2 protocol to complete the handshake with the slave device.
  • the electronic device 100 is connected to end A of the USB OTG line 300, so the electronic device 100 is the master device, and the electronic device 200 is connected to the end B of the USB OTG line 300, so the electronic device 200 is the slave equipment.
  • the electronic device 200 includes a USB interface 201, a control circuit 202, a power management circuit 203, and a battery 204.
  • the connection relationship between the various circuit structures can be referred to as shown in FIG. 2. As shown, this embodiment of the present application will not illustrate this with illustrations.
  • the embodiment of the present application uses GND pin 1, ID pin 1, DP pin 1, DM pin 1, and VBUS pin 1 to represent the pins in the USB interface 101, and uses GND pin 2, ID pin 2, DP pin 2, DM pin 2, and VBUS pin 2 represent pins in the USB interface 201.
  • the control circuit 102 can send a first control signal to the charging management circuit 106 after determining that the USB interface 101 is connected to the USB OTG line 300 end A, and the charging management circuit 106 receives the first control signal, The charging voltage is output to the VBUS pin 1 of the USB interface 101.
  • the VBUS pin 2 of the USB interface 201 is coupled to the VBUS pin 1 of the USB interface 101 through the USB OTG line 300. Therefore, after the charging management circuit 106 outputs the charging voltage to the VBUS pin 1, the VBUS The voltage of pin 2 is pulled up accordingly.
  • the power management circuit 203 can detect the voltage of the VBUS pin 2. When it is detected that the voltage of the VBUS pin 2 is pulled up, that is, after the voltage of the VBUS pin 2 is greater than the second threshold voltage, The second detection signal may be sent to the control circuit 202.
  • the power management circuit 203 may send a second detection signal to the control circuit 202 through the control bus, and the second detection signal may indicate to the control circuit 202 that the USB interface 202 is connected to the USB interface.
  • the control circuit 202 can determine that the USB interface 202 is connected to the USB interface according to the second detection signal.
  • the control circuit 202 can then determine that the electronic device belongs to is a slave device, and continue to execute the 1.2 protocol to communicate with the master. The device completes the handshake.
  • control circuit 202 is coupled to the VBUS pin 2.
  • the control circuit 202 can detect the voltage of the VBUS pin 2. When it is detected that the voltage of the VBUS pin 2 is pulled up, that is, after the voltage of the VBUS pin 2 is greater than the second threshold voltage, the control circuit 202 can determine whether the USB interface 202 is connected. After entering the USB interface, the control circuit 202 can then determine that the electronic device belongs to is a slave device, and continue to execute the BC 1.2 protocol to complete the handshake with the master device.
  • the B end of the USB OTG line 300 is similar to a conventional USB interface, that is to say, after the B end of the USB OTG line 300 is connected to the electronic device 200, the control circuit 202 can only recognize that it is connected to the USB interface 201 For other USB interfaces, the electronic device to which the control circuit 202 belongs is a slave device by default, and the control circuit 202 does not identify which device's USB interface is connected to the USB interface 201. In other words, during the period when the electronic device 200 is a slave device, it can receive power through the USB OTG line 300 or through other USB data lines, which is similar to the application scenario of the USB interface in the existing electronic equipment. No longer.
  • the handshake process based on the BC 1.2 protocol is mainly through the DP pin 1 and DM pin 1 in the USB interface 101, and the DP pin 2 and DM pin 2 in the USB interface 201 Achieved.
  • the electronic device 200 can recognize the type of the USB interface 101 of the electronic device 100.
  • USB ports of most electronic devices (such as smart phones and tablet computers) are SDP ports.
  • SDP protocol specifies a maximum charging current of 500 mA, so the SDP port cannot be used for high-current charging.
  • the DCP port can provide greater charging current.
  • the DCP port is used for special chargers such as wall charging.
  • the CDP port also supports high-current charging, but the CDP port is mainly used as a port for computers, hubs (HUB) and other devices, and has not yet been widely used.
  • the interface type of the B end of the USB OTG line 300 is equivalent to the interface type of the USB interface 101.
  • the USB OTG line 300 does not change the interface type of the USB interface 101, and the electronic device 200 can recognize the interface type of the USB interface 101 through the USB OTG line 300.
  • the embodiment of the present application directly identifies the interface type of the USB interface 101 as an overview.
  • FIG. 3 the process of identifying the USB interface 101 by the electronic device 200 will be further described. As shown in Figure 3, it mainly includes the following steps:
  • the control circuit 202 turns on the DP voltage source and the DM current source in the power management circuit 203.
  • the power management circuit 203 includes a DP current source, a DP voltage source, a DM current source, and a DM voltage source.
  • the DP current source can limit the current transmitted by the DP pin 2 to not exceed the DP threshold current
  • the DP voltage source can output a constant DP voltage to the DP pin 2
  • the DM current source can limit the current transmitted by the DM pin 2 to not exceed the DM Threshold current
  • DM voltage source can output a constant DM voltage to DM pin 2.
  • both the DP voltage and the DM voltage are 0.6V.
  • the control circuit 202 can send a control command to the power management circuit 203 through the control bus with the power management circuit 203, so as to turn on the DP voltage source and the DM current source in the power management circuit 203. It can be understood that during S301, the DM voltage source and the DP current source are turned off by default.
  • the control circuit 202 detects the voltage of the DM pin 2. As shown in FIG. 2, the control circuit 202 is coupled to the DP pin 2 and the DM pin 2, and the control circuit 202 can directly detect the voltage of the DP pin 2 and the DM pin 2.
  • S303 If the voltage of the DM pin 2 is less than the fourth threshold voltage, execute S305 to determine that the USB interface 101 is an SDP port; otherwise, execute S304.
  • the fourth threshold voltage is not greater than the output voltages of the DP voltage source and the DM voltage source, and generally the fourth threshold voltage may be 0.35V.
  • the DP pin 1 of the SDP port (USB interface 101) is coupled to the ground circuit through a pull-down resistor RP, and the DM pin 1 is coupled to the ground circuit through a pull-down resistor RM.
  • Discontinuous circuit When the power management circuit 203 applies the DP voltage to the DP pin 2, the voltage of the DP pin 1 is pulled up accordingly. However, due to the open circuit between DP pin 1 and DM pin 1, DM pin 1 is still in a pull-down state, and the voltage of DM pin 2 will not be pulled up (generally, the voltage of DM pin 2 will remain at 0V) , So that the control circuit 202 can detect that the voltage of the DM pin 2 is less than the fourth threshold voltage.
  • the DP pin 1 and the DM pin 1 are short-circuited.
  • the power management circuit 203 applies the DP voltage to the DP pin 2, the voltage of the DP pin 1 is pulled up accordingly.
  • the voltage of DM pin 1 is pulled up accordingly, and the voltage of DM pin 2 is pulled up accordingly, so the control circuit 202 can detect the DM pin The voltage of 2 is not less than the fourth threshold voltage.
  • the power management circuit 103 can detect the voltage of the DP pin 1.
  • the power management circuit 203 applies the DP voltage to the DP pin 2, the voltage of the DP pin 1 is pulled up accordingly.
  • the power management circuit 103 detects that the voltage of the DP pin 1 is greater than the reference voltage, the power management circuit 1 will turn on the DM voltage source to apply the DM voltage to the DM pin 1, and the voltage of the DM pin 2 will be pulled up accordingly.
  • the control circuit 202 can detect that the voltage of the DM pin 2 is not less than the fourth threshold voltage.
  • the control circuit 202 can detect that the voltage of the DM pin 2 is less than the fourth threshold voltage after the DP voltage source and the DM current source in the power management circuit 203 are turned on. Therefore, in S303, if the voltage of the DM pin 2 is less than the fourth threshold voltage, it can be determined that the USB interface 101 is an SDP port.
  • the control circuit 202 will detect that the voltage of the DM pin 2 is not less than the fourth threshold voltage . Therefore, in S303, if the voltage of the DM pin 2 is not less than the fourth voltage threshold, S304 needs to be continued to further determine whether the USB interface 101 is a CDP port or a DCP port.
  • the control circuit 202 turns on the DM voltage source and the DP current source in the power management circuit 203. It can be understood that it also includes turning off the DP voltage source and the DM current source in the power management circuit 203.
  • the control circuit 202 detects the voltage of the DP pin 2.
  • the DP pin 1 and the DM pin 1 are short-circuited. Therefore, when the power management circuit 203 applies the DM voltage to the DM pin 2, the DP pin 1, DM pin 1 And the voltage of DP pin 2 is pulled up accordingly, so that the control circuit 202 can detect that the voltage of DP pin 2 is not less than the fifth threshold voltage.
  • the fifth threshold voltage can be the same as the fourth threshold voltage. The same, for example, both are 0.35V.
  • the DM pin 1 is grounded through the pull-down resistor RM, the DP pin 1 is grounded through the pull-down resistor RP, and the DM pin 1 and the DP pin 1 are open to each other. Therefore, when the power management circuit 203 applies the DM voltage to the DM pin 2, the voltages of the DP pin 1 and the DP pin 2 will not be pulled up accordingly, so that the control circuit 202 can detect the voltage of the DP pin 2.
  • the voltage is less than the fifth threshold voltage.
  • the USB interface 101 has been excluded as an SDP port, after the DM voltage source and the DP current source in the power management circuit 203 are turned on, if the voltage of the DP pin 2 is less than the fifth threshold voltage, it indicates that the USB interface 101 is For the CDP interface, if the voltage of the DP pin 2 is not less than the fifth threshold voltage, it indicates that the USB interface 101 is a DCP interface.
  • the USB interface is an SDP port. Therefore, when the slave device executes S303, it generally recognizes the USB interface of the master device as an SDP port, and then charges according to the SDP protocol.
  • the SDP protocol stipulates that the charging current cannot exceed 500mA, which makes the current reverse charging speed slow.
  • the embodiment of this application improves the master device (electronic device 100).
  • the slave device By adding a pull-up circuit 105 in the electronic device 100, the slave device (electronic device 200) can connect the electronic device to the electronic device according to the BC1.2 protocol.
  • the USB interface 101 of 100 is identified as a CDP port, and the CDP protocol stipulates that the charging current can be 1.5-5A. Therefore, the technical solution provided by the embodiment of the present application is beneficial to achieve a large current reverse charging current, which is beneficial to improve The speed of reverse charging.
  • the electronic device 100 further includes a pull-up circuit 105.
  • the control terminal of the pull-up circuit 105 is coupled with the control circuit 102, and the output terminal of the pull-up circuit 105 is coupled with the power management circuit 103.
  • the control circuit 102 may control the pull-up circuit 105 to provide the first voltage to the DM pin after determining that it is connected to the A terminal of the USB OTG line 300.
  • the first voltage may be 0.6V in this application.
  • the pull-up circuit 105 can be provided in the electronic device 100 as an independent circuit structure, for example, fabricated on the main board of the electronic device 100.
  • the pull-up circuit 105 can also be integrated with the control circuit 101 in the same chip, which is not limited in the embodiment of the present application.
  • control circuit 102 can control the pull-up circuit 105 to output the first voltage to the DP pin 1 through at least any one of the following three possible implementation manners:
  • control circuit 102 may immediately control the pull-up circuit 105 to provide the first voltage to the DM pin after determining that the USB interface 101 is connected to the A terminal of the USB OTG line 300.
  • the control circuit 102 may detect the voltage of the DP pin 1 of the USB interface 101 after determining that the USB interface 101 is connected to the A terminal of the USB OTG line 300.
  • the control circuit 202 executes S301 to turn on the DP voltage source in the power management circuit 203, the DP pin 2 is applied with the DP voltage, and the voltage of the DP pin 1 will also be pulled up accordingly.
  • the control circuit 102 can detect that the voltage of the DP pin 1 is greater than the third threshold voltage.
  • the control circuit 102 may turn on the pull-up circuit 105 after detecting that the voltage of the DP pin 1 is greater than the third threshold voltage.
  • the control circuit 202 can still detect that the voltage of the DM pin 2 is pulled up, and continues to execute S304.
  • control circuit 102 controls the charging management circuit 106 to output the charging voltage to the VBUS pin 1 of the USB interface 101 after the first time delay reaches the first time delay, turning on the electronic device 100 for performing BC1. 2 protocol DP comparator.
  • the electronic device 200 can recognize that an external USB interface is connected to the USB interface 201.
  • the first delay is related to the performance of the electronic device 200, and the first delay can be obtained by means of experiment, statistics, estimation, etc. The embodiments of the application do not limit this.
  • the DP comparator may be located in the power management circuit 103 or the charging management circuit 106, which is not limited in the embodiment of the present application.
  • the first input terminal of the DP comparator is coupled with the DP pin, the second input terminal of the DP comparator is maintained at the third threshold voltage, the output terminal of the DP comparator is coupled with the control circuit 102, and the DP comparator can be connected to the DP pin 1.
  • a third detection signal is sent to the control circuit 102.
  • the DP comparator may send a third detection signal to the control circuit 102 through the control bus, and the third detection signal may indicate to the control circuit 102 that the voltage of the DP pin 1 is pulled up.
  • the control circuit 102 receives the third detection signal provided by the DP comparator, it can determine that the voltage of the DP pin 1 is pulled up according to the third detection signal.
  • the control circuit 102 can further control the pull-up circuit 105 to provide the first voltage to the DM pin 1. After the time that the pull-up circuit 105 continues to provide the first voltage to the DM pin 1 reaches the second time delay, the control circuit 102 controls the pull-up circuit 105 to stop providing the first voltage to the DM pin 1.
  • the electronic device 200 can complete the steps of detecting the voltage of the DM pin 2 and turning on the DM voltage source and the DP current source.
  • the second time delay in the embodiment of the present application is not less than 40 ms.
  • the control circuit 102 can control the pull-up circuit 105 to stop supplying the first voltage to the DM pin 1.
  • the control circuit 202 will detect that the voltage of the DM pin 2 of the USB interface 201 is not less than the fourth threshold Voltage, and then continue to execute S304. This prevents the electronic device 200 from recognizing the USB interface 101 as an SDP port.
  • the USB interface 101 may actually be an SDP port, as shown in FIG. 2. Therefore, when the electronic device 200 executes S307, after the DM voltage source and the DP current source in the power management circuit 203 are turned on, the voltages of the DP pin 1 and the DP pin 2 will not be pulled up accordingly, so the control circuit 202 It can be detected that the voltage of the DP pin 2 is less than the fifth threshold voltage, so that the electronic device 200 can recognize the SDP port (USB interface 101) as a CDP port.
  • the electronic device 200 can enumerate and charge the electronic device 100 according to the CDP protocol. Since the CDP protocol stipulates that the charging current can reach 1.5 to 5A, the electronic device 100 can use a larger charging current (up to 5A) Reverse charging is helpful to increase the speed of reverse charging.
  • the electronic device 200 after the electronic device 200 determines that the USB interface 101 of the electronic device 100 is a CDP port, it can also turn on the DP voltage source in the power management circuit 203 to apply the DP pin 2 of the USB interface 201 DP voltage.
  • the DP pin 1 in the USB interface 101 is pulled up accordingly.
  • the control circuit 101 may also detect the voltage of the DP pin 1 after determining that the USB interface 101 is connected to the A terminal of the USB OTG line 300. When the voltage of the DP pin 1 is greater than the third threshold voltage for the first time, it means that the control circuit 202 is performing S301.
  • the control circuit 202 When the voltage of the DP pin 1 is greater than the third threshold voltage for the second time, it means that the control circuit 202 has completed identifying the USB interface 101. type. The control circuit 102 can then continue to perform the enumeration process and the reverse charging process after the enumeration process.
  • the third threshold voltage and the fourth threshold voltage have the same value, for example, both can be 0.35V.
  • the specific implementation of the enumeration process and the reverse charging process can refer to the existing protocol provisions, which will not be repeated.
  • the embodiments of the present application provide an electronic device.
  • a pull-up voltage is applied to the DM pin of the USB interface of the master device, so that the slave device recognizes the USB interface of the master device. It is a CDP interface to increase the speed of reverse charging.
  • the pull-up circuit 105 has at least the following two possible implementation manners:
  • FIG. 4 exemplarily shows one of the implementation structures of the pull-up circuit 105 in the embodiment of the present application.
  • the pull-up circuit 105 includes a first switch S1 and a first resistor R1.
  • the control electrode of the first switch tube S1 is coupled with the control circuit 102
  • the first electrode of the first switch tube S1 is coupled with one end of the first resistor R1
  • the second electrode of the first switch tube S1 is coupled with the DM pin 1.
  • the other end of the first resistor R1 is used to receive the basic voltage.
  • the base voltage can be a voltage provided to conventional components in an electronic device, and is generally 1.8V.
  • the control circuit 102 may provide the basic voltage for the pull-up circuit 105
  • the power management circuit 103 may provide the basic voltage for the pull-up circuit 105. This is not too restrictive.
  • the pull-up circuit 105 in the embodiment of the present application can divide the basic voltage to obtain the first voltage, so that the first voltage applied to the DM pin 1 The voltage approaches the DM voltage output by the DM voltage source.
  • one GPIO port in the control circuit 102 may be configured as a control port, and the first switch S1 is controlled to be turned on or off through the GPIO port, thereby controlling the operation of the pull-up circuit 105.
  • the first switch S1 can be either a bipolar transistor as shown in FIG. 4 or a field effect transistor as shown in FIG. 5, which is not limited in the embodiment of the present application.
  • the control circuit 102 can turn on the first switch S1.
  • the first resistor R1, the first switch S1, and the grounding resistance RM of the DM pin 1 form a voltage divider circuit.
  • the first One voltage After the basic voltage is divided by the first resistor R1 and the grounding resistor RM, the first One voltage.
  • the first voltage satisfies the following formula 1:
  • V 1 is the voltage value of the first voltage
  • r1 is the resistance value of the first resistor R1
  • rM is the resistance value of the grounding resistor RM
  • V 0 is the voltage value of the base voltage
  • the control circuit 102 turns off the first switch S1, and can control the pull-up circuit 105 to stop applying the first voltage to the DM pin.
  • the pull-up circuit 105 may further include a second resistor R2. As shown in FIG. 4, one end of the second resistor R2 is coupled with the control circuit 102, and the other end of the second resistor R2 is coupled with the control electrode of the first switch S1.
  • the first switch S1 is a bipolar transistor
  • the second resistor R2 can reduce the current input to the control electrode (base) of the first switch S1, and the resistance of the first resistor R1 can be determined by the base current , Which makes the configuration of the first resistor R1 more convenient.
  • the current passing through the first resistor R1 can be obtained as 2 mA.
  • the base voltage is 1.8V
  • the first voltage is 0.6V
  • the current of the control electrode is 1mA
  • the voltage drop between the first electrode and the second electrode in the first switch S1 is 0.3V
  • the first resistance can be calculated R1 needs to generate a 0.9V voltage drop
  • the resistance of the first resistor R1 should be configured to be 150 ⁇ .
  • FIG. 6 exemplarily shows another implementation structure of the pull-up circuit 105 in the embodiment of the present application.
  • the pull-up circuit 105 includes a third resistor R3, one end of the third resistor R3 is coupled to the control circuit 102, and the other end of the third resistor R3 is coupled to the DM pin 1.
  • the control circuit 102 After receiving the first detection signal, the control circuit 102 outputs the basic voltage to the third resistor R3. After the control circuit 102 stops outputting the basic voltage to the third resistor R3, the third resistor R3 stops applying the first voltage to the DP pin 1.
  • the third resistor R3 and the ground resistor RM of the DM pin 1 can form a voltage divider circuit.
  • the control circuit 102 outputs the basic voltage to the third resistor R3, the basic voltage passes through the third resistor R3 and the ground resistor RM. After the voltage is divided, the first voltage is obtained, and the first voltage satisfies the above formula 1, which will not be repeated here.
  • the embodiment of the present application adds a pull-up circuit to the master device, and the pull-up circuit can apply the first voltage to the DM pin of the master device, so that the slave device can recognize the USB interface of the master device as a CDP port.
  • the pull-up circuit has a simple structure, is easy to implement, and is compatible with the existing USB 2.0 protocol and BC 1.2 protocol.
  • FIG. 7 exemplarily shows a schematic flowchart of a reverse charging method provided by an embodiment of the present application. As shown in FIG. 7, it mainly includes:
  • control circuit 102 can determine whether the USB interface 101 is connected to the main device end of the USB OTG line 300 by at least the following two methods:
  • the electronic device further includes a power management circuit 103, which is coupled to the trigger pin of the USB interface 101 of the electronic device; the power management circuit 103 can detect that the voltage of the trigger pin is low. After the first threshold voltage, the first detection signal is sent to the control circuit 102; the control circuit 102 may determine that the USB interface 101 is connected to the host device end of the USB OTG line 300 after receiving the first detection signal.
  • the trigger pin of the USB interface 101 is determined by the specific type of the USB interface 101.
  • the trigger pin in the Micro USB interface may be an ID pin
  • the trigger pin in the USB Type-C interface may be a CC pin.
  • control circuit 102 is also coupled with the trigger pin of the USB interface 101; the control circuit 102 may also determine that the USB interface 101 is connected after detecting that the voltage of the trigger pin is lower than the first threshold voltage. Enter the main device end of the USB OTG line 300.
  • the electronic device further includes a charging management circuit 106, which is coupled to the VBUS pin of the USB interface 101; the control circuit 102 may also determine whether the USB interface 101 is connected to the USB OTG line 300 After the host device, the charging management circuit 106 is controlled to output the charging voltage to the VBUS pin of the USB interface 101.
  • control circuit 102 can more accurately control the time when the pull-up circuit 105 outputs the first voltage in at least the following two ways:
  • control circuit 102 may start the DP comparison for executing the BC1.2 protocol after the time for controlling the charging management circuit 106 to output the charging voltage to the VBUS pin of the USB interface 101 reaches the first time delay. ⁇ : After receiving the third detection signal provided by the DP comparator, then control the pull-up circuit 105 to provide the first voltage to the DM pin.
  • control circuit 102 may detect the voltage of the digital positive DP pin of the USB interface 101 after determining that the USB interface 101 is connected to the main device end of the USB OTG line 300; after detecting the DP pin After the voltage of is greater than the third threshold voltage, the pull-up circuit 105 is controlled to provide the first voltage to the DM pin.
  • the pull-up circuit 105 includes a first switch tube and a first resistor; wherein, the control electrode of the first switch tube is coupled to the control circuit 102, and the first electrode of the first switch tube is coupled to the first resistor.
  • the second electrode of the first switch tube is coupled to the DM pin, and the other end of the first resistor is used to receive the basic voltage; the control circuit 102 can determine that the USB interface 101 is connected to the main device end of the USB OTG line 300 , Turn on the first switch tube.
  • the pull-up circuit 105 may further include a second resistor, one end of the second resistor is coupled to the control circuit 102, and the other end of the second resistor is coupled to the control electrode of the first switch tube.
  • the above-mentioned first switch tube may be a bipolar transistor or a field effect transistor.
  • the above-mentioned basic voltage may be the voltage provided by the control circuit 102 or the power management circuit 103 for the pull-up circuit 105.
  • the pull-up circuit 105 includes a third resistor; one end of the third resistor is coupled to the control circuit 102, and the other end of the third resistor is coupled to the DM pin; the control circuit 102 can determine the USB After the interface 101 is connected to the main device end of the USB OTG line 300, it outputs the basic voltage to the third resistor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Manufacturing & Machinery (AREA)
  • Chemical & Material Sciences (AREA)
  • Chemical Kinetics & Catalysis (AREA)
  • Electrochemistry (AREA)
  • General Chemical & Material Sciences (AREA)
  • Power Engineering (AREA)
  • Power Sources (AREA)

Abstract

Provided are an electronic device and a reverse charging method. The electronic device may be a terminal device that supports a reverse charging function. A pull-up circuit is integrated on the electronic device provided in the embodiments of the present application, such that the electronic device can provide a first voltage to a DM pin of a USB interface after accessing a master device end of a USB OTG line, so that a slave device can identify a USB interface of the electronic device as a CDP. Therefore, the electronic device provided in the embodiments of the present application can provide a relatively large charging current for the slave device on the basis of a CDP protocol.

Description

一种电子设备及反向充电方法Electronic equipment and reverse charging method
相关申请的交叉引用Cross-references to related applications
本申请要求在2019年10月31日提交中国专利局、申请号为201911054726.2、申请名称为“一种电子设备及反向充电方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on October 31, 2019, the application number is 201911054726.2, and the application name is "an electronic device and reverse charging method", the entire content of which is incorporated herein by reference Applying.
技术领域Technical field
本申请涉及反向充电技术领域,尤其涉及一种电子设备及反向充电方法。This application relates to the field of reverse charging technology, and in particular to an electronic device and a reverse charging method.
背景技术Background technique
随着电子市场的发展,越来越多的电子设备具备了反向充电功能。对于具备反向充电功能的电子设备(例如手机),其可以通过通用串行总线(universal serial bus,USB)活动式(on the go,OTG)线为另一个电子设备(例如平板电脑)充电。其中,提供充电的电子设备可以作为主设备(host),被充电的电子设备可以作为从设备(device)。With the development of the electronic market, more and more electronic devices are equipped with a reverse charging function. For an electronic device (such as a mobile phone) with a reverse charging function, it can charge another electronic device (such as a tablet computer) via a universal serial bus (USB) movable (on the go, OTG) cable. Among them, the electronic device that provides charging can be used as a host device, and the electronic device that is charged can be used as a slave device (device).
具体来说,在目前的OTG充电过程中,USB OTG线包括主设备端(A端)和从设备端(B端)。USB OTG线的A端与主设备的USB接口连接,USB OTG线的B端与从设备的USB接口连接。主设备在确定接入USB OTG线的A端后,可以通过USB OTG线向从设备提供充电电能。从设备在确定接入USB OTG线的B端后,可以通过USB OTG线,将主设备的USB接口识别为标准下行端口(standard downstream port,SDP),从而基于SDP协议,接收主设备提供的充电电能。Specifically, in the current OTG charging process, the USB OTG cable includes a master device end (end A) and a slave device end (end B). The A end of the USB OTG line is connected to the USB interface of the master device, and the B end of the USB OTG line is connected to the USB interface of the slave device. After the master device determines that it is connected to end A of the USB OTG line, it can provide charging power to the slave device through the USB OTG line. After the slave device determines to connect to the B end of the USB OTG line, it can recognize the USB interface of the master device as a standard downstream port (SDP) through the USB OTG line, and then receive the charging provided by the master device based on the SDP protocol Electrical energy.
然而,在SDP协议中规定了充电电流的最大值为500mA,因此从设备会将充电电流限制在500mA之内,致使反向充电速度较低。因此,现有的反向充电技术还有待进一步研究。However, the SDP protocol stipulates that the maximum charging current is 500mA, so the slave device will limit the charging current to 500mA, resulting in a lower reverse charging speed. Therefore, the existing reverse charging technology needs to be further studied.
发明内容Summary of the invention
有鉴于此,本申请提供一种电子设备及反向充电方法,在电子设备中集成上拉电路,使得电子设备可以在接入USB OTG线的主设备端后,通过向USB接口的DM引脚提供第一电压,使得从设备可以将该电子设备的USB接口识别为CDP端口。进而可以基于CDP协议,实现大电流反向充电。In view of this, this application provides an electronic device and a reverse charging method that integrates a pull-up circuit in the electronic device, so that the electronic device can connect to the main device end of the USB OTG line through the DM pin of the USB interface The first voltage is provided so that the slave device can recognize the USB interface of the electronic device as a CDP port. Furthermore, it can realize high-current reverse charging based on the CDP protocol.
第一方面,本申请实施例提供一种电子设备,该电子设备包括:通用串行总线USB接口、上拉电路和控制电路;其中,该USB接口为标准下行端口SDP,电子设备中上拉电路分别与USB接口的数字负DM引脚和控制电路耦合;控制电路用于:在确定USB接口接入USB活动式OTG线的主设备端后,控制上拉电路向所述DM引脚提供第一电压,第一电压用于指示USB接口为充电下行端口CDP。In the first aspect, an embodiment of the present application provides an electronic device, which includes: a universal serial bus USB interface, a pull-up circuit, and a control circuit; wherein the USB interface is a standard downstream port SDP, and the pull-up circuit in the electronic device They are respectively coupled with the digital negative DM pin of the USB interface and the control circuit; the control circuit is used to control the pull-up circuit to provide the first DM pin to the DM pin after determining that the USB interface is connected to the main device end of the USB movable OTG line Voltage, the first voltage is used to indicate that the USB interface is a charging downstream port CDP.
主设备和从设备通过USB OTG线连接后,主设备的USB接口的DM引脚可以通过USB OTG线,与从设备的USB接口的DM引脚耦合,主设备的USB接口的DP引脚可以通过USB OTG线,与从设备的USB接口的DP引脚耦合。从设备可以执行BC1.2协议, 通过其USB接口的DM引脚的电压变化和DP引脚的电压变化,识别出主设备的USB接口的类型。具体来说,从设备会向其USB接口中DP引脚施加DP电压,若其USB接口中DM引脚的电压未被随之上拉,则从设备可以确定主设备的USB接口为SDP接口。反之,若从设备的USB接口中DM引脚的电压被随之上拉,则从设备会转而向DM引脚施加DM电压,若其DP引脚的电压被随之上拉,则从设备可以确定主设备的USB接口为DCP端口,反之,若从设备的USB接口中的DP引脚未被随之上拉,则从设备可以确定主设备的USB接口为CDP端口。After the master device and the slave device are connected through the USB OTG line, the DM pin of the USB interface of the master device can be coupled with the DM pin of the USB interface of the slave device through the USB OTG line, and the DP pin of the USB interface of the master device can pass through The USB OTG line is coupled with the DP pin of the USB interface of the slave device. The slave device can execute the BC1.2 protocol, and identify the type of the USB interface of the master device through the voltage change of the DM pin of the USB interface and the voltage change of the DP pin. Specifically, the slave device will apply the DP voltage to the DP pin of its USB interface. If the voltage of the DM pin of its USB interface is not pulled up accordingly, the slave device can determine that the USB interface of the master device is an SDP interface. Conversely, if the voltage of the DM pin in the USB interface of the slave device is pulled up, the slave device will apply the DM voltage to the DM pin. If the voltage of the DP pin is pulled up, the slave device It can be determined that the USB interface of the master device is a DCP port. On the contrary, if the DP pin in the USB interface of the slave device is not pulled up accordingly, the slave device can determine that the USB interface of the master device is a CDP port.
在本申请实施例中,控制电路在确定接入USB OTG线的主设备端后,控制上拉电路向DM引脚提供第一电压。USB OTG线的从设备端连接从设备的USB接口,由于主设备的DM引脚被施加了第一电压,因此从设备的DM引脚的电压被随之上拉。进而使得,从设备在识别主设备的USB接口时,在为DP引脚施加DP电压后,从设备可以检测到其USB接口的DM引脚的电压被上拉,因此从设备不会将主设备的USB接口识别为SDP端口。从设备转而向DM引脚施加DM电压,由于电子设备的USB接口实际上为SDP端口,因此从设备的DP引脚的电压并不会被随之上拉,从而使得从设备可以将主设备的USB接口识别为CDP端口,进而可以基于CDP协议实现大电流反向充电。In the embodiment of the present application, after determining the main device terminal connected to the USB OTG line, the control circuit controls the pull-up circuit to provide the first voltage to the DM pin. The slave device end of the USB OTG line is connected to the USB interface of the slave device. Since the DM pin of the master device is applied with the first voltage, the voltage of the DM pin of the slave device is pulled up accordingly. Furthermore, when the slave device recognizes the USB interface of the master device, after applying the DP voltage to the DP pin, the slave device can detect that the voltage of the DM pin of its USB interface is pulled up, so the slave device will not transfer the master device The USB interface is recognized as an SDP port. The slave device instead applies the DM voltage to the DM pin. Since the USB interface of the electronic device is actually an SDP port, the voltage of the DP pin of the slave device will not be pulled up accordingly, so that the slave device can connect the master device The USB interface is recognized as a CDP port, and then large current reverse charging can be realized based on the CDP protocol.
在本申请实施例中,控制电路至少可以通过以下两种方式确定USB接口是否接入USB OTG线的主设备端:In the embodiment of the present application, the control circuit can determine whether the USB interface is connected to the main device end of the USB OTG line at least in the following two ways:
在一种可能的实现方式中,电子设备还包括电源管理电路,该电源管理电路与电子设备的USB接口的触发引脚耦合;电源管理电路可以在检测到触发引脚的电压低于第一阈值电压后,向控制电路发送第一检测信号;控制电路可以在接收到所述第一检测信号后,确定所述USB接口接入USB OTG线的主设备端。In a possible implementation manner, the electronic device further includes a power management circuit coupled to the trigger pin of the USB interface of the electronic device; the power management circuit can detect that the voltage of the trigger pin is lower than the first threshold After the voltage is applied, the first detection signal is sent to the control circuit; after receiving the first detection signal, the control circuit may determine that the USB interface is connected to the main device end of the USB OTG line.
其中,USB接口的触发引脚由USB接口的具体类型决定。例如,USB 2.0接口中该触发引脚可以是标识(ID)引脚,又例如USB Type-C接口中该触发引脚可以是配置通道(configuration channel,CC)引脚。Among them, the trigger pin of the USB interface is determined by the specific type of the USB interface. For example, the trigger pin in the USB 2.0 interface may be an identification (ID) pin, and for example, the trigger pin in the USB Type-C interface may be a configuration channel (configuration channel, CC) pin.
在另一种可能的实现方式中,控制电路还与USB接口的触发引脚耦合;控制电路还可以在检测到触发引脚的电压低于第一阈值电压后,确定USB接口接入USB OTG线的主设备端。In another possible implementation, the control circuit is also coupled with the trigger pin of the USB interface; the control circuit can also determine that the USB interface is connected to the USB OTG line after detecting that the voltage of the trigger pin is lower than the first threshold voltage The main equipment side.
在一种可能的实现方式中,电子设备还包括充电管理电路,该充电管理电路与USB接口的VBUS引脚耦合;控制电路还可以在确定USB接口接入USB OTG线的主设备端后,控制充电管理电路向USB接口的VBUS引脚输出充电电压。控制充电管理电路向USB接口的VBUS引脚输出充电电压,可以使从设备的VBUS引脚的电压被随之上拉,使从设备识别到接入了USB OTG线的从设备端。In a possible implementation manner, the electronic device further includes a charging management circuit, which is coupled to the VBUS pin of the USB interface; the control circuit can also control the USB port after it is connected to the main device end of the USB OTG line The charging management circuit outputs the charging voltage to the VBUS pin of the USB interface. Controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface can cause the voltage of the VBUS pin of the slave device to be pulled up accordingly, so that the slave device can recognize the slave device connected to the USB OTG line.
在本申请实施例中,控制电路至少可以通过以下两种方式更为精确地控制上拉电路输出第一电压的时间:In the embodiment of the present application, the control circuit can more accurately control the time when the pull-up circuit outputs the first voltage in at least the following two ways:
在一种可能的实现方式中,控制电路可以在控制充电管理电路向USB接口的VBUS引脚输出充电电压的时间达到第一时延之后,开启用于执行BC1.2协议的DP比较器;在接收到DP比较器提供的第三检测信号后,再控制上拉电路向所述DM引脚提供第一电压。In a possible implementation manner, the control circuit may turn on the DP comparator for executing the BC1.2 protocol after the time for controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface reaches the first time delay; After receiving the third detection signal provided by the DP comparator, the pull-up circuit is controlled to provide the first voltage to the DM pin.
具体来说,从设备在识别主设备USB接口的类型的过程中,会为从设备的DP引脚施加DP电压,通过从设备的DM引脚的电压变化识别主设备的USB接口的类型。在本申请实施例中,控制电路在接收到DP比较器提供的第三检测信号后,说明电子设备(主设备) 的DP引脚的电压被上拉,此时开启上拉电路,为主设备的DM引脚提供第一电压,使得从设备可以检测到从设备的DM引脚的电压被上拉,不仅可以避免从设备将主设备的USB接口识别为SDP端口,还可以更精确地控制上拉电路输出第一电压的时间。Specifically, in the process of identifying the type of the USB interface of the master device, the slave device applies a DP voltage to the DP pin of the slave device, and identifies the type of the USB interface of the master device through the voltage change of the DM pin of the slave device. In the embodiment of the present application, after the control circuit receives the third detection signal provided by the DP comparator, it indicates that the voltage of the DP pin of the electronic device (master device) is pulled up. At this time, the pull-up circuit is turned on to become the master device. The DM pin provides the first voltage, so that the slave device can detect that the voltage of the DM pin of the slave device is pulled up, which can not only prevent the slave device from recognizing the USB interface of the master device as an SDP port, but also can control it more accurately. The time for the pull circuit to output the first voltage.
在另一种可能的实现方式中,控制电路可以在确定USB接口接入USB OTG线的主设备端后,检测USB接口的数字正DP引脚的电压;在检测到DP引脚的电压大于第三阈值电压后,控制上拉电路向所述DM引脚提供第一电压。In another possible implementation, the control circuit can detect the voltage of the digital positive DP pin of the USB interface after determining that the USB interface is connected to the main device end of the USB OTG line; after detecting that the voltage of the DP pin is greater than the first After the three threshold voltages, the pull-up circuit is controlled to provide the first voltage to the DM pin.
在一种可能的实现方式中,控制电路还可以在控制上拉电路向DM引脚提供第一电压的时间达到第二时延之后,控制上拉电路停止向DM引脚提供第一电压。在本申请实施例中,可以根据BC 1.2协议确定第二时延的时长。例如,从设备为DP引脚施加DP电压后,间隔40ms之后再为DM引脚施加DM电压,因此本申请实施例中第二时延不小于40ms,以保证从设备可以在为DP引脚施加DP电压后,能够检测到从设备的DM引脚的电压被随之上拉。In a possible implementation manner, the control circuit may also control the pull-up circuit to stop providing the first voltage to the DM pin after the time for controlling the pull-up circuit to provide the first voltage to the DM pin reaches the second time delay. In the embodiment of the present application, the duration of the second delay can be determined according to the BC 1.2 protocol. For example, after the slave device applies the DP voltage to the DP pin, and then applies the DM voltage to the DM pin after an interval of 40ms, the second delay in the embodiment of this application is not less than 40ms to ensure that the slave device can apply the DP pin to the DP pin. After the DP voltage, it can be detected that the voltage of the DM pin of the slave device is pulled up accordingly.
在本申请实施例中,上拉电路存在多种可能的实现方式,示例性的:In the embodiments of the present application, there are multiple possible implementations of the pull-up circuit, for example:
在一种可能的实现方式中,上拉电路包括第一开关管和第一电阻;其中,第一开关管的控制电极与控制电路耦合,第一开关管的第一电极与第一电阻的一端耦合,第一开关管的第二电极与DM引脚耦合,第一电阻的另一端用于接收基础电压;控制电路可以在确定USB接口接入USB OTG线的主设备端后,导通第一开关管。In a possible implementation, the pull-up circuit includes a first switch tube and a first resistor; wherein, the control electrode of the first switch tube is coupled to the control circuit, and the first electrode of the first switch tube is connected to one end of the first resistor. Coupling, the second electrode of the first switch tube is coupled with the DM pin, and the other end of the first resistor is used to receive the basic voltage; the control circuit can turn on the first terminal after confirming that the USB interface is connected to the main device end of the USB OTG line turning tube.
示例性的,上述上拉电路还可以包括第二电阻,该第二电阻的一端与控制电路耦合,第二电阻的另一端与第一开关管的控制电极耦合。Exemplarily, the above-mentioned pull-up circuit may further include a second resistor, one end of the second resistor is coupled with the control circuit, and the other end of the second resistor is coupled with the control electrode of the first switch tube.
示例性的,上述第一开关管可以为双极型晶体管或场效应晶体管。Exemplarily, the above-mentioned first switch tube may be a bipolar transistor or a field effect transistor.
示例性的,上述基础电压可以是控制电路或电源管理电路为上拉电路提供的电压。Exemplarily, the above-mentioned basic voltage may be a voltage provided by a control circuit or a power management circuit for the pull-up circuit.
在另一种可能的实现方式中,上拉电路包括第三电阻;第三电阻的一端与控制电路耦合,第三电阻的另一端与所述DM引脚耦合;控制电路可以确定USB接口接入USB OTG线的主设备端后,向第三电阻输出基础电压。In another possible implementation, the pull-up circuit includes a third resistor; one end of the third resistor is coupled to the control circuit, and the other end of the third resistor is coupled to the DM pin; the control circuit can determine whether the USB interface is connected After the main device end of the USB OTG line, it outputs the basic voltage to the third resistor.
第二方面,本申请实施例提供一种反向充电方法,该方法可以应用于控制电路,该控制电路与上拉电路耦合,该上拉电路与通用串行总线USB接口的数字负DM引脚耦合,该USB接口的类型为标准下行端口SDP;本申请实施例所提供的反向充电方法包括:在确定USB接口接入USB活动式OTG线的主设备端后,控制上拉电路向DM引脚提供第一电压,其中,第一电压用于指示该USB接口为充电下行端口CDP。In the second aspect, the embodiments of the present application provide a reverse charging method, which can be applied to a control circuit, the control circuit is coupled with a pull-up circuit, and the pull-up circuit is connected to the digital negative DM pin of the universal serial bus USB interface The type of the USB interface is a standard downstream port SDP; the reverse charging method provided in the embodiment of the present application includes: after determining that the USB interface is connected to the main device end of the USB movable OTG line, control the pull-up circuit to lead to the DM The pin provides a first voltage, where the first voltage is used to indicate that the USB interface is a charging downstream port CDP.
在一种可能的实现方式中,控制电路还与电源管理电路耦合,电源管理电路与USB接口的触发引脚耦合;电源管理电路,用于在检测到触发引脚的电压低于第一阈值电压后,向控制电路发送第一检测信号;本申请实施例所提供的反向充电方法还包括:在接收到第一检测信号后,确定USB接口接入USB OTG线的主设备端。In a possible implementation, the control circuit is also coupled with the power management circuit, and the power management circuit is coupled with the trigger pin of the USB interface; the power management circuit is used to detect that the voltage of the trigger pin is lower than the first threshold voltage Then, the first detection signal is sent to the control circuit; the reverse charging method provided in the embodiment of the present application further includes: after receiving the first detection signal, determining that the USB interface is connected to the main device end of the USB OTG line.
在一种可能的实现方式中,控制电路还与USB接口的触发引脚耦合;本申请实施例所提供的反向充电方法还包括:在检测到触发引脚的低于第一阈值电压后,确定USB接口接入USB OTG线的主设备端。In a possible implementation manner, the control circuit is also coupled with the trigger pin of the USB interface; the reverse charging method provided in the embodiment of the present application further includes: after detecting that the trigger pin is lower than the first threshold voltage, Make sure that the USB interface is connected to the main device end of the USB OTG line.
在一种可能的实现方式中,控制电路还与充电管理电路耦合,充电管理电路与USB接口的VBUS引脚耦合;在确定USB接口接入USB OTG线的主设备端后,还包括:控制充电管理电路向USB接口的VBUS引脚输出充电电压。In a possible implementation, the control circuit is also coupled with the charging management circuit, and the charging management circuit is coupled with the VBUS pin of the USB interface; after determining that the USB interface is connected to the main device end of the USB OTG line, it also includes: controlling charging The management circuit outputs the charging voltage to the VBUS pin of the USB interface.
在一种可能的实现方式中,在确定USB接口接入USB活动式OTG线的主设备端后, 控制上拉电路向DM引脚提供第一电压,第一电压用于指示所述USB接口为充电下行端口CDP,包括:在控制充电管理电路向USB接口的VBUS引脚输出充电电压的时间达到第一时延之后,开启用于执行BC1.2协议的DP比较器;在接收到DP比较器提供的第三检测信号后,控制上拉电路向DM引脚提供第一电压。In a possible implementation manner, after it is determined that the USB interface is connected to the main device end of the USB movable OTG line, the pull-up circuit is controlled to provide a first voltage to the DM pin, and the first voltage is used to indicate that the USB interface is The charging downstream port CDP includes: after the time for controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface reaches the first time delay, turning on the DP comparator for executing the BC1.2 protocol; after receiving the DP comparator After the third detection signal is provided, the pull-up circuit is controlled to provide the first voltage to the DM pin.
在一种可能的实现方式中,在确定USB接口接入USB OTG线的主设备端后,控制上拉电路向DM引脚提供第一电压,第一电压用于指示USB接口为充电下行端口CDP,包括:在确定USB接口接入USB OTG线的主设备端后,检测USB接口的数字正DP引脚的电压;在检测到DP引脚的电压大于第三阈值电压后,控制上拉电路向DM引脚提供第一电压。In a possible implementation, after determining that the USB interface is connected to the main device end of the USB OTG line, the pull-up circuit is controlled to provide the first voltage to the DM pin, and the first voltage is used to indicate that the USB interface is a charging downstream port CDP , Including: after determining that the USB interface is connected to the main device end of the USB OTG line, detecting the voltage of the digital positive DP pin of the USB interface; after detecting that the voltage of the DP pin is greater than the third threshold voltage, controlling the pull-up circuit to The DM pin provides the first voltage.
在一种可能的实现方式中,控制上拉电路向DM引脚提供第一电压之后,还包括:在控制上拉电路向DM引脚提供第一电压的时间达到第二时延之后,控制上拉电路停止向DM引脚提供第一电压。In a possible implementation manner, after controlling the pull-up circuit to provide the first voltage to the DM pin, the method further includes: controlling the pull-up circuit to provide the first voltage to the DM pin after the second time delay reaches the second time delay, controlling the pull-up circuit to provide the first voltage to the DM pin. The pull circuit stops supplying the first voltage to the DM pin.
在一种可能的实现方式中,上拉电路包括第一开关管和第一电阻;第一开关管的控制电极与控制电路耦合,第一开关管的第一电极与第一电阻的一端耦合,第一开关管的第二电极与DM引脚耦合,第一电阻的另一端用于接收基础电压;在确定USB接口接入USB OTG线的主设备端后,控制上拉电路向DM引脚提供第一电压,包括:在确定USB接口接入USB OTG线的主设备端后,导通第一开关管。In a possible implementation, the pull-up circuit includes a first switch tube and a first resistor; the control electrode of the first switch tube is coupled with the control circuit, and the first electrode of the first switch tube is coupled with one end of the first resistor, The second electrode of the first switch tube is coupled to the DM pin, and the other end of the first resistor is used to receive the basic voltage; after confirming that the USB interface is connected to the main device end of the USB OTG line, the pull-up circuit is controlled to provide the DM pin The first voltage includes: after it is determined that the USB interface is connected to the main device end of the USB OTG line, the first switch tube is turned on.
在一种可能的实现方式中,上拉电路还包括第二电阻,第二电阻的一端与控制电路耦合,第二电阻的另一端与第一开关管的控制电极耦合。In a possible implementation manner, the pull-up circuit further includes a second resistor, one end of the second resistor is coupled to the control circuit, and the other end of the second resistor is coupled to the control electrode of the first switch tube.
在一种可能的实现方式中,第一开关管为双极型晶体管或场效应晶体管。In a possible implementation manner, the first switch tube is a bipolar transistor or a field effect transistor.
在一种可能的实现方式中,基础电压为控制电路或电源管理电路为上拉电路提供的电压。In a possible implementation manner, the base voltage is the voltage provided by the control circuit or the power management circuit for the pull-up circuit.
在一种可能的实现方式中,上拉电路包括第三电阻;第三电阻的一端与控制电路耦合,第三电阻的另一端与DM引脚耦合;在确定USB接口接入USB OTG线的主设备端后,控制上拉电路向DM引脚提供第一电压,包括:在确定USB接口接入USB OTG线的主设备端后,向第三电阻输出基础电压。In a possible implementation, the pull-up circuit includes a third resistor; one end of the third resistor is coupled to the control circuit, and the other end of the third resistor is coupled to the DM pin; after determining that the USB interface is connected to the main USB OTG line After the device end, controlling the pull-up circuit to provide the first voltage to the DM pin includes: after determining that the USB interface is connected to the main device end of the USB OTG line, outputting the basic voltage to the third resistor.
本申请的这些方面或其他方面在以下实施例的描述中会更加简明易懂。These and other aspects of the present application will be more concise and understandable in the description of the following embodiments.
附图说明Description of the drawings
图1为本申请实施例适用的一种反向充电示意图;FIG. 1 is a schematic diagram of a reverse charging applicable to an embodiment of this application;
图2为本申请实施例适用的一种电子设备结构示意图;FIG. 2 is a schematic diagram of the structure of an electronic device to which an embodiment of the application is applicable;
图3一种从设备识别主设备的USB接口的流程示意图;FIG. 3 is a schematic flow chart of a slave device identifying the USB interface of the master device;
图4为本申请实施例提供的一种上拉电路结构示意图;4 is a schematic structural diagram of a pull-up circuit provided by an embodiment of the application;
图5为本申请实施例提供的一种上拉电路结构示意图;FIG. 5 is a schematic structural diagram of a pull-up circuit provided by an embodiment of the application;
图6为本申请实施例提供的一种上拉电路结构示意图;FIG. 6 is a schematic structural diagram of a pull-up circuit provided by an embodiment of the application;
图7为本申请实施例提供的一种反向充电方法流程示意图。FIG. 7 is a schematic flowchart of a reverse charging method provided by an embodiment of the application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完 整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述。方法实施例中的具体操作方法也可以应用于装置实施例或系统实施例中。需要说明的是,在本申请的描述中“至少一个”是指一个或多个,其中,多个是指两个或两个以上。鉴于此,本发明实施例中也可以将“多个”理解为“至少两个”。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,字符“/”,如无特殊说明,一般表示前后关联对象是一种“或”的关系。另外,需要理解的是,在本申请的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。In order to make the purpose, technical solutions, and advantages of the application more clear, the application will be further described in detail below with reference to the accompanying drawings. The specific operation method in the method embodiment can also be applied to the device embodiment or the system embodiment. It should be noted that in the description of this application, "at least one" refers to one or more, and multiple refers to two or more. In view of this, in the embodiments of the present invention, “a plurality of” may also be understood as “at least two”. "And/or" describes the association relationship of the associated objects, indicating that there can be three types of relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone. In addition, the character "/", unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship. In addition, it should be understood that in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing description, and cannot be understood as indicating or implying relative importance, nor can it be understood as indicating Or imply the order.
需要指出的是,本申请实施例中“耦合”指的是能量传递关系,例如,A与B耦合,指的是A与B之间能够传递能量,其中,能量的具体形式存在多种可能,例如电能、磁场势能等。在A与B之间能够传递电能时,反应在电路连接关系上,便是A与B之间可以直接电连接,也可以通过其它导体或电路元件间接电连接。It should be pointed out that “coupling” in the embodiments of this application refers to the energy transfer relationship. For example, the coupling of A and B means that energy can be transferred between A and B. There are many possibilities for specific forms of energy. For example, electric energy, magnetic field potential energy, etc. When electric energy can be transferred between A and B, it is reflected in the circuit connection relationship, that is, A and B can be directly electrically connected, or indirectly electrically connected through other conductors or circuit elements.
需要指出的是,本申请实施例中“接入”指的是两个接口之间实现了耦合连接,且两个接口中互相对应的引脚一一耦合,但本申请实施例对两个接口之间具体的耦合连接方式并不多作限制。例如,该耦合连接可以是插入、对接等等。以插入为例,接口1接入接口2,既可以是接口1插入了接口2,又可以是接口2插入了接口1。It should be pointed out that “access” in the embodiment of this application refers to the realization of a coupling connection between the two interfaces, and the corresponding pins of the two interfaces are coupled one by one. The specific coupling and connection methods are not limited. For example, the coupling connection may be insertion, docking, and so on. Taking insertion as an example, the interface 1 is connected to the interface 2. It can be that the interface 1 is inserted into the interface 2, or the interface 2 is inserted into the interface 1.
目前,反向充电技术在电子设备中的应用日趋成熟。所谓反向充电,指的是电子设备可以利用自身电池中存储的电能,为另一个电子设备充电。一般来说,当前的反向充电多为有线形式,即需要借助于USB活动式(on the go,OTG)线,以实现反向充电。示例性的,如图1所示,USB OTG线300主要包括A端和B端。在进行反向充电之前,用户可以将USB OTG线300的A端与电子设备100的USB接口101连接,将USB OTG线300的B端与电子设备200的USB接口201连接。电子设备100可以从USB接口101向USB OTG线的A端输出电能,USB OTG线的A端接收到的电能被传输至USB OTG线的B端,并通过USB接口201输入电子设备200。电子设备200进而可以利用USB接口201输入的电能工作或充电。At present, the application of reverse charging technology in electronic devices is becoming more and more mature. The so-called reverse charging means that an electronic device can use the electric energy stored in its own battery to charge another electronic device. Generally speaking, the current reverse charging is mostly in a wired form, that is, a USB movable (on the go, OTG) cable is needed to realize reverse charging. Exemplarily, as shown in FIG. 1, the USB OTG line 300 mainly includes an A terminal and a B terminal. Before performing reverse charging, the user can connect the A terminal of the USB OTG cable 300 to the USB interface 101 of the electronic device 100, and connect the B terminal of the USB OTG cable 300 to the USB interface 201 of the electronic device 200. The electronic device 100 can output electric energy from the USB interface 101 to the A end of the USB OTG line, and the electric energy received by the A end of the USB OTG line is transmitted to the B end of the USB OTG line, and is input to the electronic device 200 through the USB interface 201. The electronic device 200 can then use the power input from the USB interface 201 to operate or charge.
需要指出的是,本申请实施例中USB OTG线300的形状既可以是线形,也可以是方形、圆形等非线性形状,本申请实施例对USB OTG线300的形状并不多作限制。It should be pointed out that the shape of the USB OTG line 300 in the embodiment of the present application may be linear, or a non-linear shape such as a square or a circle, and the embodiment of the present application does not limit the shape of the USB OTG line 300.
为了便于说明,接下来以电子设备100为例,对本申请实施例所适用的电子设备作进一步说明。图2示例性示出了本申请实施例所适用的电子设备结构,该电子设备可以是支持反向充电的智能手机、平板电脑等电子设备。如图2所示,电子设备100主要包括通用串行总线USB接口101、控制电路102、电源管理电路103、电池104和充电管理电路106。For ease of description, the electronic device 100 is taken as an example to further describe the electronic device to which the embodiments of the present application are applied. FIG. 2 exemplarily shows the structure of the electronic device to which the embodiment of the present application is applicable. The electronic device may be an electronic device such as a smart phone or a tablet computer that supports reverse charging. As shown in FIG. 2, the electronic device 100 mainly includes a universal serial bus USB interface 101, a control circuit 102, a power management circuit 103, a battery 104, and a charging management circuit 106.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图2所示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图2所示的部件可以以硬件,软件或软件和硬件的组合实现。例如,电子设备100还可以包括中央处理器,外部存储器接口,内部存储器,天线,移动通信模块,无线通信模块,音频模块,扬声器,受话器,麦克风,耳机接口,传感器模块,按键,马达,指示器,摄像头,显示屏,以及用户标识模块(subscriber identification module,SIM)卡接口等。其中,传感器模块可以包括压力传感器,陀螺仪传 感器,气压传感器,磁传感器,加速度传感器,距离传感器,接近光传感器,指纹传感器,温度传感器,触摸传感器,环境光传感器,骨传导传感器等。It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown in FIG. 2, or combine certain components, or split certain components, or arrange different components. The components shown in Figure 2 can be implemented in hardware, software or a combination of software and hardware. For example, the electronic device 100 may also include a central processing unit, an external memory interface, an internal memory, an antenna, a mobile communication module, a wireless communication module, an audio module, a speaker, a receiver, a microphone, a headphone jack, a sensor module, buttons, a motor, and an indicator , Camera, display, and subscriber identification module (SIM) card interface, etc. Among them, the sensor module may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
控制电路102可以包括一个或多个处理单元,可以是电子设备100的中央处理器(central processing unit,CPU),也可以是电子设备100的片上系统(system on chip,SOC)。示例性的:控制电路102可以包括应用处理器(application processor,AP),控制器,存储器,数字信号处理器(digital signal processor,DSP)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The control circuit 102 may include one or more processing units, which may be a central processing unit (CPU) of the electronic device 100 or a system on chip (SOC) of the electronic device 100. Exemplary: the control circuit 102 may include an application processor (application processor, AP), a controller, a memory, a digital signal processor (digital signal processor, DSP), and so on. Among them, the different processing units may be independent devices or integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生控制信号。示例性的,本申请实施例中控制电路102内的控制器可以产生控制信号,控制电路102可以通过控制信号控制电源管理电路103、USB接口101的工作。The controller may be the nerve center and command center of the electronic device 100. The controller can generate control signals according to the instruction operation code and timing signals. Exemplarily, the controller in the control circuit 102 in the embodiment of the present application can generate a control signal, and the control circuit 102 can control the operation of the power management circuit 103 and the USB interface 101 through the control signal.
控制电路102中还可以设置存储器,用于存储指令和数据。在一些实施例中,控制电路102中的存储器为高速缓冲存储器。该存储器可以保存控制电路102刚用过或循环使用的指令或数据。如果控制电路102需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory can also be provided in the control circuit 102 for storing instructions and data. In some embodiments, the memory in the control circuit 102 is a cache memory. The memory can store instructions or data that the control circuit 102 has just used or used cyclically. If the control circuit 102 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
在一些实施例中,控制电路102可以包括一个或多个接口。接口可以包括控制总线接口,通用输入输出(general-purpose input/output,GPIO)接口等。In some embodiments, the control circuit 102 may include one or more interfaces. The interface may include a control bus interface, a general-purpose input/output (GPIO) interface, and the like.
其中,控制总线接口可以是集成电路(inter-integrated circuit,I2C)接口、串行外设接口(serial peripheral interface,SPI)、系统电源管理接口(system power management interface,SPMI)等,本申请实施例对此并不多作限制。在本申请实施例中,控制电路102可以通过控制总线接口耦合电源管理电路103和充电管理电路106,实现电子设备100的反向充电功能。Among them, the control bus interface may be an integrated circuit (inter-integrated circuit, I2C) interface, a serial peripheral interface (serial peripheral interface, SPI), a system power management interface (system power management interface, SPMI), etc. The embodiments of this application There are not many restrictions on this. In the embodiment of the present application, the control circuit 102 may couple the power management circuit 103 and the charging management circuit 106 through a control bus interface to realize the reverse charging function of the electronic device 100.
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号接口,也可被配置为数据信号接口,也可被配置为供电接口。在一些实施例中,GPIO接口可以用于连接控制电路102与电子设备100中的其它电路结构,根据所连接电路结构类型,灵活配置GPIO接口。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal interface, can also be configured as a data signal interface, and can also be configured as a power supply interface. In some embodiments, the GPIO interface can be used to connect the control circuit 102 with other circuit structures in the electronic device 100, and the GPIO interface can be flexibly configured according to the type of the connected circuit structure.
电源管理电路103,可以是电源管理单元(power management unit,PMU),集成电源管理电路(power management IC,PMIC)。电源管理电路103可以接收电池104和/或充电管理电路106提供的电能,为控制电路102及电子设备中的其它电路结构供电。电源管理电路103还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。此外,电源管理电路103还可以检测USB接口中各个引脚的电压,并在各个引脚的电压状态发生变化时,向控制电路102发送检测信号。在其他一些实施例中,电源管理电路103也可以与控制电路102集成于同一芯片中。The power management circuit 103 may be a power management unit (power management unit, PMU), and an integrated power management circuit (power management IC, PMIC). The power management circuit 103 can receive electric energy provided by the battery 104 and/or the charging management circuit 106 to supply power to the control circuit 102 and other circuit structures in the electronic device. The power management circuit 103 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters. In addition, the power management circuit 103 can also detect the voltage of each pin in the USB interface, and send a detection signal to the control circuit 102 when the voltage state of each pin changes. In some other embodiments, the power management circuit 103 and the control circuit 102 may also be integrated in the same chip.
充电管理电路(charger IC)106,可以通过USB接口101接收充电电能,并将接收到的充电电能存入电池104。在充电管理电路106为电池104充电的同时,还可以向电源管理电路103供电,使得电源管理电路103可以同时为电子设备中的其它电路结构供电。在电子设备作为无线充电中的主设备时,控制电路102可以控制充电管理电路106向USB接口101输出充电电压,充电电压一般为5V。A charging management circuit (charger IC) 106 may receive charging power through the USB interface 101, and store the received charging power in the battery 104. While the charging management circuit 106 is charging the battery 104, it can also supply power to the power management circuit 103, so that the power management circuit 103 can simultaneously supply power to other circuit structures in the electronic device. When the electronic device is used as the main device in wireless charging, the control circuit 102 can control the charging management circuit 106 to output a charging voltage to the USB interface 101, and the charging voltage is generally 5V.
USB接口101是符合USB标准规范的接口,具体可以Micro USB接口,USB Type C接口等。USB接口101可以用于连接充电器为电子设备100充电,也可以用于连接电子设 备100和USB OTG线300的A端,使电子设备100可以为其它电子设备充电。The USB interface 101 is an interface that complies with the USB standard specifications, and specifically can be a Micro USB interface, a USB Type C interface, and so on. The USB interface 101 can be used to connect a charger to charge the electronic device 100, and can also be used to connect the electronic device 100 to the A terminal of the USB OTG cable 300, so that the electronic device 100 can charge other electronic devices.
示例性的,USB接口101主要包括接地(GND)引脚、触发引脚、数据正(DP)引脚、数据负(DM)引脚和供电总线(VBUS)引脚。其中,DP引脚也可以称为D+引脚,DM引脚也可以称为D-引脚。触发引脚可以触发控制电路102确定USB接口101接入了USB OTG线300的主设备端(USB OTG线300的A端)。示例性的,Micro USB接口、USB Type C等常规的USB接口,该触发引脚可以是Micro USB接口的标识(ID)引脚,对于USB Type C接口,该触发引脚可以是控制(CC)引脚。触发引脚的具体实现由USB接口101的具体类型、控制电路102内部具体的识别逻辑决定,本申请实施例对此并不多作限制。为了便于理解,本申请实施例接下来以ID引脚作为触发引脚,示例性地对本申请实施例作进一步说明。Exemplarily, the USB interface 101 mainly includes a ground (GND) pin, a trigger pin, a data positive (DP) pin, a data negative (DM) pin, and a power supply bus (VBUS) pin. Among them, the DP pin can also be referred to as the D+ pin, and the DM pin can also be referred to as the D- pin. The trigger pin can trigger the control circuit 102 to determine that the USB interface 101 is connected to the main device end of the USB OTG line 300 (end A of the USB OTG line 300). Exemplarily, for conventional USB interfaces such as Micro USB interface and USB Type C, the trigger pin may be the identification (ID) pin of the Micro USB interface, and for the USB Type C interface, the trigger pin may be control (CC) Pin. The specific implementation of the trigger pin is determined by the specific type of the USB interface 101 and the specific identification logic inside the control circuit 102, which is not limited in the embodiment of the present application. For ease of understanding, the embodiment of the present application uses the ID pin as the trigger pin in the following to exemplarily further illustrate the embodiment of the present application.
在USB接口101中,GND引脚与接地电路耦合,保持在0电势状态。ID引脚被电源管理电路103施加有稳定的上拉电压,一般该上拉电压的电压值为1.8V。In the USB interface 101, the GND pin is coupled with the ground circuit and is maintained at a zero potential state. The ID pin is applied with a stable pull-up voltage by the power management circuit 103, and the voltage value of the pull-up voltage is generally 1.8V.
VBUS引脚与电源管理电路103耦合。在充电过程中,VBUS引脚可以接收充电器或其它电子设备输入的充电电能,并将接收到的充电电能提供给充电管理电路106。在反向充电过程中,VBUS引脚可以接收并输出充电管理电路106提供的电能。The VBUS pin is coupled with the power management circuit 103. During the charging process, the VBUS pin can receive the charging power input by the charger or other electronic devices, and provide the received charging power to the charging management circuit 106. During the reverse charging process, the VBUS pin can receive and output the electric energy provided by the charging management circuit 106.
USB接口101中,ID引脚可以用于触发控制电路102确定USB接口101接入了USB OTG线300的主设备端(USB OTG线300的A端)。具体而言:In the USB interface 101, the ID pin can be used to trigger the control circuit 102 to determine that the USB interface 101 is connected to the host device end of the USB OTG line 300 (end A of the USB OTG line 300). in particular:
USB OTG线300的A端和B端皆可以理解为不同类型的USB接口,USB OTG线300的A端和B端分别具有与电子设备100的USB接口101相适配的引脚。具体来说,当USB OTG线300的A端接入USB接口101后,A端的GND引脚与USB接口101中的GND引脚耦合,A端的ID引脚与USB接口101中的ID引脚耦合,A端的DP引脚与USB接口101中的DP引脚耦合,A端的DM引脚与USB接口101中的DM引脚耦合,A端的VBUS引脚与USB接口中的VBUS引脚耦合。B端同理,不再赘述。Both ends A and B of the USB OTG line 300 can be understood as different types of USB interfaces. The A end and the B end of the USB OTG line 300 respectively have pins adapted to the USB interface 101 of the electronic device 100. Specifically, when end A of the USB OTG cable 300 is connected to the USB interface 101, the GND pin of the A end is coupled to the GND pin of the USB interface 101, and the ID pin of the A end is coupled to the ID pin of the USB interface 101 , The DP pin of the A terminal is coupled with the DP pin of the USB interface 101, the DM pin of the A terminal is coupled with the DM pin of the USB interface 101, and the VBUS pin of the A terminal is coupled with the VBUS pin of the USB interface. The same is true for the B side, so I won't repeat it here.
USB OTG线300中A端和B端的区别在于,A端中ID引脚与接地电路耦合,而B端中ID引脚悬空。当USB OTG线300的A端接入电子设备100的USB接口101后,USB接口101中的ID引脚通过USB OTG线300的A端的ID引脚接地,因此USB接口101中的ID引脚的电压被随之下拉。在本申请一实施例中,当USB接口101中ID引脚的电压被下拉至小于第一阈值电压时,便可以认为USB接口101接入了USB OTG线300的A端,通常,USB接口101的ID引脚的电压会被下拉至0V。The difference between the A terminal and the B terminal of the USB OTG line 300 is that the ID pin of the A terminal is coupled with the ground circuit, while the ID pin of the B terminal is left floating. When end A of the USB OTG line 300 is connected to the USB interface 101 of the electronic device 100, the ID pin of the USB interface 101 is grounded through the ID pin of the end A of the USB OTG line 300, so the ID pin of the USB interface 101 The voltage is pulled down accordingly. In an embodiment of the present application, when the voltage of the ID pin of the USB interface 101 is pulled down to be less than the first threshold voltage, it can be considered that the USB interface 101 is connected to the A terminal of the USB OTG line 300. Generally, the USB interface 101 The voltage of the ID pin will be pulled down to 0V.
当USB OTG线300的B端接入电子设备100的USB接口101后,USB接口101中的ID引脚与B端的ID引脚耦合。由于B端的ID引脚悬空,因此USB接口101中ID引脚的电压仍可以维持在1.8V。After the B end of the USB OTG line 300 is connected to the USB interface 101 of the electronic device 100, the ID pin of the USB interface 101 is coupled with the ID pin of the B end. Since the ID pin of the B terminal is suspended, the voltage of the ID pin of the USB interface 101 can still be maintained at 1.8V.
有鉴于此,本申请实施例中控制电路102至少可以通过以下两种可能的实现方式确定USB接口101接入了USB OTG线300的A端:In view of this, the control circuit 102 in the embodiment of the present application can determine that the USB interface 101 is connected to the A terminal of the USB OTG line 300 through at least the following two possible implementation manners:
方式一:电源管理电路103可以检测USB接口101中ID引脚的电压,当检测到ID引脚的电压被下拉,也就是检测到ID引脚的电压低于第一阈值电压后,电源管理电路103向控制电路102发送第一检测信号。示例性的,电源管理电路103可以通过控制总线向控制电路102发送第一检测信号,第一检测信号可以向控制电路102指示USB接口101接入了USB OTG线300的A端。控制电路102在接收到第一检测信号后,便可以根据第一检测信号确定USB接口101接入了USB OTG线300的A端,进而可以确定所属电子设备为 主设备,并继续执行电池充电规范(battery charging specification,BC)1.2协议,与从设备完成握手。Method 1: The power management circuit 103 can detect the voltage of the ID pin in the USB interface 101. When the voltage of the ID pin is detected to be pulled down, that is, after the voltage of the ID pin is detected to be lower than the first threshold voltage, the power management circuit 103 sends the first detection signal to the control circuit 102. Exemplarily, the power management circuit 103 may send a first detection signal to the control circuit 102 through the control bus, and the first detection signal may indicate to the control circuit 102 that the USB interface 101 is connected to the A terminal of the USB OTG line 300. After receiving the first detection signal, the control circuit 102 can determine according to the first detection signal that the USB interface 101 is connected to end A of the USB OTG line 300, and can then determine that the electronic device belongs to the main device, and continue to implement the battery charging specification (battery charging specification, BC) 1.2 protocol, complete the handshake with the slave device.
方式二:控制电路102与ID引脚耦合,控制电路102可以检测ID引脚的电压。当检测到ID引脚的电压被下拉,也就是检测到ID引脚的电压低于第一阈值电压后,控制电路102便可以确定USB接口101接入了USB OTG线300的A端,控制电路102进而可以确定所属电子设备为主设备,并继续执行1.2协议,与从设备完成握手。Manner 2: The control circuit 102 is coupled with the ID pin, and the control circuit 102 can detect the voltage of the ID pin. When detecting that the voltage of the ID pin is pulled down, that is, after detecting that the voltage of the ID pin is lower than the first threshold voltage, the control circuit 102 can determine that the USB interface 101 is connected to the A terminal of the USB OTG line 300, and the control circuit 102 can then determine that the electronic device belongs to as the master device, and continue to execute the 1.2 protocol to complete the handshake with the slave device.
在图1所示的充电场景下,电子设备100与USB OTG线300的A端连接,因此电子设备100为主设备,电子设备200与USB OTG线300的B端连接,因此电子设备200为从设备。需要指出的是,电子设备200的结构与电子设备100类似,电子设备200包括USB接口201、控制电路202、电源管理电路203和电池204,各个电路结构之间的连接关系皆可以参考图2所示,本申请实施例对此不再以图示说明。为了便于说明,本申请实施例接下来以GND引脚1、ID引脚1、DP引脚1、DM引脚1和VBUS引脚1表示USB接口101中的引脚,以GND引脚2、ID引脚2、DP引脚2、DM引脚2和VBUS引脚2表示USB接口201中的引脚。In the charging scenario shown in Figure 1, the electronic device 100 is connected to end A of the USB OTG line 300, so the electronic device 100 is the master device, and the electronic device 200 is connected to the end B of the USB OTG line 300, so the electronic device 200 is the slave equipment. It should be pointed out that the structure of the electronic device 200 is similar to that of the electronic device 100. The electronic device 200 includes a USB interface 201, a control circuit 202, a power management circuit 203, and a battery 204. The connection relationship between the various circuit structures can be referred to as shown in FIG. 2. As shown, this embodiment of the present application will not illustrate this with illustrations. For ease of description, the embodiment of the present application uses GND pin 1, ID pin 1, DP pin 1, DM pin 1, and VBUS pin 1 to represent the pins in the USB interface 101, and uses GND pin 2, ID pin 2, DP pin 2, DM pin 2, and VBUS pin 2 represent pins in the USB interface 201.
电子设备100中,控制电路102在确定USB接口101接入了USB OTG线300的A端后,可以向充电管理电路106发送第一控制信号,充电管理电路106在接收到第一控制信号后,向USB接口101的VBUS引脚1输出充电电压。In the electronic device 100, the control circuit 102 can send a first control signal to the charging management circuit 106 after determining that the USB interface 101 is connected to the USB OTG line 300 end A, and the charging management circuit 106 receives the first control signal, The charging voltage is output to the VBUS pin 1 of the USB interface 101.
由于电子设备200中,USB接口201的VBUS引脚2通过USB OTG线300,与USB接口101中的VBUS引脚1耦合,因此,当充电管理电路106向VBUS引脚1输出充电电压后,VBUS引脚2的电压被随之上拉。在一种可能的实现方式中,电源管理电路203可以检测VBUS引脚2的电压,当检测到VBUS引脚2的电压被上拉,也就是VBUS引脚2的电压大于第二阈值电压后,可以向控制电路202发送第二检测信号。具体来说,电源管理电路203可以通过控制总线向控制电路202发送第二检测信号,该第二检测信号可以向控制电路202指示USB接口202接入了USB接口。控制电路202在接收到第二检测信号后,便可以根据第二检测信号确定USB接口202接入了USB接口,控制电路202进而可以确定所属电子设备为从设备,并继续执行1.2协议,与主设备完成握手。In the electronic device 200, the VBUS pin 2 of the USB interface 201 is coupled to the VBUS pin 1 of the USB interface 101 through the USB OTG line 300. Therefore, after the charging management circuit 106 outputs the charging voltage to the VBUS pin 1, the VBUS The voltage of pin 2 is pulled up accordingly. In a possible implementation, the power management circuit 203 can detect the voltage of the VBUS pin 2. When it is detected that the voltage of the VBUS pin 2 is pulled up, that is, after the voltage of the VBUS pin 2 is greater than the second threshold voltage, The second detection signal may be sent to the control circuit 202. Specifically, the power management circuit 203 may send a second detection signal to the control circuit 202 through the control bus, and the second detection signal may indicate to the control circuit 202 that the USB interface 202 is connected to the USB interface. After receiving the second detection signal, the control circuit 202 can determine that the USB interface 202 is connected to the USB interface according to the second detection signal. The control circuit 202 can then determine that the electronic device belongs to is a slave device, and continue to execute the 1.2 protocol to communicate with the master. The device completes the handshake.
在另一种可能的实现方式中,控制电路202与VBUS引脚2耦合。控制电路202可以检测VBUS引脚2的电压,当检测到VBUS引脚2的电压被上拉,也就是VBUS引脚2的电压大于第二阈值电压后,控制电路202便可以确定USB接口202接入了USB接口,控制电路202进而可以确定所属电子设备为从设备,并继续执行BC 1.2协议,与主设备完成握手。In another possible implementation manner, the control circuit 202 is coupled to the VBUS pin 2. The control circuit 202 can detect the voltage of the VBUS pin 2. When it is detected that the voltage of the VBUS pin 2 is pulled up, that is, after the voltage of the VBUS pin 2 is greater than the second threshold voltage, the control circuit 202 can determine whether the USB interface 202 is connected. After entering the USB interface, the control circuit 202 can then determine that the electronic device belongs to is a slave device, and continue to execute the BC 1.2 protocol to complete the handshake with the master device.
需要指出的是,USB OTG线300的B端与常规USB接口类似,也就是说,在USB OTG线300的B端接入电子设备200后,控制电路202只可以识别到USB接口201中接入了其它USB接口,控制电路202默认所属电子设备为从设备,控制电路202并不会识别具体哪一个设备的USB接口接入了USB接口201。也就是说,电子设备200在作为从设备期间,既可以通过USB OTG线300接收电能,也可以通过其它USB数据线接收电能,其与现有的电子设备中USB接口的应用场景类似,对此不再赘述。It should be pointed out that the B end of the USB OTG line 300 is similar to a conventional USB interface, that is to say, after the B end of the USB OTG line 300 is connected to the electronic device 200, the control circuit 202 can only recognize that it is connected to the USB interface 201 For other USB interfaces, the electronic device to which the control circuit 202 belongs is a slave device by default, and the control circuit 202 does not identify which device's USB interface is connected to the USB interface 201. In other words, during the period when the electronic device 200 is a slave device, it can receive power through the USB OTG line 300 or through other USB data lines, which is similar to the application scenario of the USB interface in the existing electronic equipment. No longer.
电子设备100与电子设备200之间,基于BC 1.2协议的握手过程主要是通过USB接口101中的DP引脚1和DM引脚1,以及USB接口201中的DP引脚2和DM引脚2实现的。通过基于BC 1.2协议的握手过程,电子设备200可以识别电子设备100的USB接 口101的类型。Between the electronic device 100 and the electronic device 200, the handshake process based on the BC 1.2 protocol is mainly through the DP pin 1 and DM pin 1 in the USB interface 101, and the DP pin 2 and DM pin 2 in the USB interface 201 Achieved. Through the handshake process based on the BC 1.2 protocol, the electronic device 200 can recognize the type of the USB interface 101 of the electronic device 100.
目前,根据BC 1.2协议,USB接口主要存在以下三种类型:标准下行端口(strandard downstream port,SDP)、专用充电端口(dedicated charging port,DCP)和充电下行端口(charge downstream port,CDP)。目前,大多数电子设备(如智能手机、平板电脑)的USB接口皆为SDP端口,SDP协议规定了最大充电电流为500mA,因此SDP端口无法用于大电流充电。DCP端口可以提供更大的充电电流,一般DCP端口用于墙充等专用充电器。CDP端口也支持大电流充电,但CDP端口主要可以作为电脑、集线器(HUB)等设备的端口,目前尚未大规模应用。Currently, according to the BC 1.2 protocol, there are mainly three types of USB interfaces: standard downstream port (strandard downstream port, SDP), dedicated charging port (DCP), and charge downstream port (CDP). At present, the USB ports of most electronic devices (such as smart phones and tablet computers) are SDP ports. The SDP protocol specifies a maximum charging current of 500 mA, so the SDP port cannot be used for high-current charging. The DCP port can provide greater charging current. Generally, the DCP port is used for special chargers such as wall charging. The CDP port also supports high-current charging, but the CDP port is mainly used as a port for computers, hubs (HUB) and other devices, and has not yet been widely used.
需要指出的是,USB OTG线300的B端的接口类型等效于USB接口101的接口类型。也就是说,USB OTG线300并不会改变USB接口101的接口类型,电子设备200可以通过USB OTG线300识别到USB接口101的接口类型。为了便于表述,本申请实施例直接以识别USB接口101的接口类型概述。It should be pointed out that the interface type of the B end of the USB OTG line 300 is equivalent to the interface type of the USB interface 101. In other words, the USB OTG line 300 does not change the interface type of the USB interface 101, and the electronic device 200 can recognize the interface type of the USB interface 101 through the USB OTG line 300. For ease of presentation, the embodiment of the present application directly identifies the interface type of the USB interface 101 as an overview.
接下来,以图3为例,对电子设备200识别USB接口101的过程作进一步说明。如图3所示,主要包括以下步骤:Next, taking FIG. 3 as an example, the process of identifying the USB interface 101 by the electronic device 200 will be further described. As shown in Figure 3, it mainly includes the following steps:
S301:控制电路202开启电源管理电路203中的DP电压源和DM电流源。S301: The control circuit 202 turns on the DP voltage source and the DM current source in the power management circuit 203.
示例性的,电源管理电路203中包括DP电流源、DP电压源、DM电流源和DM电压源。其中,DP电流源可以限定DP引脚2传输的电流不超过DP阈值电流,DP电压源可以向DP引脚2输出恒定的DP电压,DM电流源可以限定DM引脚2传输的电流不超过DM阈值电流,DM电压源可以向DM引脚2输出恒定的DM电压。一般来说,DP电压和DM电压皆为0.6V。Exemplarily, the power management circuit 203 includes a DP current source, a DP voltage source, a DM current source, and a DM voltage source. Among them, the DP current source can limit the current transmitted by the DP pin 2 to not exceed the DP threshold current, the DP voltage source can output a constant DP voltage to the DP pin 2, and the DM current source can limit the current transmitted by the DM pin 2 to not exceed the DM Threshold current, DM voltage source can output a constant DM voltage to DM pin 2. Generally speaking, both the DP voltage and the DM voltage are 0.6V.
控制电路202可以通过与电源管理电路203之间的控制总线,向电源管理电路203发送控制指令,从而开启电源管理电路203中的DP电压源和DM电流源。可以理解,S301期间,默认关闭DM电压源和DP电流源。The control circuit 202 can send a control command to the power management circuit 203 through the control bus with the power management circuit 203, so as to turn on the DP voltage source and the DM current source in the power management circuit 203. It can be understood that during S301, the DM voltage source and the DP current source are turned off by default.
S302:控制电路202检测DM引脚2的电压。如图2所示,控制电路202与DP引脚2和DM引脚2耦合,控制电路202可以直接检测DP引脚2和DM引脚2的电压。S302: The control circuit 202 detects the voltage of the DM pin 2. As shown in FIG. 2, the control circuit 202 is coupled to the DP pin 2 and the DM pin 2, and the control circuit 202 can directly detect the voltage of the DP pin 2 and the DM pin 2.
S303:若DM引脚2的电压小于第四阈值电压,则执行S305,确定USB接口101为SDP端口,否则,执行S304。其中,第四阈值电压不大于DP电压源和DM电压源的输出电压,一般第四阈值电压可以为0.35V。S303: If the voltage of the DM pin 2 is less than the fourth threshold voltage, execute S305 to determine that the USB interface 101 is an SDP port; otherwise, execute S304. Wherein, the fourth threshold voltage is not greater than the output voltages of the DP voltage source and the DM voltage source, and generally the fourth threshold voltage may be 0.35V.
以下对判断原理作简要说明:The following is a brief description of the judgment principle:
如图2所示,SDP端口(USB接口101)中DP引脚1通过下拉电阻RP与接地电路耦合,DM引脚1通过下拉电阻RM与接地电路耦合,DP引脚1和DM引脚1之间断路。当电源管理电路203为DP引脚2施加DP电压后,DP引脚1的电压被随之上拉。但由于DP引脚1和DM引脚1之间断路,因此DM引脚1仍为下拉状态,DM引脚2的电压并不会被上拉(一般DM引脚2的电压会保持在0V),进而使得控制电路202可以检测到DM引脚2的电压小于第四阈值电压。As shown in Figure 2, the DP pin 1 of the SDP port (USB interface 101) is coupled to the ground circuit through a pull-down resistor RP, and the DM pin 1 is coupled to the ground circuit through a pull-down resistor RM. Discontinuous circuit. When the power management circuit 203 applies the DP voltage to the DP pin 2, the voltage of the DP pin 1 is pulled up accordingly. However, due to the open circuit between DP pin 1 and DM pin 1, DM pin 1 is still in a pull-down state, and the voltage of DM pin 2 will not be pulled up (generally, the voltage of DM pin 2 will remain at 0V) , So that the control circuit 202 can detect that the voltage of the DM pin 2 is less than the fourth threshold voltage.
假设USB接口101为DCP端口,则DP引脚1和DM引脚1短接,当电源管理电路203为DP引脚2施加DP电压后,DP引脚1的电压被随之上拉。由于DP引脚1和DM引脚1短接,则DM引脚1的电压被随之上拉,进而使得DM引脚2的电压被随之上拉,因此控制电路202可以检测到DM引脚2的电压不小于第四阈值电压。Assuming that the USB interface 101 is a DCP port, the DP pin 1 and the DM pin 1 are short-circuited. When the power management circuit 203 applies the DP voltage to the DP pin 2, the voltage of the DP pin 1 is pulled up accordingly. Because DP pin 1 and DM pin 1 are short-circuited, the voltage of DM pin 1 is pulled up accordingly, and the voltage of DM pin 2 is pulled up accordingly, so the control circuit 202 can detect the DM pin The voltage of 2 is not less than the fourth threshold voltage.
再假设USB接口101为CDP端口,则电源管理电路103可以检测DP引脚1的电压。 当电源管理电路203为DP引脚2施加DP电压后,DP引脚1的电压被随之上拉。当电源管理电路103检测到DP引脚1的电压大于参考电压时,电源管理电路1会开启DM电压源,从而为DM引脚1施加DM电压,DM引脚2的电压被随之上拉,进而使得控制电路202可以检测到DM引脚2的电压不小于第四阈值电压。Assuming that the USB interface 101 is a CDP port, the power management circuit 103 can detect the voltage of the DP pin 1. When the power management circuit 203 applies the DP voltage to the DP pin 2, the voltage of the DP pin 1 is pulled up accordingly. When the power management circuit 103 detects that the voltage of the DP pin 1 is greater than the reference voltage, the power management circuit 1 will turn on the DM voltage source to apply the DM voltage to the DM pin 1, and the voltage of the DM pin 2 will be pulled up accordingly. In turn, the control circuit 202 can detect that the voltage of the DM pin 2 is not less than the fourth threshold voltage.
由此可见,只有在USB接口101为SDP端口的情况下,开启电源管理电路203中的DP电压源和DM电流源后,控制电路202才可以检测DM引脚2的电压小于第四阈值电压,因此在S303中,若DM引脚2的电压小于第四阈值电压,则可以确定USB接口101为SDP端口。而在USB接口101为CDP端口或DCP端口的情况下,开启电源管理电路203中的DP电压源和DM电流源后,控制电路202将会检测到DM引脚2的电压不小于第四阈值电压。因此在S303中,若DM引脚2的电压不小于第四电压阈值,则还需继续执行S304,以进一步确定USB接口101为CDP端口还是DCP端口。It can be seen that only when the USB interface 101 is an SDP port, the control circuit 202 can detect that the voltage of the DM pin 2 is less than the fourth threshold voltage after the DP voltage source and the DM current source in the power management circuit 203 are turned on. Therefore, in S303, if the voltage of the DM pin 2 is less than the fourth threshold voltage, it can be determined that the USB interface 101 is an SDP port. When the USB interface 101 is a CDP port or a DCP port, after the DP voltage source and DM current source in the power management circuit 203 are turned on, the control circuit 202 will detect that the voltage of the DM pin 2 is not less than the fourth threshold voltage . Therefore, in S303, if the voltage of the DM pin 2 is not less than the fourth voltage threshold, S304 needs to be continued to further determine whether the USB interface 101 is a CDP port or a DCP port.
S304:控制电路202开启电源管理电路203中的DM电压源和DP电流源。可以理解,还包括关闭电源管理电路203中的DP电压源和DM电流源。S304: The control circuit 202 turns on the DM voltage source and the DP current source in the power management circuit 203. It can be understood that it also includes turning off the DP voltage source and the DM current source in the power management circuit 203.
S306:控制电路202检测DP引脚2的电压。S306: The control circuit 202 detects the voltage of the DP pin 2.
S307:若DP引脚2的电压小于第五阈值电压,则执行S308,确定USB接口101为CDP端口否则,执行S309,确定USB接口101为DCP端口。S307: If the voltage of the DP pin 2 is less than the fifth threshold voltage, execute S308 to determine that the USB interface 101 is a CDP port. Otherwise, execute S309 to determine that the USB interface 101 is a DCP port.
具体来说,假设USB接口101为DCP端口,则DP引脚1和DM引脚1短接,因此当电源管理电路203为DM引脚2施加DM电压后,DP引脚1、DM引脚1和DP引脚2的电压被随之上拉,从而使得控制电路202可以检测到DP引脚2的电压不小于第五阈值电压,一般来说,第五阈值电压可以与第四阈值电压取值相同,例如,二者皆为0.35V。Specifically, assuming that the USB interface 101 is a DCP port, the DP pin 1 and the DM pin 1 are short-circuited. Therefore, when the power management circuit 203 applies the DM voltage to the DM pin 2, the DP pin 1, DM pin 1 And the voltage of DP pin 2 is pulled up accordingly, so that the control circuit 202 can detect that the voltage of DP pin 2 is not less than the fifth threshold voltage. Generally speaking, the fifth threshold voltage can be the same as the fourth threshold voltage. The same, for example, both are 0.35V.
而假设USB接口101为CDP端口,DM引脚1通过下拉电阻RM接地,DP引脚1通过下拉电阻RP接地,且DM引脚1和DP引脚1之间互为断路。因此,当电源管理电路203为DM引脚2施加DM电压后,DP引脚1和DP引脚2的电压并不会被随之上拉,从而使得控制电路202可以检测到DP引脚2的电压小于第五阈值电压。Assuming that the USB interface 101 is a CDP port, the DM pin 1 is grounded through the pull-down resistor RM, the DP pin 1 is grounded through the pull-down resistor RP, and the DM pin 1 and the DP pin 1 are open to each other. Therefore, when the power management circuit 203 applies the DM voltage to the DM pin 2, the voltages of the DP pin 1 and the DP pin 2 will not be pulled up accordingly, so that the control circuit 202 can detect the voltage of the DP pin 2. The voltage is less than the fifth threshold voltage.
因此,在已经排除了USB接口101为SDP端口的情况下,开启电源管理电路203中的DM电压源和DP电流源后,若DP引脚2的电压小于第五阈值电压,说明USB接口101为CDP接口,若DP引脚2的电压不小于第五阈值电压,说明USB接口101为DCP接口。Therefore, in the case that the USB interface 101 has been excluded as an SDP port, after the DM voltage source and the DP current source in the power management circuit 203 are turned on, if the voltage of the DP pin 2 is less than the fifth threshold voltage, it indicates that the USB interface 101 is For the CDP interface, if the voltage of the DP pin 2 is not less than the fifth threshold voltage, it indicates that the USB interface 101 is a DCP interface.
目前,多数支持反向充电功能的电子设备中,USB接口为SDP端口。因此,从设备在执行S303时,一般会将主设备的USB接口识别为SDP端口,进而根据SDP协议进行充电。然而,SDP协议规定了充电电流的大小不能超过500mA,致使目前反向充电的速度较慢。有鉴于此,本申请实施例对主设备(电子设备100)进行了改进,通过在电子设备100中增加上拉电路105,使从设备(电子设备200)根据BC1.2协议,可以将电子设备100的USB接口101识别为CDP端口,而CDP协议中规定了充电电流可以为1.5-5A,因此采用本申请实施例所提供的技术方案,有利于实现大电流反向充电电流,从而有利于提高反向充电的速度。At present, in most electronic devices that support the reverse charging function, the USB interface is an SDP port. Therefore, when the slave device executes S303, it generally recognizes the USB interface of the master device as an SDP port, and then charges according to the SDP protocol. However, the SDP protocol stipulates that the charging current cannot exceed 500mA, which makes the current reverse charging speed slow. In view of this, the embodiment of this application improves the master device (electronic device 100). By adding a pull-up circuit 105 in the electronic device 100, the slave device (electronic device 200) can connect the electronic device to the electronic device according to the BC1.2 protocol. The USB interface 101 of 100 is identified as a CDP port, and the CDP protocol stipulates that the charging current can be 1.5-5A. Therefore, the technical solution provided by the embodiment of the present application is beneficial to achieve a large current reverse charging current, which is beneficial to improve The speed of reverse charging.
如图2所示,电子设备100中还包括上拉电路105。上拉电路105的控制端与控制电路102耦合,上拉电路105的输出端与电源管理电路103耦合。控制电路102可以在确定接入USB OTG线300的A端之后,可以控制上拉电路105向DM引脚提供第一电压,示例性的,本申请中第一电压可以为0.6V。其中,上拉电路105既可以作为独立的电路结构设置于电子设备100中,例如,制作于电子设备100的主板上。上拉电路105也可以与控 制电路101集成于同一芯片中,本申请实施例对此并不多作限制。As shown in FIG. 2, the electronic device 100 further includes a pull-up circuit 105. The control terminal of the pull-up circuit 105 is coupled with the control circuit 102, and the output terminal of the pull-up circuit 105 is coupled with the power management circuit 103. The control circuit 102 may control the pull-up circuit 105 to provide the first voltage to the DM pin after determining that it is connected to the A terminal of the USB OTG line 300. For example, the first voltage may be 0.6V in this application. Among them, the pull-up circuit 105 can be provided in the electronic device 100 as an independent circuit structure, for example, fabricated on the main board of the electronic device 100. The pull-up circuit 105 can also be integrated with the control circuit 101 in the same chip, which is not limited in the embodiment of the present application.
具体来说,控制电路102至少可以通过以下三种可能的实现方式中的任一种,以控制上拉电路105向DP引脚1输出第一电压:Specifically, the control circuit 102 can control the pull-up circuit 105 to output the first voltage to the DP pin 1 through at least any one of the following three possible implementation manners:
在第一种可能的实现方式中,控制电路102可以在确定USB接口101接入USB OTG线300的A端之后,立即控制上拉电路105向DM引脚提供第一电压。In the first possible implementation manner, the control circuit 102 may immediately control the pull-up circuit 105 to provide the first voltage to the DM pin after determining that the USB interface 101 is connected to the A terminal of the USB OTG line 300.
在第二种可能的实现方式中,控制电路102可以在确定USB接口101接入USB OTG线300的A端之后,检测USB接口101的DP引脚1的电压。当控制电路202在执行S301开启电源管理电路203中的DP电压源后,DP引脚2被施加了DP电压,DP引脚1的电压也将被随之上拉。继而,控制电路102可以检测到DP引脚1的电压大于第三阈值电压。控制电路102可以在检测到DP引脚1的电压大于第三阈值电压后,再开启上拉电路105。控制电路202依旧可以检测到DM引脚2的电压被上拉,并继续执行S304。In the second possible implementation manner, the control circuit 102 may detect the voltage of the DP pin 1 of the USB interface 101 after determining that the USB interface 101 is connected to the A terminal of the USB OTG line 300. When the control circuit 202 executes S301 to turn on the DP voltage source in the power management circuit 203, the DP pin 2 is applied with the DP voltage, and the voltage of the DP pin 1 will also be pulled up accordingly. Then, the control circuit 102 can detect that the voltage of the DP pin 1 is greater than the third threshold voltage. The control circuit 102 may turn on the pull-up circuit 105 after detecting that the voltage of the DP pin 1 is greater than the third threshold voltage. The control circuit 202 can still detect that the voltage of the DM pin 2 is pulled up, and continues to execute S304.
在第三种可能的实现方式中,控制电路102在控制充电管理电路106向USB接口101的VBUS引脚1输出充电电压的时间达到第一时延后,开启电子设备100中用于执行BC1.2协议的DP比较器。In a third possible implementation, the control circuit 102 controls the charging management circuit 106 to output the charging voltage to the VBUS pin 1 of the USB interface 101 after the first time delay reaches the first time delay, turning on the electronic device 100 for performing BC1. 2 protocol DP comparator.
在第一时延期间,USB接口101的VBUS引脚1施加有持续的充电电压。在此期间,电子设备200可以识别有外部USB接口接入USB接口201,一般来说,第一时延与电子设备200的性能相关,可以通过实验、统计、估算等手段得到第一时延,本申请实施例对此并不多作限制。During the first time delay, a continuous charging voltage is applied to the VBUS pin 1 of the USB interface 101. During this period, the electronic device 200 can recognize that an external USB interface is connected to the USB interface 201. Generally speaking, the first delay is related to the performance of the electronic device 200, and the first delay can be obtained by means of experiment, statistics, estimation, etc. The embodiments of the application do not limit this.
针对用于执行BC1.2协议的DP比较器,该DP比较器既可能位于电源管理电路103,也有可能位于充电管理电路106,本申请实施例对此并不多作限制。DP比较器的第一输入端与DP引脚耦合,DP比较器第二输入端维持在第三阈值电压,DP比较器的输出端与控制电路102耦合,DP比较器可以在DP引脚1的电压大于第三阈值电压时,向控制电路102发送第三检测信号。具体来说,DP比较器可以通过控制总线向控制电路102发送第三检测信号,该第三检测信号可以向控制电路102指示DP引脚1的电压被上拉。控制电路102在接收到DP比较器提供的第三检测信号后,便可以根据第三检测信号确定DP引脚1的电压被上拉。控制电路102进而可以控制上拉电路105为DM引脚1提供第一电压。在上拉电路105持续为DM引脚1提供第一电压的时间达到第二时延后,控制电路102控制上拉电路105停止向DM引脚1提供第一电压。Regarding the DP comparator used to implement the BC1.2 protocol, the DP comparator may be located in the power management circuit 103 or the charging management circuit 106, which is not limited in the embodiment of the present application. The first input terminal of the DP comparator is coupled with the DP pin, the second input terminal of the DP comparator is maintained at the third threshold voltage, the output terminal of the DP comparator is coupled with the control circuit 102, and the DP comparator can be connected to the DP pin 1. When the voltage is greater than the third threshold voltage, a third detection signal is sent to the control circuit 102. Specifically, the DP comparator may send a third detection signal to the control circuit 102 through the control bus, and the third detection signal may indicate to the control circuit 102 that the voltage of the DP pin 1 is pulled up. After the control circuit 102 receives the third detection signal provided by the DP comparator, it can determine that the voltage of the DP pin 1 is pulled up according to the third detection signal. The control circuit 102 can further control the pull-up circuit 105 to provide the first voltage to the DM pin 1. After the time that the pull-up circuit 105 continues to provide the first voltage to the DM pin 1 reaches the second time delay, the control circuit 102 controls the pull-up circuit 105 to stop providing the first voltage to the DM pin 1.
在第二时延期间,电子设备200可以完成DM引脚2电压检测、开启DM电压源和DP电流源等步骤。根据BC1.2协议的规定,电子设备200开启DP电压源的时间点和开启DM电压源的时间点之间间隔40ms,因此本申请实施例中第二时延不小于40ms。在等待第二时延之后,控制电路102便可以控制上拉电路105停止向DM引脚1提供第一电压。During the second time delay, the electronic device 200 can complete the steps of detecting the voltage of the DM pin 2 and turning on the DM voltage source and the DP current source. According to the BC1.2 protocol, there is an interval of 40 ms between the time point when the electronic device 200 turns on the DP voltage source and the time point when the DM voltage source is turned on. Therefore, the second time delay in the embodiment of the present application is not less than 40 ms. After waiting for the second time delay, the control circuit 102 can control the pull-up circuit 105 to stop supplying the first voltage to the DM pin 1.
在本申请实施例中,由于USB接口101的DM引脚1被上拉电路105施加了第一电压,且USB接口101的DM引脚1可以通过USB OTG线300与USB接口201的DM引脚2耦合,因此USB接口201中DM引脚2的电压会被随之上拉,电子设备200在执行S303时,控制电路202将检测到USB接口201的DM引脚2的电压不小于第四阈值电压,进而可以继续执行S304。避免了电子设备200将USB接口101识别为SDP端口。In the embodiment of the present application, since the DM pin 1 of the USB interface 101 is applied with the first voltage by the pull-up circuit 105, and the DM pin 1 of the USB interface 101 can pass through the USB OTG line 300 and the DM pin of the USB interface 201 2 is coupled, so the voltage of the DM pin 2 of the USB interface 201 will be pulled up accordingly. When the electronic device 200 executes S303, the control circuit 202 will detect that the voltage of the DM pin 2 of the USB interface 201 is not less than the fourth threshold Voltage, and then continue to execute S304. This prevents the electronic device 200 from recognizing the USB interface 101 as an SDP port.
而本申请实施例中USB接口101实际上可以为SDP端口,如图2所示。因此,电子设备200在执行S307时,开启电源管理电路203中的DM电压源和DP电流源后,DP引脚1和DP引脚2的电压并不会被随之上拉,因此控制电路202可以检测到DP引脚2的 电压小于第五阈值电压,进而使得电子设备200可以将SDP端口(USB接口101)识别为CDP端口。In the embodiment of the present application, the USB interface 101 may actually be an SDP port, as shown in FIG. 2. Therefore, when the electronic device 200 executes S307, after the DM voltage source and the DP current source in the power management circuit 203 are turned on, the voltages of the DP pin 1 and the DP pin 2 will not be pulled up accordingly, so the control circuit 202 It can be detected that the voltage of the DP pin 2 is less than the fifth threshold voltage, so that the electronic device 200 can recognize the SDP port (USB interface 101) as a CDP port.
在此之后,电子设备200便可以根据CDP协议与电子设备100进行枚举及充电,由于CDP协议规定了充电电流可以达到1.5至5A,因此电子设备100可以以更大的充电电流(高达5A)进行反向充电,从而有利于提高反向充电的速度。After that, the electronic device 200 can enumerate and charge the electronic device 100 according to the CDP protocol. Since the CDP protocol stipulates that the charging current can reach 1.5 to 5A, the electronic device 100 can use a larger charging current (up to 5A) Reverse charging is helpful to increase the speed of reverse charging.
在一种可能的实现方式中,电子设备200在确定电子设备100的USB接口101为CDP端口后,还可以开启电源管理电路203中的DP电压源,从而为USB接口201的DP引脚2施加DP电压。USB接口101中的DP引脚1被随之上拉。在一种可能的实现方式中,控制电路101在确定USB接口101接入USB OTG线300的A端后,还可以检测DP引脚1的电压。在DP引脚1的电压首次大于第三阈值电压时,说明控制电路202正在执行S301,在DP引脚1的电压第二次大于第三阈值电压时,说明控制电路202已完成识别USB接口101的类型。控制电路102进而便可以继续执行枚举过程,以及枚举过程之后的反向充电过程。一般来说,第三阈值电压和第四阈值电压的取值相同,例如二者皆可以为0.35V。枚举过程和反向充电过程的具体实现可以参考现有协议规定,对此不再赘述。In a possible implementation, after the electronic device 200 determines that the USB interface 101 of the electronic device 100 is a CDP port, it can also turn on the DP voltage source in the power management circuit 203 to apply the DP pin 2 of the USB interface 201 DP voltage. The DP pin 1 in the USB interface 101 is pulled up accordingly. In a possible implementation manner, the control circuit 101 may also detect the voltage of the DP pin 1 after determining that the USB interface 101 is connected to the A terminal of the USB OTG line 300. When the voltage of the DP pin 1 is greater than the third threshold voltage for the first time, it means that the control circuit 202 is performing S301. When the voltage of the DP pin 1 is greater than the third threshold voltage for the second time, it means that the control circuit 202 has completed identifying the USB interface 101. type. The control circuit 102 can then continue to perform the enumeration process and the reverse charging process after the enumeration process. Generally, the third threshold voltage and the fourth threshold voltage have the same value, for example, both can be 0.35V. The specific implementation of the enumeration process and the reverse charging process can refer to the existing protocol provisions, which will not be repeated.
综上,本申请实施例提供了一种电子设备,通过在电子设备中设置上拉电路,为主设备中USB接口的DM引脚施加上拉电压,从而使从设备将主设备的USB接口识别为CDP接口,进而提高反向充电的速度。In summary, the embodiments of the present application provide an electronic device. By setting a pull-up circuit in the electronic device, a pull-up voltage is applied to the DM pin of the USB interface of the master device, so that the slave device recognizes the USB interface of the master device. It is a CDP interface to increase the speed of reverse charging.
接下来,针对本申请实施例中的上拉电路105,通过以下具体实施例作进一步说明。在本申请实施例中,上拉电路105至少存在以下两种可能的实现方式:Next, with regard to the pull-up circuit 105 in the embodiment of the present application, the following specific embodiments are used for further description. In the embodiment of the present application, the pull-up circuit 105 has at least the following two possible implementation manners:
实现方式一Realization method one
图4示例性示出了本申请实施例中上拉电路105的实现结构之一。如图4所示,上拉电路105包括第一开关管S1和第一电阻R1。其中,第一开关管S1的控制电极与控制电路102耦合,第一开关管S1的第一电极与第一电阻R1的一端耦合,第一开关管S1的第二电极与DM引脚1耦合,第一电阻R1的另一端用于接收基础电压。FIG. 4 exemplarily shows one of the implementation structures of the pull-up circuit 105 in the embodiment of the present application. As shown in FIG. 4, the pull-up circuit 105 includes a first switch S1 and a first resistor R1. Wherein, the control electrode of the first switch tube S1 is coupled with the control circuit 102, the first electrode of the first switch tube S1 is coupled with one end of the first resistor R1, and the second electrode of the first switch tube S1 is coupled with the DM pin 1. The other end of the first resistor R1 is used to receive the basic voltage.
其中,基础电压可以为电子设备中提供给常规元件的电压,一般为1.8V。在本申请实施例中,如图2虚线所示,既可以由控制电路102为上拉电路105提供基础电压,也可以由电源管理电路103为上拉电路105提供基础电压,本申请实施例对此并不多作限制。Among them, the base voltage can be a voltage provided to conventional components in an electronic device, and is generally 1.8V. In the embodiment of the present application, as shown by the dashed line in FIG. 2, either the control circuit 102 may provide the basic voltage for the pull-up circuit 105, or the power management circuit 103 may provide the basic voltage for the pull-up circuit 105. This is not too restrictive.
为了模仿CDP端口的DM引脚在USB接口识别过程中的电压状态,本申请实施例中上拉电路105可以对基础电压进行分压后得到第一电压,使施加给DM引脚1的第一电压趋近于DM电压源输出的DM电压。In order to imitate the voltage state of the DM pin of the CDP port during the USB interface identification process, the pull-up circuit 105 in the embodiment of the present application can divide the basic voltage to obtain the first voltage, so that the first voltage applied to the DM pin 1 The voltage approaches the DM voltage output by the DM voltage source.
示例性的,可以将控制电路102中的一个GPIO端口配置为控制端口,通过该GPIO端口控制第一开关管S1的导通或断开,从而控制上拉电路105的工作。其中,第一开关管S1既可以是如图4所示的双极型晶体管,也可以是如图5所示的场效应晶体管,本申请实施例对此并不多作限制。Exemplarily, one GPIO port in the control circuit 102 may be configured as a control port, and the first switch S1 is controlled to be turned on or off through the GPIO port, thereby controlling the operation of the pull-up circuit 105. The first switch S1 can be either a bipolar transistor as shown in FIG. 4 or a field effect transistor as shown in FIG. 5, which is not limited in the embodiment of the present application.
具体来说,控制电路102在接收到第一检测信号后,便可以导通第一开关管S1。第一开关管S1导通后,第一电阻R1、第一开关管S1和DM引脚1的接地电阻RM构成分压电路,基础电压经第一电阻R1和接地电阻RM分压后,得到第一电压。其中,第一电压满足以下公式一:Specifically, after receiving the first detection signal, the control circuit 102 can turn on the first switch S1. After the first switch S1 is turned on, the first resistor R1, the first switch S1, and the grounding resistance RM of the DM pin 1 form a voltage divider circuit. After the basic voltage is divided by the first resistor R1 and the grounding resistor RM, the first One voltage. Among them, the first voltage satisfies the following formula 1:
Figure PCTCN2020113319-appb-000001
Figure PCTCN2020113319-appb-000001
其中,V 1为第一电压的电压值,r1为第一电阻R1的阻值,rM为接地电阻RM的阻值,V 0为基础电压的电压值。 Among them, V 1 is the voltage value of the first voltage, r1 is the resistance value of the first resistor R1, rM is the resistance value of the grounding resistor RM, and V 0 is the voltage value of the base voltage.
控制电路102断开第一开关管S1,便可以控制上拉电路105停止向DM引脚施加第一电压。The control circuit 102 turns off the first switch S1, and can control the pull-up circuit 105 to stop applying the first voltage to the DM pin.
在一种可能的实现方式中,上拉电路105中还可以包括第二电阻R2。如图4所示,第二电阻R2的一端与控制电路102耦合,第二电阻R2的另一端与第一开关管S1的控制电极耦合。在第一开关管S1为双极型晶体管的情况下,第二电阻R2可以降低输入第一开关管S1控制电极(基极)的电流,并且可以通过基极电流确定第一电阻R1的阻值,使对第一电阻R1的配置更加方便。In a possible implementation manner, the pull-up circuit 105 may further include a second resistor R2. As shown in FIG. 4, one end of the second resistor R2 is coupled with the control circuit 102, and the other end of the second resistor R2 is coupled with the control electrode of the first switch S1. When the first switch S1 is a bipolar transistor, the second resistor R2 can reduce the current input to the control electrode (base) of the first switch S1, and the resistance of the first resistor R1 can be determined by the base current , Which makes the configuration of the first resistor R1 more convenient.
示例性的,假设输入第一开关管S1的控制电极的电流为1mA,第一开关管S1的放大倍数为2,则可以得到经过第一电阻R1的电流为2mA。假设基础电压为1.8V,第一电压为0.6V,控制电极的电流为1mA时第一开关管S1中第一电极与第二电极之间的压降为0.3V,则可以计算得到第一电阻R1需要产生0.9V压降,进而可以根据经过第一电阻R1的2mA电流,计算得到第一电阻R1的阻值应配置为150Ω。Exemplarily, assuming that the current input to the control electrode of the first switching tube S1 is 1 mA, and the amplification factor of the first switching tube S1 is 2, the current passing through the first resistor R1 can be obtained as 2 mA. Assuming that the base voltage is 1.8V, the first voltage is 0.6V, and the current of the control electrode is 1mA, the voltage drop between the first electrode and the second electrode in the first switch S1 is 0.3V, then the first resistance can be calculated R1 needs to generate a 0.9V voltage drop, and then according to the 2mA current passing through the first resistor R1, it can be calculated that the resistance of the first resistor R1 should be configured to be 150Ω.
实现方式二Realization method two
图6示例性示出了本申请实施例中上拉电路105的另一种实现结构。如图6所示,上拉电路105包括第三电阻R3,第三电阻R3的一端与控制电路102耦合,第三电阻R3的另一端与DM引脚1耦合。控制电路102在接收到第一检测信号后,向第三电阻R3输出基础电压。在控制电路102停止向第三电阻R3输出基础电压后,第三电阻R3便会停止向DP引脚1施加第一电压。FIG. 6 exemplarily shows another implementation structure of the pull-up circuit 105 in the embodiment of the present application. As shown in FIG. 6, the pull-up circuit 105 includes a third resistor R3, one end of the third resistor R3 is coupled to the control circuit 102, and the other end of the third resistor R3 is coupled to the DM pin 1. After receiving the first detection signal, the control circuit 102 outputs the basic voltage to the third resistor R3. After the control circuit 102 stops outputting the basic voltage to the third resistor R3, the third resistor R3 stops applying the first voltage to the DP pin 1.
在该实现方式中,第三电阻R3可以与DM引脚1的接地电阻RM构成分压电路,当控制电路102向第三电阻R3输出基础电压时,基础电压经第三电阻R3和接地电阻RM分压后,得到第一电压,第一电压满足上述公式一,对此不再赘述。In this implementation, the third resistor R3 and the ground resistor RM of the DM pin 1 can form a voltage divider circuit. When the control circuit 102 outputs the basic voltage to the third resistor R3, the basic voltage passes through the third resistor R3 and the ground resistor RM. After the voltage is divided, the first voltage is obtained, and the first voltage satisfies the above formula 1, which will not be repeated here.
综上,本申请实施例在主设备中增加了上拉电路,该上拉电路可以为主设备的DM引脚施加第一电压,使得从设备可以将主设备的USB接口识别为CDP端口。本申请实施例中,上拉电路结构简单,易于实现,且与现有的USB 2.0协议和BC 1.2协议皆可以兼容。In summary, the embodiment of the present application adds a pull-up circuit to the master device, and the pull-up circuit can apply the first voltage to the DM pin of the master device, so that the slave device can recognize the USB interface of the master device as a CDP port. In the embodiment of the present application, the pull-up circuit has a simple structure, is easy to implement, and is compatible with the existing USB 2.0 protocol and BC 1.2 protocol.
基于相同的技术构思,本申请实施例还提供一种反向充电方法。该方法可以应用于图2所示的控制电路102中。图7示例性示出了本申请实施例提供的一种反向充电方法流程示意图,如图7所示,主要包括:Based on the same technical concept, the embodiment of the present application also provides a reverse charging method. This method can be applied to the control circuit 102 shown in FIG. 2. FIG. 7 exemplarily shows a schematic flowchart of a reverse charging method provided by an embodiment of the present application. As shown in FIG. 7, it mainly includes:
S701:在确定USB接口101接入活动式USB OTG线300的主设备端后,控制上拉电路105向DM引脚1提供第一电压,该第一电压用于指示USB接口为充电下行端口CDP。具体实现方式可以参考上述实施例中控制电路101执行的步骤,对此不再赘述。S701: After determining that the USB interface 101 is connected to the main device end of the movable USB OTG line 300, control the pull-up circuit 105 to provide a first voltage to the DM pin 1. The first voltage is used to indicate that the USB interface is a charging downstream port CDP . For a specific implementation manner, reference may be made to the steps executed by the control circuit 101 in the foregoing embodiment, which will not be described in detail.
其中,控制电路102至少可以通过以下两种方式确定USB接口101是否接入USB OTG线300的主设备端:Wherein, the control circuit 102 can determine whether the USB interface 101 is connected to the main device end of the USB OTG line 300 by at least the following two methods:
在一种可能的实现方式中,电子设备还包括电源管理电路103,该电源管理电路103与电子设备的USB接口101的触发引脚耦合;电源管理电路103可以在检测到触发引脚的电压低于第一阈值电压后,向控制电路102发送第一检测信号;控制电路102可以在接收到所述第一检测信号后,确定USB接口101接入USB OTG线300的主设备端。In a possible implementation, the electronic device further includes a power management circuit 103, which is coupled to the trigger pin of the USB interface 101 of the electronic device; the power management circuit 103 can detect that the voltage of the trigger pin is low. After the first threshold voltage, the first detection signal is sent to the control circuit 102; the control circuit 102 may determine that the USB interface 101 is connected to the host device end of the USB OTG line 300 after receiving the first detection signal.
其中,USB接口101的触发引脚由USB接口101的具体类型决定。例如,Micro USB接口中该触发引脚可以是ID引脚,又例如USB Type-C接口中该触发引脚可以是CC引脚。Among them, the trigger pin of the USB interface 101 is determined by the specific type of the USB interface 101. For example, the trigger pin in the Micro USB interface may be an ID pin, and for example, the trigger pin in the USB Type-C interface may be a CC pin.
在另一种可能的实现方式中,控制电路102还与USB接口101的触发引脚耦合;控制电路102还可以在检测到触发引脚的电压低于第一阈值电压后,确定USB接口101接入USB OTG线300的主设备端。In another possible implementation manner, the control circuit 102 is also coupled with the trigger pin of the USB interface 101; the control circuit 102 may also determine that the USB interface 101 is connected after detecting that the voltage of the trigger pin is lower than the first threshold voltage. Enter the main device end of the USB OTG line 300.
在一种可能的实现方式中,电子设备还包括充电管理电路106,该充电管理电路106与USB接口101的VBUS引脚耦合;控制电路102还可以在确定USB接口101接入USB OTG线300的主设备端后,控制充电管理电路106向USB接口101的VBUS引脚输出充电电压。In a possible implementation, the electronic device further includes a charging management circuit 106, which is coupled to the VBUS pin of the USB interface 101; the control circuit 102 may also determine whether the USB interface 101 is connected to the USB OTG line 300 After the host device, the charging management circuit 106 is controlled to output the charging voltage to the VBUS pin of the USB interface 101.
在本申请实施例中,控制电路102至少可以通过以下两种方式更为精确地控制上拉电路105输出第一电压的时间:In the embodiment of the present application, the control circuit 102 can more accurately control the time when the pull-up circuit 105 outputs the first voltage in at least the following two ways:
在一种可能的实现方式中,控制电路102可以在控制充电管理电路106向USB接口101的VBUS引脚输出充电电压的时间达到第一时延之后,开启用于执行BC1.2协议的DP比较器;在接收到DP比较器提供的第三检测信号后,再控制上拉电路105向所述DM引脚提供第一电压。In a possible implementation, the control circuit 102 may start the DP comparison for executing the BC1.2 protocol after the time for controlling the charging management circuit 106 to output the charging voltage to the VBUS pin of the USB interface 101 reaches the first time delay.器: After receiving the third detection signal provided by the DP comparator, then control the pull-up circuit 105 to provide the first voltage to the DM pin.
在另一种可能的实现方式中,控制电路102可以在确定USB接口101接入USB OTG线300的主设备端后,检测USB接口101的数字正DP引脚的电压;在检测到DP引脚的电压大于第三阈值电压后,控制上拉电路105向所述DM引脚提供第一电压。In another possible implementation manner, the control circuit 102 may detect the voltage of the digital positive DP pin of the USB interface 101 after determining that the USB interface 101 is connected to the main device end of the USB OTG line 300; after detecting the DP pin After the voltage of is greater than the third threshold voltage, the pull-up circuit 105 is controlled to provide the first voltage to the DM pin.
在本申请实施例中,上拉电路105存在多种可能的实现方式,示例性的:In the embodiment of the present application, there are multiple possible implementation manners for the pull-up circuit 105, for example:
在一种可能的实现方式中,上拉电路105包括第一开关管和第一电阻;其中,第一开关管的控制电极与控制电路102耦合,第一开关管的第一电极与第一电阻的一端耦合,第一开关管的第二电极与DM引脚耦合,第一电阻的另一端用于接收基础电压;控制电路102可以在确定USB接口101接入USB OTG线300的主设备端后,导通第一开关管。In a possible implementation, the pull-up circuit 105 includes a first switch tube and a first resistor; wherein, the control electrode of the first switch tube is coupled to the control circuit 102, and the first electrode of the first switch tube is coupled to the first resistor. The second electrode of the first switch tube is coupled to the DM pin, and the other end of the first resistor is used to receive the basic voltage; the control circuit 102 can determine that the USB interface 101 is connected to the main device end of the USB OTG line 300 , Turn on the first switch tube.
示例性的,上述上拉电路105还可以包括第二电阻,该第二电阻的一端与控制电路102耦合,第二电阻的另一端与第一开关管的控制电极耦合。Exemplarily, the pull-up circuit 105 may further include a second resistor, one end of the second resistor is coupled to the control circuit 102, and the other end of the second resistor is coupled to the control electrode of the first switch tube.
示例性的,上述第一开关管可以为双极型晶体管或场效应晶体管。Exemplarily, the above-mentioned first switch tube may be a bipolar transistor or a field effect transistor.
示例性的,上述基础电压可以是控制电路102或电源管理电路103为上拉电路105提供的电压。Exemplarily, the above-mentioned basic voltage may be the voltage provided by the control circuit 102 or the power management circuit 103 for the pull-up circuit 105.
在另一种可能的实现方式中,上拉电路105包括第三电阻;第三电阻的一端与控制电路102耦合,第三电阻的另一端与所述DM引脚耦合;控制电路102可以确定USB接口101接入USB OTG线300的主设备端后,向第三电阻输出基础电压。In another possible implementation manner, the pull-up circuit 105 includes a third resistor; one end of the third resistor is coupled to the control circuit 102, and the other end of the third resistor is coupled to the DM pin; the control circuit 102 can determine the USB After the interface 101 is connected to the main device end of the USB OTG line 300, it outputs the basic voltage to the third resistor.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the application without departing from the spirit and scope of the application. In this way, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application is also intended to include these modifications and variations.

Claims (24)

  1. 一种电子设备,其特征在于,包括:通用串行总线USB接口、上拉电路和控制电路,所述USB接口为标准下行端口SDP;An electronic device, characterized by comprising: a universal serial bus USB interface, a pull-up circuit and a control circuit, the USB interface being a standard downstream port SDP;
    其中,所述上拉电路分别与所述USB接口的数字负DM引脚和所述控制电路耦合;Wherein, the pull-up circuit is respectively coupled with the digital negative DM pin of the USB interface and the control circuit;
    所述控制电路用于:The control circuit is used for:
    在确定所述USB接口接入USB活动式OTG线的主设备端后,控制所述上拉电路向所述DM引脚提供第一电压,所述第一电压用于指示所述USB接口为充电下行端口CDP。After it is determined that the USB interface is connected to the main device end of the USB movable OTG line, the pull-up circuit is controlled to provide a first voltage to the DM pin, and the first voltage is used to indicate that the USB interface is charging Downstream port CDP.
  2. 根据权利要求1所述的电子设备,其特征在于,所述电子设备还包括电源管理电路,所述电源管理电路与所述USB接口的触发引脚耦合;The electronic device according to claim 1, wherein the electronic device further comprises a power management circuit, and the power management circuit is coupled to a trigger pin of the USB interface;
    所述电源管理电路用于:在检测到所述触发引脚的电压低于第一阈值电压后,向所述控制电路发送第一检测信号;The power management circuit is configured to send a first detection signal to the control circuit after detecting that the voltage of the trigger pin is lower than a first threshold voltage;
    所述控制电路还用于:在接收到所述第一检测信号后,确定所述USB接口接入USBOTG线的主设备端。The control circuit is further configured to: after receiving the first detection signal, determine that the USB interface is connected to the host device end of the USBOTG line.
  3. 根据权利要求1所述的电子设备,其特征在于,所述控制电路还与所述USB接口的触发引脚耦合;The electronic device according to claim 1, wherein the control circuit is further coupled with a trigger pin of the USB interface;
    所述控制电路还用于:在检测到所述触发引脚的电压低于第一阈值电压后,确定所述USB接口接入USB OTG线的主设备端。The control circuit is further configured to: after detecting that the voltage of the trigger pin is lower than the first threshold voltage, determine that the USB interface is connected to the main device end of the USB OTG line.
  4. 根据权利要求1至3中任一项所述的电子设备,其特征在于,所述电子设备还包括充电管理电路,所述充电管理电路与所述USB接口的VBUS引脚耦合;The electronic device according to any one of claims 1 to 3, wherein the electronic device further comprises a charging management circuit, and the charging management circuit is coupled to the VBUS pin of the USB interface;
    所述控制电路还用于:在确定所述USB接口接入USB OTG线的主设备端后,控制所述充电管理电路向所述USB接口的VBUS引脚输出充电电压。The control circuit is also used to control the charging management circuit to output a charging voltage to the VBUS pin of the USB interface after determining that the USB interface is connected to the main device end of the USB OTG line.
  5. 根据权利要求4所述的电子设备,其特征在于,所述控制电路,具体用于:The electronic device according to claim 4, wherein the control circuit is specifically used for:
    在控制所述充电管理电路向所述USB接口的VBUS引脚输出充电电压的时间达到第一时延之后,开启用于执行BC1.2协议的DP比较器;After controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface for the first time delay, turn on the DP comparator for executing the BC1.2 protocol;
    在接收到所述DP比较器提供的第三检测信号后,控制所述上拉电路向所述DM引脚提供第一电压。After receiving the third detection signal provided by the DP comparator, control the pull-up circuit to provide the first voltage to the DM pin.
  6. 根据权利要求1至4中任一项所述的电子设备,其特征在于,所述控制电路,具体用于:The electronic device according to any one of claims 1 to 4, wherein the control circuit is specifically used for:
    在确定所述USB接口接入USB OTG线的主设备端后,检测所述USB接口的数字正DP引脚的电压;After determining that the USB interface is connected to the main device end of the USB OTG line, detecting the voltage of the digital positive DP pin of the USB interface;
    在检测到所述DP引脚的电压大于第三阈值电压后,控制所述上拉电路向所述DM引脚提供第一电压。After detecting that the voltage of the DP pin is greater than the third threshold voltage, the pull-up circuit is controlled to provide the first voltage to the DM pin.
  7. 根据权利要求5或6所述的电子设备,其特征在于,所述控制电路还用于:The electronic device according to claim 5 or 6, wherein the control circuit is further used for:
    在控制所述上拉电路向所述DM引脚提供第一电压的时间达到第二时延之后,控制所述上拉电路停止向所述DM引脚提供第一电压。After the time for controlling the pull-up circuit to provide the first voltage to the DM pin reaches the second time delay, the pull-up circuit is controlled to stop providing the first voltage to the DM pin.
  8. 根据权利要求1至7中任一项所述的电子设备,其特征在于,所述上拉电路包括第一开关管和第一电阻;The electronic device according to any one of claims 1 to 7, wherein the pull-up circuit comprises a first switch tube and a first resistor;
    所述第一开关管的控制电极与所述控制电路耦合,所述第一开关管的第一电极与所述第一电阻的一端耦合,所述第一开关管的第二电极与所述DM引脚耦合,所述第一电阻的 另一端用于接收基础电压;The control electrode of the first switch tube is coupled with the control circuit, the first electrode of the first switch tube is coupled with one end of the first resistor, and the second electrode of the first switch tube is coupled with the DM Pin coupling, the other end of the first resistor is used to receive the basic voltage;
    所述控制电路具体用于:The control circuit is specifically used for:
    在确定所述USB接口接入USB OTG线的主设备端后,导通所述第一开关管。After it is determined that the USB interface is connected to the main device end of the USB OTG line, the first switch tube is turned on.
  9. 根据权利要求8所述的电子设备,其特征在于,所述上拉电路还包括第二电阻,所述第二电阻的一端与所述控制电路耦合,所述第二电阻的另一端与所述第一开关管的控制电极耦合。8. The electronic device according to claim 8, wherein the pull-up circuit further comprises a second resistor, one end of the second resistor is coupled to the control circuit, and the other end of the second resistor is coupled to the control circuit. The control electrode of the first switch tube is coupled.
  10. 根据权利要求8或9所述的电子设备,其特征在于,所述第一开关管为双极型晶体管或场效应晶体管。The electronic device according to claim 8 or 9, wherein the first switch tube is a bipolar transistor or a field effect transistor.
  11. 根据权利要求8至10中任一项所述的电子设备,其特征在于,所述基础电压为所述控制电路或电源管理电路为所述上拉电路提供的电压。The electronic device according to any one of claims 8 to 10, wherein the base voltage is a voltage provided by the control circuit or power management circuit for the pull-up circuit.
  12. 根据权利要求1至7中任一项所述的电子设备,其特征在于,所述上拉电路包括第三电阻;The electronic device according to any one of claims 1 to 7, wherein the pull-up circuit comprises a third resistor;
    所述第三电阻的一端与所述控制电路耦合,所述第三电阻的另一端与所述DM引脚耦合;One end of the third resistor is coupled with the control circuit, and the other end of the third resistor is coupled with the DM pin;
    所述控制电路具体用于:The control circuit is specifically used for:
    在确定所述USB接口接入USB OTG线的主设备端后,向所述第三电阻输出基础电压。After it is determined that the USB interface is connected to the main device end of the USB OTG line, the basic voltage is output to the third resistor.
  13. 一种反向充电方法,其特征在于,应用于控制电路,所述控制电路与上拉电路耦合,所述上拉电路与通用串行总线USB接口的数字负DM引脚耦合,所述USB接口为标准下行端口SDP;A reverse charging method, characterized in that it is applied to a control circuit, the control circuit is coupled with a pull-up circuit, the pull-up circuit is coupled with the digital negative DM pin of a universal serial bus USB interface, and the USB interface It is the standard downstream port SDP;
    所述方法包括:The method includes:
    在确定所述USB接口接入USB活动式OTG线的主设备端后,控制所述上拉电路向所述DM引脚提供第一电压,所述第一电压用于指示所述USB接口为充电下行端口CDP。After it is determined that the USB interface is connected to the main device end of the USB movable OTG line, the pull-up circuit is controlled to provide a first voltage to the DM pin, and the first voltage is used to indicate that the USB interface is charging Downstream port CDP.
  14. 根据权利要求13所述的方法,其特征在于,所述控制电路还与电源管理电路耦合,所述电源管理电路与所述USB接口的触发引脚耦合;所述电源管理电路,用于在检测到所述触发引脚的电压低于第一阈值电压后,向所述控制电路发送第一检测信号;The method according to claim 13, wherein the control circuit is further coupled with a power management circuit, and the power management circuit is coupled with a trigger pin of the USB interface; the power management circuit is used for detecting Sending a first detection signal to the control circuit after the voltage of the trigger pin is lower than the first threshold voltage;
    所述方法还包括:在接收到所述第一检测信号后,确定所述USB接口接入USB OTG线的主设备端。The method further includes: after receiving the first detection signal, determining that the USB interface is connected to the main device end of the USB OTG line.
  15. 根据权利要求13所述的方法,其特征在于,所述控制电路还与所述USB接口的触发引脚耦合;The method according to claim 13, wherein the control circuit is further coupled with a trigger pin of the USB interface;
    所述方法还包括:在检测到所述触发引脚的电压低于第一阈值电压后,确定所述USB接口接入USB OTG线的主设备端。The method further includes: after detecting that the voltage of the trigger pin is lower than the first threshold voltage, determining that the USB interface is connected to the main device end of the USB OTG line.
  16. 根据权利要求13至15中任一项所述的方法,其特征在于,所述控制电路还与充电管理电路耦合,所述充电管理电路与所述USB接口的VBUS引脚耦合;The method according to any one of claims 13 to 15, wherein the control circuit is further coupled with a charging management circuit, and the charging management circuit is coupled with the VBUS pin of the USB interface;
    在确定所述USB接口接入USB OTG线的主设备端后,所述方法还包括:控制所述充电管理电路向所述USB接口的VBUS引脚输出充电电压。After determining that the USB interface is connected to the main device end of the USB OTG line, the method further includes: controlling the charging management circuit to output a charging voltage to the VBUS pin of the USB interface.
  17. 根据权利要求16所述的方法,其特征在于,在确定所述USB接口接入USB OTG线的主设备端后,控制所述上拉电路向所述DM引脚提供第一电压,所述第一电压用于指示所述USB接口为充电下行端口CDP,包括:The method according to claim 16, wherein after determining that the USB interface is connected to the main device end of the USB OTG line, the pull-up circuit is controlled to provide the first voltage to the DM pin, and the second A voltage is used to indicate that the USB interface is a charging downstream port CDP, including:
    在控制所述充电管理电路向所述USB接口的VBUS引脚输出充电电压的时间达到第一时延之后,开启用于执行BC1.2协议的DP比较器;After controlling the charging management circuit to output the charging voltage to the VBUS pin of the USB interface for the first time delay, turn on the DP comparator for executing the BC1.2 protocol;
    在接收到所述DP比较器提供的第三检测信号后,控制所述上拉电路向所述DM引脚提供第一电压。After receiving the third detection signal provided by the DP comparator, control the pull-up circuit to provide the first voltage to the DM pin.
  18. 根据权利要求13至16中任一项所述的方法,其特征在于,在确定所述USB接口接入USB OTG线的主设备端后,控制所述上拉电路向所述DM引脚提供第一电压,所述第一电压用于指示所述USB接口为充电下行端口CDP,包括:The method according to any one of claims 13 to 16, wherein after determining that the USB interface is connected to the main device end of the USB OTG line, the pull-up circuit is controlled to provide the DM pin with a A voltage, the first voltage is used to indicate that the USB interface is a charging downstream port CDP, including:
    在确定所述USB接口接入USB OTG线的主设备端后,检测所述USB接口的数字正DP引脚的电压;After determining that the USB interface is connected to the main device end of the USB OTG line, detecting the voltage of the digital positive DP pin of the USB interface;
    在检测到所述DP引脚的电压大于第三阈值电压后,控制所述上拉电路向所述DM引脚提供第一电压。After detecting that the voltage of the DP pin is greater than the third threshold voltage, the pull-up circuit is controlled to provide the first voltage to the DM pin.
  19. 根据权利要求17或18所述的方法,其特征在于,控制所述上拉电路向所述DM引脚提供第一电压之后,还包括:The method according to claim 17 or 18, wherein after controlling the pull-up circuit to provide the first voltage to the DM pin, the method further comprises:
    在控制所述上拉电路向所述DM引脚提供第一电压的时间达到第二时延之后,控制所述上拉电路停止向所述DM引脚提供第一电压。After the time for controlling the pull-up circuit to provide the first voltage to the DM pin reaches the second time delay, the pull-up circuit is controlled to stop providing the first voltage to the DM pin.
  20. 根据权利要求13至19中任一项所述的方法,其特征在于,所述上拉电路包括第一开关管和第一电阻;The method according to any one of claims 13 to 19, wherein the pull-up circuit comprises a first switch tube and a first resistor;
    所述第一开关管的控制电极与所述控制电路耦合,所述第一开关管的第一电极与所述第一电阻的一端耦合,所述第一开关管的第二电极与所述DM引脚耦合,所述第一电阻的另一端用于接收基础电压;The control electrode of the first switch tube is coupled with the control circuit, the first electrode of the first switch tube is coupled with one end of the first resistor, and the second electrode of the first switch tube is coupled with the DM Pin coupling, the other end of the first resistor is used to receive the basic voltage;
    在确定所述USB接口接入USB OTG线的主设备端后,控制所述上拉电路向所述DM引脚提供第一电压,包括:After determining that the USB interface is connected to the main device end of the USB OTG line, controlling the pull-up circuit to provide the first voltage to the DM pin includes:
    在确定所述USB接口接入USB OTG线的主设备端后,导通所述第一开关管。After it is determined that the USB interface is connected to the main device end of the USB OTG line, the first switch tube is turned on.
  21. 根据权利要求20所述的方法,其特征在于,所述上拉电路还包括第二电阻,所述第二电阻的一端与所述控制电路耦合,所述第二电阻的另一端与所述第一开关管的控制电极耦合。The method according to claim 20, wherein the pull-up circuit further comprises a second resistor, one end of the second resistor is coupled to the control circuit, and the other end of the second resistor is coupled to the first resistor. The control electrode of a switch tube is coupled.
  22. 根据权利要求20或21所述的方法,其特征在于,所述第一开关管为双极型晶体管或场效应晶体管。The method according to claim 20 or 21, wherein the first switch tube is a bipolar transistor or a field effect transistor.
  23. 根据权利要求20至22中任一项所述的方法,其特征在于,所述基础电压为所述控制电路或电源管理电路为所述上拉电路提供的电压。The method according to any one of claims 20 to 22, wherein the base voltage is a voltage provided by the control circuit or power management circuit for the pull-up circuit.
  24. 根据权利要求13至19中任一项所述的方法,其特征在于,所述上拉电路包括第三电阻;The method according to any one of claims 13 to 19, wherein the pull-up circuit comprises a third resistor;
    所述第三电阻的一端与所述控制电路耦合,所述第三电阻的另一端与所述DM引脚耦合;One end of the third resistor is coupled with the control circuit, and the other end of the third resistor is coupled with the DM pin;
    在确定所述USB接口接入USB OTG线的主设备端后,控制所述上拉电路向所述DM引脚提供第一电压,包括:After determining that the USB interface is connected to the main device end of the USB OTG line, controlling the pull-up circuit to provide the first voltage to the DM pin includes:
    在确定所述USB接口接入USB OTG线的主设备端后,向所述第三电阻输出基础电压。After it is determined that the USB interface is connected to the main device end of the USB OTG line, the basic voltage is output to the third resistor.
PCT/CN2020/113319 2019-10-31 2020-09-03 Electronic device and reverse charging method WO2021082731A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911054726.2A CN110829523B (en) 2019-10-31 2019-10-31 Electronic equipment and reverse charging method
CN201911054726.2 2019-10-31

Publications (1)

Publication Number Publication Date
WO2021082731A1 true WO2021082731A1 (en) 2021-05-06

Family

ID=69552210

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/113319 WO2021082731A1 (en) 2019-10-31 2020-09-03 Electronic device and reverse charging method

Country Status (2)

Country Link
CN (1) CN110829523B (en)
WO (1) WO2021082731A1 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110829523B (en) * 2019-10-31 2021-12-31 华为技术有限公司 Electronic equipment and reverse charging method
CN113162129A (en) * 2020-01-22 2021-07-23 华为技术有限公司 Electronic equipment, charging method and system
CN111245057B (en) * 2020-03-06 2022-01-18 维沃移动通信有限公司 Electronic equipment
CN111404227A (en) * 2020-03-30 2020-07-10 维沃移动通信有限公司 Charging method, OTG cable and electronic equipment
CN111722122B (en) * 2020-06-01 2023-01-03 Oppo广东移动通信有限公司 Detection method, detection device, electronic equipment and computer-readable storage medium
CN116742740B (en) * 2020-06-30 2024-06-11 荣耀终端有限公司 Charging device and electronic equipment
CN114631244A (en) * 2020-07-15 2022-06-14 华为技术有限公司 Data transmission method based on charging cable and electronic equipment
CN113312227B (en) * 2021-06-25 2023-01-17 展讯通信(上海)有限公司 OTG function detection method, system, device and equipment
CN114460478B (en) * 2021-07-30 2023-01-24 荣耀终端有限公司 Detection method and circuit for electronic equipment battery and electronic equipment
CN116054309B (en) * 2022-08-02 2023-12-19 荣耀终端有限公司 Charging circuit, electronic device, charging system and reverse charging method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101888185A (en) * 2009-05-12 2010-11-17 中国电子为华实业发展有限公司 Switch power circuit and power supply short circuit over-current protection circuit
US20160087474A1 (en) * 2014-08-26 2016-03-24 Christian Kellen Tallada Apparatus, System and Method for Charging a Mobile Device
CN106300533A (en) * 2016-08-31 2017-01-04 宇龙计算机通信科技(深圳)有限公司 A kind of charging method and device
CN106655316A (en) * 2016-09-21 2017-05-10 奇酷互联网络科技(深圳)有限公司 Charging circuit and terminal equipment
CN108631401A (en) * 2018-05-23 2018-10-09 北京小米移动软件有限公司 Charging circuit, method, electronic equipment and storage medium
CN110829523A (en) * 2019-10-31 2020-02-21 华为技术有限公司 Electronic equipment and reverse charging method
CN211239378U (en) * 2019-12-10 2020-08-11 维沃移动通信有限公司 Charging circuit and electronic device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108964182B (en) * 2018-07-17 2020-12-04 北京小米移动软件有限公司 Reverse charging equipment, and method and device for adjusting reverse charging current

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101888185A (en) * 2009-05-12 2010-11-17 中国电子为华实业发展有限公司 Switch power circuit and power supply short circuit over-current protection circuit
US20160087474A1 (en) * 2014-08-26 2016-03-24 Christian Kellen Tallada Apparatus, System and Method for Charging a Mobile Device
CN106300533A (en) * 2016-08-31 2017-01-04 宇龙计算机通信科技(深圳)有限公司 A kind of charging method and device
CN106655316A (en) * 2016-09-21 2017-05-10 奇酷互联网络科技(深圳)有限公司 Charging circuit and terminal equipment
CN108631401A (en) * 2018-05-23 2018-10-09 北京小米移动软件有限公司 Charging circuit, method, electronic equipment and storage medium
CN110829523A (en) * 2019-10-31 2020-02-21 华为技术有限公司 Electronic equipment and reverse charging method
CN211239378U (en) * 2019-12-10 2020-08-11 维沃移动通信有限公司 Charging circuit and electronic device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WANG, CHUANBEI ET AL., UNDERSTANDING USB SYSTEMS DEVELOPMENT BASED ON ARM CORTEX-M3, 31 August 2012 (2012-08-31), XP009527872 *

Also Published As

Publication number Publication date
CN110829523A (en) 2020-02-21
CN110829523B (en) 2021-12-31

Similar Documents

Publication Publication Date Title
WO2021082731A1 (en) Electronic device and reverse charging method
US10241935B2 (en) Portable device, cable assembly, and USB system
US10671135B2 (en) Intelligent mobile power supply and method for USB data communication therewith
WO2013168289A1 (en) Electronic device and control method therefor
US9866055B2 (en) Automatic scheme to detect multi-standard charger types
CN108988431B (en) Multi-protocol charging device and multi-protocol charging method
US8880909B2 (en) Auto-detect polling for correct handshake to USB client
EP3086433A1 (en) Charging method, alternating current adaptor, charging management device and terminal
CN106502939B (en) USB adapter and data transmission equipment
WO2018082583A1 (en) Charging method, terminal and charging adapter
US9018896B2 (en) Method and system for determining whether a portable device is charging
WO2013178146A1 (en) Tablet interface extension method and device
CN104081368A (en) Mobile device automatic detection apparatus and method
WO2017063459A1 (en) Usb control apparatus and device
US9590441B2 (en) Multi-standard compliant USB battery charging scheme with detection of host disconnection in ACA-DOCK mode
CN107643998B (en) System for realizing OTG and charging dual functions based on intelligent module
EP4336309A1 (en) Electronic device, device identification method, and charging system
WO2023077919A1 (en) Impedance detection method for charging cable, electronic device and power supply device
CN109346883A (en) A kind of system for realizing the positive anti-plug of Type-C interface
WO2020233575A1 (en) Method for realizing usb otg function
WO2005112220A1 (en) A portable electronic equipment and an extending head of the equipment and a charging interface of the charging device of the equipment
TW201814543A (en) Apparatus and method for USB charge and communication
CN113030794B (en) Device detection method and device, computer readable medium and electronic device
CN203643893U (en) Terminal equipment
CN112821156B (en) Electronic tags chip and TYPE-C data line

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20880806

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20880806

Country of ref document: EP

Kind code of ref document: A1