Electronic device, charging method and system

By providing DM voltage to the USB interface after OTG is connected to the main device interface of the device, so that it is recognized as CDP, the problem of slow reverse charging speed in the existing technology is solved, and efficient large current charging and charging speed improvement are achieved. .

CN113162129BActive Publication Date: 2024-09-06HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010074072.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-22
Publication Date
2024-09-06
Estimated Expiration
2040-01-22

AI Technical Summary

Technical Problem

In the existing reverse charging technology, the USB interface is mostly a standard downstream port (SDP), which limits the charging current to 500mA and the reverse charging speed is low, which cannot meet the demand for efficient charging.

Method used

After the OTG is connected to the main device interface of the device, the control unit provides DM voltage to the DM pin of the USB interface, so that the slave device recognizes the USB interface of the main device as the charging downstream port (CDP) to achieve high current reverse charging.

Benefits of technology

The reverse charging speed is improved, and the charging current can reach 1.5 to 5A, meeting the demand for efficient charging and supporting communication with slave devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113162129B
    Figure CN113162129B
Patent Text Reader

Abstract

The embodiments of the present application provide an electronic device, a charging method and a system, which can be applied to a master device in a reverse charging scenario. The electronic device may include a universal serial bus USB interface, a control unit and an interface circuit, wherein the control unit may execute the SDP protocol. After the USB interface is connected to the master device interface of the USB active OTG connection device, the control unit may control the interface circuit to provide a DM voltage to the DM pin, and the DM voltage may indicate that the slave device identifies the USB interface of the electronic device as a charging downstream port CDP. Since the CDP protocol specifies a larger charging current, the present application is conducive to realizing high-current charging, thereby facilitating improving the charging speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of charging technology, and in particular to an electronic device, a charging method and a system. Background Art

[0002] With the development of the electronic market, more and more electronic devices have reverse charging functions. An electronic device (such as a mobile phone) can charge another electronic device (such as a tablet) through a USB on the go (OTG) connection device. The electronic device that provides charging can be used as a host device, and the electronic device being charged can be used as a slave device.

[0003] Specifically, in the current OTG charging process, the OTG connection device includes a master device interface and a slave device interface. The master device interface of the OTG connection device is connected to the universal serial bus (USB) interface of the master device, and the slave device interface of the OTG connection device is connected to the USB interface of the slave device. After the master device determines the master device interface connected to the OTG connection device, it can provide charging power to the slave device through the OTG connection device. After the slave device determines the slave device interface connected to the OTG connection device, it can identify the type of the USB interface of the master device through the OTG connection device.

[0004] For electronic devices that support the reverse charging function, when the electronic device is being charged, the USB interface of the electronic device can be connected to the slave device interface of the OTG connection device, and when the electronic device is supplying power, the USB interface of the electronic device can be connected to the master device interface of the OTG connection device. In other words, for electronic devices that support the reverse charging function, its USB interface can be connected to both the master device interface of the OTG connection device and the slave device interface of the OTG connection device.

[0005] Currently, in electronic devices that support reverse charging, most USB interfaces are standard downstream ports (SDPs). Therefore, the slave device can identify the USB interface of the master device as an SDP, and receive charging power provided by the master device based on the SDP protocol.

[0006] However, the battery charging (BC) 1.2 protocol stipulates that the maximum value of the charging current transmitted by the SDP is 500mA, so the slave device will limit the charging current to 500mA, resulting in a low reverse charging speed. Therefore, the existing reverse charging technology needs further research. Summary of the invention

[0007] In view of this, an embodiment of the present application provides an electronic device, a charging method and a system. When the electronic device is a master device, the slave device can identify the USB interface of the electronic device of type SDP as CDP, thereby realizing large-current reverse charging, which is beneficial to improving the reverse charging speed.

[0008] In the first aspect, an embodiment of the present application provides an electronic device, which can be used as a master device to reverse charge other electronic devices. Exemplarily, the electronic device may include a universal serial bus USB interface, a control unit and an interface circuit, wherein the control unit can execute a standard downstream port SDP protocol, that is, the USB interface of the electronic device is SDP. The interface circuit is respectively connected to the digital negative DM pin of the USB interface and the control unit. After determining that the USB interface is connected to the master device interface of the USB active OTG connection device, the control unit can control the interface circuit to provide a DM voltage to the DM pin, and the DM voltage can indicate that the slave device recognizes the USB interface of the electronic device as a charging downstream port CDP.

[0009] After the master device and the slave device are connected through the OTG connection device, 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 OTG connection device, and the DP pin of the USB interface of the master device can be coupled with the DP pin of the USB interface of the slave device through the OTG connection 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 changes of the DM pin and the DP pin of its USB interface. Specifically, the slave device will apply the DP voltage to the DP pin in its USB interface. If the voltage of the DM pin in its USB interface is not pulled up, 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 instead apply the DM voltage to the DM pin. If the voltage of its DP pin is pulled up, the slave device can determine that the USB interface of the master device is a DCP. Conversely, if the DP pin in the USB interface of the slave device is not pulled up, the slave device can determine that the USB interface of the master device is a CDP.

[0010] In an embodiment of the present application, after the control unit determines that the USB interface is connected to the main device interface of the OTG connection device, it means that the electronic device acts as the main device. Therefore, the control unit can control the interface circuit to provide a DM voltage to the DM pin. Since the DM pin of the master device is applied with a first voltage, the voltage of the DM pin of the slave device is pulled up accordingly. As a result, when the slave device identifies 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 that the slave device will not identify the USB interface of the master device as SDP. The slave device in turn applies a DM voltage to the DM pin. Since the USB interface of the master device is actually SDP, the DP pin and the DM pin in the interface circuit of the master device are disconnected from each other, so the voltage of the DP pin of the slave device will not be pulled up accordingly, so that the slave device can identify the USB interface of the master device as CDP, and then large current reverse charging can be achieved.

[0011] Exemplarily, for an electronic device that supports reverse charging, it can also serve as a slave device to receive charging power. Therefore, the interface circuit of the electronic device provided in the embodiment of the present application can also include a DM voltage source, which can be used to identify the type of the USB interface of the master device when the electronic device serves as a slave device. In view of this, in the embodiment of the present application, the DM voltage source that is already in the interface circuit of the electronic device can be used. That is, when the electronic device serves as a master device, the control unit can turn on the DM voltage source in the interface circuit, and the DM voltage source provides a DM voltage to the DM pin.

[0012] In an embodiment of the present application, the control unit can determine whether the main device interface of the OTG connection device is connected through the trigger pin in the USB interface. Exemplarily, the interface circuit may include a trigger comparator, which is connected to the trigger pin of the USB interface and the control unit respectively; the trigger comparator can send a first detection signal to the control unit when the pin voltage of the trigger pin is lower than the trigger reference voltage; the control unit can determine that the USB interface is connected to the main device interface of the OTG connection device after receiving the first detection signal.

[0013] Since other identification processes may be performed simultaneously during the process of the slave device identifying the USB interface of the master device, in order to reduce the influence of the pin voltage of the DM pin of the master device on other identification processes, in a possible implementation, the interface circuit may include a DP detection circuit, which is connected to the control unit and the DP pin respectively; the DP detection circuit may output a second detection signal to the control unit when the pin voltage of the DP pin is greater than the DP reference voltage; the control unit may turn on the DP detection circuit after the USB interface is connected to the master device interface of the USB active OTG connection device; and the control unit controls the interface circuit to provide the DM voltage to the DM pin after receiving the second detection signal.

[0014] After receiving the second detection signal, the control circuit indicates that the pin voltage of the DP pin is pulled up at this time. As mentioned above, in the process of identifying the USB interface of the master device, the slave device will turn on the DP voltage source in the interface circuit of the slave device and apply the DP voltage to the DP pin of the slave device. Therefore, after receiving the second detection signal, the control circuit of the master device indicates that the slave device has turned on the DP voltage source, that is, the slave device has begun to identify the USB interface of the master device. In this case, the control circuit of the master device turns on the DM voltage source again, which is conducive to achieving more precise control, and thus helps to reduce the impact on other identification processes.

[0015] In an embodiment of the present application, the electronic device also includes a charging management unit. After the USB interface of the master device is connected to the main device interface of the USB active OTG connection device, the master device can also control the charging management unit to output a charging voltage to the VBUS pin of the USB interface. Generally speaking, the slave device will only start to identify the type of the USB interface of the master device after detecting that the pin voltage of the VBUS pin is pulled up. In view of this, the control unit of the master device can control the charging management unit to output a charging voltage to the VBUS pin of the USB interface after the USB interface is connected to the main device interface of the OTG connection device; after the duration of the charging voltage output by the charging management unit reaches a first duration, the DP detection circuit is turned on. With this implementation method, the time for turning on the DP detection circuit can be shortened, which is conducive to further reducing the impact on other identification processes.

[0016] Exemplarily, the control unit may periodically turn on the DP detection circuit until the second detection signal is received, or until the number of times the DP detection circuit is turned on reaches a threshold number.

[0017] In a possible implementation, the control unit may further control the interface circuit to stop providing the DM voltage to the DM pin after the duration for which the control interface circuit provides the DM voltage to the DM pin reaches a second duration. The second duration is generally not less than the duration required for the slave device to detect the pin voltage of the DM pin. That is, the control unit of the master device may control the interface circuit to stop providing the DM voltage to the DM pin after the slave device has identified the pin voltage of the DM pin, thereby facilitating further reducing the impact on other identification processes.

[0018] In the second aspect, the embodiment of the present application provides a charging method. The technical effects of the corresponding scheme in the second aspect can refer to the technical effects that can be obtained by the corresponding scheme in the first aspect, and the repeated parts will not be described in detail. The charging method provided in the embodiment of the present application can be applied to a control unit in an electronic device, and the control unit can execute the SDP protocol. The electronic device can be used as a master device to reverse charge other electronic devices. The electronic device also includes a universal serial bus USB interface and an interface circuit, wherein the USB interface is an SDP. Exemplarily, the charging method provided in the embodiment of the present application mainly includes: after the USB interface is connected to the master device interface of the USB active OTG connection device, the control interface circuit provides a DM voltage to the DM pin, and the DM voltage can indicate that the slave device recognizes the USB interface of the electronic device as a charging downstream port CDP.

[0019] Exemplarily, for an electronic device that supports reverse charging, it can also serve as a slave device to receive charging power. Therefore, the interface circuit of the electronic device provided in the embodiment of the present application can also include a DM voltage source, which can be used to identify the type of the USB interface of the master device when the electronic device serves as a slave device. In view of this, in the embodiment of the present application, the DM voltage source that is already in the interface circuit of the electronic device can be used. That is, when the electronic device serves as a master device, the control unit can turn on the DM voltage source in the interface circuit, and the DM voltage source provides a DM voltage to the DM pin.

[0020] In an embodiment of the present application, the control unit can determine whether the main device interface of the OTG connection device is connected through the trigger pin in the USB interface. Exemplarily, the control unit can determine that the USB interface is connected to the main device interface of the OTG connection device when the pin voltage of the trigger pin of the USB interface is greater than the trigger reference voltage.

[0021] Since other identification processes may be performed simultaneously during the process of the slave device identifying the USB interface of the master device, in order to reduce the influence of the pin voltage of the DM pin of the master device on other identification processes, in a possible implementation, after the USB interface is connected to the master device interface of the USB active OTG connection device, the control unit may first detect the pin voltage of the DP pin through the interface circuit; after the pin voltage of the DP pin is greater than the DP reference voltage, the DM voltage is provided to the DM pin. This is conducive to reducing the influence on other identification processes.

[0022] Exemplarily, the control unit can output a charging voltage to the VBUS pin of the USB interface after the USB interface is connected to the main device interface of the OTG connection device; after the duration of the output charging voltage reaches a first duration, the pin voltage of the DP pin is detected through the interface circuit.

[0023] Exemplarily, when the control unit detects the pin voltage of the DP pin through the interface circuit, it can periodically detect the pin voltage of the DP pin through the interface circuit until the pin voltage of the DP pin is greater than the DP reference voltage, or the number of times the pin voltage of the DP pin is detected reaches a threshold number of times.

[0024] In a possible implementation, after the control interface circuit provides the DM voltage to the DM pin, the control unit may also control the interface circuit to stop providing the DM voltage to the DM pin after the duration for which the control interface circuit provides the DM voltage to the DM pin reaches a second duration.

[0025] In the third aspect, the embodiment of the present application provides a charging system. The technical effects of the corresponding scheme in the third aspect can refer to the technical effects that can be obtained by the corresponding scheme in the first aspect, and the repeated parts are not described in detail. Exemplarily, the charging system includes a master device, an OTG connection device and a slave device; the USB interface of the master device is connected to the master device interface of the OTG connection device, and the USB interface of the slave device is connected to the slave device interface of the OTG connection device; the master device is an electronic device provided in any one of the above-mentioned first aspects, and the master device can charge the slave device through the OTG connection device.

[0026] In a possible implementation, the master device can also transfer data with the slave device via an OTG connection device. Specifically, in the embodiment of the present application, the slave device will identify the USB interface of the master device as a CDP, and CDP not only supports high-current charging, but also supports communication. Therefore, when the electronic device provided in the embodiment of the present application is used as a master device, it can not only realize high-current reverse charging, but also communicate with the slave device at the same time.

[0027] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A schematic diagram of a charging scenario applicable to some embodiments of the present application;

[0029] Figure 2 A schematic diagram of the structure of an electronic device applicable to some embodiments of the present application;

[0030] Figure 3 A schematic diagram of the structure of an electronic device applicable to some embodiments of the present application;

[0031] Figure 4a An enlarged view of a local structure of a main device applicable to some embodiments of the present application;

[0032] Figure 4b An enlarged view of a local structure of a slave device applicable to some embodiments of the present application;

[0033] Figure 5 A schematic diagram of a process of identifying a USB interface of a master device from a device;

[0034] Figure 6 A schematic diagram of a charging method flow chart provided in some embodiments of the present application;

[0035] Figure 7 A schematic flow chart of a charging method provided for some embodiments of the present application. DETAILED DESCRIPTION

[0036] 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.

[0037] In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operating 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 the present application, "at least one" refers to one or more, wherein multiple refers to two or more. In view of this, "multiple" can also be understood as "at least two" in the embodiment of the present invention. "And / or" describes the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the related objects before and after are in an "or" relationship. In addition, it should be understood that in the description of the present application, words such as "first" and "second" are only used to distinguish the purpose of description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0038] It should be pointed out that in the embodiments of the present application, "access" means that an electrical connection is achieved between the two interfaces, and the corresponding pins in the two interfaces are connected one by one, but the embodiments of the present application do not impose many restrictions on the specific connection method between the two interfaces. For example, the connection can be insertion, docking, etc. Taking insertion as an example, interface 1 accesses interface 2, which can be either interface 1 plugged into interface 2 or interface 2 plugged into interface 1.

[0039] At present, the application of reverse charging technology in electronic devices is becoming more and more mature. The so-called reverse charging means that electronic devices (such as mobile phones, tablets, etc.) can obtain power from other devices through wired / wireless methods, and can also use the power stored in their own batteries to charge another electronic device (such as another mobile phone) (for example, provide power through wired or wireless methods). Generally speaking, reverse charging is mostly wired, that is, it is necessary to use an on-the-go (OTG) connection device to achieve reverse charging.

[0040] For example, Figure 1 As shown, the OTG connection device 300 mainly includes an A interface and a B interface, wherein the A interface can also be called a master device interface, and the B interface can also be called a slave device interface. Before reverse charging, the user can connect the A interface of the OTG connection device 300 to the USB interface 101 of the electronic device 100, and connect the B interface of the OTG connection device 300 to the USB interface 201 of the electronic device 200.

[0041] The electronic device 100 can output power from the USB interface 101 to the A interface of the OTG connection device 300, and the power received by the A interface of the OTG connection device 300 is transmitted to the B interface of the OTG connection device 300 and input into the electronic device 200 through the USB interface 201. The electronic device 200 can then work or charge using the power input from the USB interface 201.

[0042] It should be pointed out that the shape of the OTG connection device 300 in the embodiment of the present application can be linear or non-linear such as square or circular. The embodiment of the present application does not impose many restrictions on the shape of the OTG connection device 300.

[0043] Figure 2 The electronic device structure to which the embodiments of the present application are applicable is exemplified, and the electronic device may be a smart phone, tablet computer or other electronic device that supports reverse charging. Figure 2 As shown, the electronic device 100 mainly includes a universal serial bus USB interface 101 , a control unit 102 , and an interface circuit 103 .

[0044] Among them, the USB interface 101 can be an interface that complies with the USB standard specification, for example, the USB interface 101 can be a micro (Micro) B-type USB interface, etc. The USB interface 101 can be used to connect the B interface of a charger or an OTG connection device, so that the electronic device 100 can be charged. The USB interface 101 can also be used to connect the A interface of the OTG connection device 300, so that the electronic device 100 can charge other electronic devices. It should be understood that the USB interface 101 can receive electrical energy provided by the outside when the electronic device 100 is charged. When the electronic device is powered externally, that is, reversely charged externally, the USB interface 101 can also output electrical energy externally.

[0045] The control unit 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. Exemplarily, the control unit 102 may include an application processor (AP), a controller, a memory, a digital signal processor (DSP), etc. Different processing units may be independent devices or integrated in one or more processors.

[0046] The controller may be the nerve center and command center of the electronic device 100. The controller may generate a control signal according to the instruction operation code and the timing signal. For example, the controller in the control unit 102 in the embodiment of the present application may generate a control signal, and the control unit 102 may control the operation of the charging management unit 105 through the control signal.

[0047] The control unit 102 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the control unit 102 is a cache memory. The memory may store instructions or data that the control unit 102 has just used or circulated. If the control unit 102 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0048] In some embodiments, the control unit 102 may include one or more interfaces, which may include a control bus interface, a general-purpose input / output (GPIO) interface, and the like.

[0049] Among them, the control bus interface can 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., and the embodiments of the present application do not impose any further restrictions on this.

[0050] In addition, the control unit 102 can also execute a port protocol, and the port protocol executed by the control unit 102 defines the type of the USB interface 101. Specifically, the current BC 1.2 protocol stipulates that there are mainly three types of USB interfaces: a standard downstream port (SDP), a dedicated charging port (DCP), and a charge downstream port (CDP). In the embodiment of the present application, the control unit 101 can execute the SDP protocol, thereby defining the USB interface 101 as an SDP.

[0051] The interface circuit 103 has a circuit structure that matches the type of the USB interface 101 . The control unit 102 can detect and control the USB interface 101 through the interface circuit 103 .

[0052] It is to be understood that the structure shown 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 Figure 2 More or fewer components may be shown, or some components may be combined or separated, or the components may be arranged differently. Figure 2 The components shown may be implemented in hardware, software or a combination of software and hardware.

[0053] For example, the electronic device 100 may further 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, an earphone interface, a sensor module, a button, a motor, an indicator, a camera, a display screen, and a 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.

[0054] Another example Figure 3As shown, the electronic device 100 may also include a charging management unit 105 and a battery 104. The charging management unit 105 may receive charging power through the USB interface 101 and store the received charging power into the battery 104. While the charging management unit 105 is charging the battery 104, it may also supply power to the power management circuit 103, so that the power management circuit 103 may simultaneously supply power to other circuit structures in the electronic device. When the electronic device serves as the main device in wireless charging, the control unit 102 may control the charging management unit 105 to output a charging voltage to the USB interface 101, and the charging voltage is generally 5V. Exemplarily, the charging management unit 105 may also be referred to as a charger integrated circuit (charger IC).

[0055] It should be understood that the electronic device 200 may have a similar circuit structure. For example, the electronic device 200 may also include a control unit 202, an interface circuit 203, a charging management unit 205, a battery 204, etc., which are not listed one by one in the embodiments of the present application.

[0056] Next, Figure 3 As an example, the USB interface 101 is further described. Exemplarily, the USB interface 101 mainly includes a ground (GND) pin 1, a trigger pin 1 (not shown in the figure), a data positive (DP) pin 1, a data negative (DM) pin 1 and a power bus (VBUS) pin 1. Among them, the DP pin 1 can also be called a D+ pin, and the DM pin 1 can also be called a D- pin.

[0057] The pins in the USB interface 101 have different functions. It should be understood that the functions of the pins in the USB interface 101 generally need to rely on the interface circuit 103 to be realized. Next, the embodiment of the present application further illustrates the pins in the USB interface 101 and the circuit structure of the interface circuit 103 in combination with the interface circuit 103.

[0058] It should be understood that the USB interface 201 of the electronic device 200 may have the same pins as the USB interface 101. Therefore, the USB interface 201 may include a VBUS pin 2, a DP pin 2, a DM pin 2, an ID pin 2, and a GND pin 2. Each pin in the USB interface 201 may be connected to a corresponding pin in the USB interface 101 through the OTG connection device 300.

[0059] It should be pointed out that the embodiments of the present application are only described by taking the specific scenario in which the electronic device 100 is the master device and the electronic device 200 is the slave device as an example. For electronic devices that support reverse charging, they themselves can also serve as slave devices to receive charging power provided by other electronic devices. In other words, the interface circuit 103 of the electronic device 100 may also include elements in the interface circuit 203, and the electronic device 100 may also execute the method executed by the slave device. Similarly, the interface circuit 203 of the electronic device 200 may also include elements in the interface circuit 103, and the electronic device 200 may also execute the method executed by the master device.

[0060] Figure 4a The following is an exemplary diagram of a partial structure enlargement of a main device applicable to the embodiment of the present application. Figure 4a As shown, the GND pin 1 can be grounded through a grounding circuit in the interface circuit 103, so as to be kept in a 0 potential state.

[0061] Trigger pin 1

[0062] It can also be called identification (ID) pin 1. In the embodiment of the present application, the ID pin 1 can trigger the control unit 102 to determine that the USB interface 101 is connected to the main device interface of the OTG connection device 300, that is, the A interface of the OTG connection device 300.

[0063] To implement the ID pin 1 function, such as Figure 4a As shown, the interface circuit 103 includes an ID comparator A ID and ID voltage source S V_ID . Where, ID voltage source S V_ID Connected to ID pin 1, a stable ID voltage can be provided for ID pin 1. Generally, the ID voltage can be 0.6 V. Interface circuit 203 is similar to the above, and will not be described in detail.

[0064] ID Comparator A ID , can also be called a trigger comparator. ID Comparator A ID One input of the ID comparator is connected to the ID pin 1. ID The other input terminal is used to receive the ID reference voltage V ref_ID ID Comparator A ID The output end of is connected to the control unit 102. When the voltage of the ID pin 1 is lower than the ID reference voltage V ref_ID When ID comparator A ID Then, an ID detection signal, that is, a first detection signal, can be output to the control unit 102.

[0065] pass Figure 4aThe interface circuit 103 shown, the control unit 102 can determine that the electronic device 100 is a master device after receiving the ID detection signal.

[0066] Exemplarily, both the A interface and the B interface of the OTG connection device 300 can be understood as different types of USB interfaces, and the A interface and the B interface of the OTG connection device 300 respectively have pins adapted to the USB interface 101 of the electronic device 100. Specifically, when the A interface of the OTG connection device 300 is connected to the USB interface 101, the GND pin of the A interface is connected to the GND pin in the USB interface 101, the ID pin of the A interface is connected to the ID pin in the USB interface 101, the DP pin of the A interface is connected to the DP pin in the USB interface 101, the DM pin of the A interface is connected to the DM pin in the USB interface 101, and the VBUS pin of the A interface is connected to the VBUS pin in the USB interface. The same is true for the B interface, which will not be repeated.

[0067] The difference between the A interface and the B interface in the OTG connection device 300 is that the ID pin in the A interface is coupled to the ground circuit, while the ID pin in the B interface is left floating. When the A interface of the OTG connection device 300 is connected to the USB interface 101 of the electronic device 100, the ID pin 1 in the USB interface 101 is grounded through the ID pin of the A interface of the OTG connection device 300, so the pin voltage of the ID pin 1 in the USB interface 101 is pulled down, that is, the pin voltage of the ID pin 1 is reduced.

[0068] When the voltage of ID pin 1 is pulled down to a level lower than the ID reference voltage V ref_ID When ID comparator A ID The control unit 102 can output an ID detection signal. After receiving the ID detection signal, the control unit 102 means that the USB interface 101 is connected to the A end of the OTG connection device, so the control unit 102 can determine that the USB interface 101 is connected to the A interface of the OTG connection device 300.

[0069] The ID pin in the B interface of the OTG connection device 300 is connected to the ID pin 2 in the USB interface 201. Since the ID pin in the B interface is suspended, the voltage state of the ID pin 2 remains unchanged, for example, the pin voltage of the ID pin 2 can be maintained at the ID voltage. The voltage state of the ID pin 2 remains unchanged, thereby preventing the control unit 202 from determining that the electronic device 200 is the master device.

[0070] VBUS pin

[0071] After determining that the USB interface 101 is connected to the A interface of the OTG connection device 300 , the control unit 102 may control the charging management unit 105 to output a charging voltage to the VBUS pin 1 .

[0072] The VBUS pin 2 is connected to the VBUS pin 1. When the charging management unit 105 outputs the charging voltage to the VBUS pin 1, the pin voltage of the VBUS pin 2 is pulled up accordingly, that is, the pin voltage of the VBUS pin 2 increases. Figure 4b The following is an exemplary diagram of a partial structure enlargement of a slave device to which the embodiment of the present application is applicable. Figure 4b As shown, the interface circuit 203 includes a VBUS voltage comparator A VBUS VBUS voltage comparator A VBUS One input terminal of the VBUS voltage comparator A is connected to VBUS pin 2. VBUS The other input terminal is used to receive the VBUS reference voltage V ref_VBUS VBUS voltage comparator A VBUS The output end of is connected to the control unit 202.

[0073] When the voltage of VBUS pin 2 is greater than the VBUS reference voltage V ref_VBUS When VBUS voltage comparator A VBUS The VBUS detection signal can be output to the control unit 202. Therefore, when the pin voltage of the VBUS pin 2 is pulled up to a voltage greater than the VBUS reference voltage V ref_VBUS When VBUS voltage comparator A VBUS The VBUS detection signal may be output to the control unit 202 .

[0074] After the control unit 202 receives the VBUS detection signal, it means that the electronic device 200 has received the charging voltage provided by the outside world, so the control unit 202 can determine that the electronic device 200 has completed the connection with other USB devices as a slave device. The above-mentioned other USB devices can be chargers or reverse charging electronic devices (such as the electronic device 100), and the electronic device 200 can receive the charging power provided by other USB devices as a slave device.

[0075] DP pin and DM pin

[0076] After the electronic device 200 is connected to other USB devices as a slave device, the control unit 202 can execute the battery charging (BC) 1.2 protocol through the DP pin 2 and the DM pin 2 to complete the handshake with the host device (electronic device 100). Through the handshake process based on the BC 1.2 protocol, the control unit 202 can identify the port type of the USB interface of the host device, that is, the type of the USB interface 101 of the electronic device 100.

[0077] It can be understood that the type of USB interface 101 is mainly determined by the circuit structure of the interface circuit 103 and the port protocol executed by the control unit 102. In the current electronic market, the USB interfaces of most electronic devices (such as smart phones and tablets) are SDP. The BC 1.2 protocol stipulates that the maximum charging current of SDP is 500mA, so SDP cannot be used for high-current charging. DCP can provide a larger charging current, and DCP is generally used for dedicated chargers. CDP also supports high-current charging, but CDP can mainly be used as a computer, hub and other equipment, and has not yet been widely used.

[0078] Next, Figure 5 Taking the example, the process of the slave device identifying the USB interface of the master device is further explained. Figure 5 As shown, it mainly includes the following steps:

[0079] S501: The control unit of the slave device turns on the DP voltage source S in the interface circuit of the slave device. 2 V_DP .

[0080] For example, Figure 4b As described above, when the electronic device 200 acts as a slave device, the DP voltage source S in the interface circuit 203 2 V_DP Connected to DP pin 2. The control unit 202 turns on the voltage source DP voltage source S 2 V_DP After that, the DP voltage source S 2 V_DP A DP voltage may be output to the DP pin 2. Generally speaking, the voltage value of the DP voltage may be 0.6V.

[0081] S502: The slave device detects the pin voltage of the DM pin 2.

[0082] For example, Figure 4b As shown, when the electronic device 200 acts as a slave device, the interface circuit 203 includes a DM detection circuit 2031, one input end of the DM detection circuit 2031 is connected to the DM pin 2, and the other input end is used to receive the DM reference voltage V ref_DM , the output end of the DM detection circuit 2031 is connected to the control unit 202. The DM detection circuit 2031 can detect the DM pin 2 when the pin voltage is greater than the DM reference voltage V ref_DM When DM detection signal is output to control unit 202.

[0083] Exemplarily, the DM detection circuit 2031 may include a DM voltage comparator A DM ,DM voltage comparator A DMOne input terminal of the DM voltage comparator A is connected to DM pin 2. DM The other input terminal is used to receive the DM reference voltage V ref_DM ,DM voltage comparator A DM The output end of DM voltage comparator A is connected to the control unit 202. DM The voltage at DM pin 2 can be greater than the DM reference voltage V ref_DM When DM detection signal is output to control unit 202.

[0084] Generally speaking, the DM reference voltage V ref_DM Not greater than DP voltage source S 2 V_DP Output DP voltage, generally DM reference voltage V ref_DM It can be 0.35V.

[0085] In one possible implementation, Figure 4b As shown, the DM detection circuit 2031 may further include a DM current source S 2 I_DM , DM current source S 2 I_DM One end is connected to DM pin 2, and the DM current source S 2 I_DM The other end of the DM current source S is grounded. 2 I_DM , the current input into the DM detection circuit 2031 from the DM pin 2 can be limited, thereby facilitating the protection of the detection circuit.

[0086] In other embodiments, Figure 4b The DM detection circuit 2031 may also include a logic switch K DM . Logic switch K DM One input terminal is connected to DM pin 2, and the logic switch K DM The other input terminal of the DM voltage comparator A DM The output terminal of the logic switch K DM The DM voltage comparator A DM The output DM detection signal is converted into a digital form, and the digital DM detection signal is provided to the control unit 202 .

[0087] S503: If the voltage of the DM pin of the slave device is greater than the DM reference voltage V ref_DM , then continue to execute S504. Otherwise, continue to execute S505 to determine that the USB interface 101 is an SDP.

[0088] For example, Figure 4bAs described above, when the electronic device 200 acts as a slave device, the control unit 202 can periodically turn on the logic switch K DM , that is, periodically detecting the pin voltage of DP pin 2. If the DM detection signal is still not received after the detection times reach the times threshold, the control unit 202 can determine that the pin voltage of DM pin 2 is not greater than the DM reference voltage V ref_DM .

[0089] In another possible implementation, the control unit 202 may also start the DP voltage source S 2 V_DP After that, the pin voltage of DP pin 2 is continuously detected. If the DM detection signal is still not received after a waiting time, it can be considered that the pin voltage of DM pin 2 is not greater than the DM reference voltage V ref_DM , and then continue to execute S505.

[0090] S504: The control unit of the slave device turns on the DM voltage source S in the interface circuit of the slave device. 2 V_DM .

[0091] like Figure 4b As shown, when the electronic device 200 acts as a slave device, the interface circuit 203 further includes a DM voltage source S V_DM , DM voltage source S V_DM Connected to DM pin 2. The control unit 202 turns on the DM voltage source S V_DM After that, the DM voltage source S V_DM A DM voltage may be output to the DM pin. Generally, the DM voltage may be 0.6V.

[0092] It can be understood that during this period, the DP voltage source S is also turned off. 2 V_DP and DM current source S 2 I_DM .

[0093] S506: The slave device detects the pin voltage of the DP pin.

[0094] like Figure 4b As shown, when the electronic device 200 is used as a slave device, the interface circuit 203 may further include a DP detection circuit 2032. Similar to the DM detection circuit 2031, the DP detection circuit 2032 may also detect whether the pin voltage of the DP pin 2 is greater than the DP reference voltage V ref_DP For example, the DP detection circuit 2032 may include a DP comparator A DP DP Comparator A DP One input of DP comparator A is connected to DP pin 2. DPThe other input terminal is used to receive the DP reference voltage V ref_DP DP Comparator A DP The voltage at DP pin 2 can be greater than the DP reference voltage V ref_DP , output DP detection signal.

[0095] In a possible implementation, the DP detection circuit 2032 may include a DP current source S 2 I_DP DP current source S 2 I_DP The current input from the DP pin 2 to the DP detection circuit 2032 can be limited, thereby protecting the DP detection circuit 2032. In a possible implementation, the DP detection circuit 2032 may also include a logic switch K DP , so as to convert the DP detection signal into a digital signal form. The above specific implementations can all refer to the DM detection circuit 2031, which will not be described in detail.

[0096] S507: If the voltage of the DP pin of the slave device is greater than the DP reference voltage V ref_DP , then S509 is executed to determine that the USB interface of the host device is a DCP. Otherwise, S510 is executed to determine that the USB interface of the host device is a CDP.

[0097] pass Figure 5 The process shown in the figure, the slave device can determine the USB interface type of the master device. The following is a brief description of the judgment principle:

[0098] Result 1: The USB interface of the host device is DCP

[0099] In the case where the USB interface of the master device is a DCP, the DP pin and the DM pin in the USB interface of the master device can be interconnected through the interface circuit of the master device. Therefore, after the slave device executes S501 to turn on the DP voltage source, the DP voltage source in the slave device applies the DP voltage to the DP pin of the slave device, and the voltage of the DP pin of the master device is pulled up accordingly. Since the USB interface of the master device is a DCP, the DP pin of the master device and the DM pin of the master device are interconnected, and the pin voltage of the DM pin of the master device is pulled up accordingly, thereby causing the pin voltage of the DM pin of the slave device to be pulled up to a voltage greater than the DM reference voltage V ref_DM Therefore, when the USB interface of the master device is a DCP, the control unit of the slave device may receive the DM detection signal sent by the DM detection circuit 2031 after executing S502, and may continue to execute S504.

[0100] After the slave device executes S504 to turn on the DM voltage source, the DM voltage source of the slave device applies a DM voltage to the DM pin of the slave device, and the voltage of the DM pin of the master device is pulled up accordingly. Since the DM pin of the master device is interconnected with the DP pin of the master device, the pin voltage of the DP pin of the master device is pulled up accordingly, thereby causing the pin voltage of the DP pin of the slave device to be pulled up to a voltage greater than the DP reference voltage V ref_DP Therefore, when executing S506, the control unit of the slave device can receive the DP detection signal sent by the DP detection circuit 2032. The slave device can further determine that the USB interface of the master device is a DCP.

[0101] Result 2: The USB interface of the host device is CDP

[0102] When the USB interface of the host device is CDP, in the USB interface of the host device, the DP pin can be grounded through the DP pull-down resistor in the interface circuit, and the DM pin can be grounded through the DM pull-down resistor in the interface circuit, that is, the circuit between the DM pin and the DP pin in the CDP is open.

[0103] The interface circuit of the master device also includes a DP detection circuit and a DM voltage source. The DP detection circuit can detect the pin voltage of the DP pin of the master device. When the pin voltage of the DP pin of the master device is pulled up to a level greater than the DP reference voltage V ref_DP After that, the DP detection circuit of the master device can send a DP detection signal to the control unit of the master device. After receiving the DP detection signal, the control unit of the master device can turn on the DM voltage source of the master device, so that the pin voltage of the DM pin of the master device is pulled up, and then the pin voltage of the DM pin of the slave device is pulled up to a value greater than V ref_DM Therefore, when executing S502, the control unit of the slave device may receive the DM detection signal sent by the DM detection circuit of the slave device, and then may continue to execute S504.

[0104] After the slave device executes S504 to turn on the DM voltage source of the slave device, the DM voltage source of the slave device applies a DM voltage to the DM pin of the slave device, so that the voltage of the DM pin of the master device is pulled up. Since the USB interface of the master device is CDP, the DM pin and the DP pin of the master device are disconnected from each other, so the voltage of the DP pin of the master device will not be pulled up, and the pin voltage of the DP pin of the slave device will not be pulled up. In other words, after executing S506, the control unit of the slave device cannot receive the DP detection signal sent by the DP detection circuit of the slave device, and can determine that the USB interface of the master device is CDP.

[0105] It can be seen from the above results 1 and 2 that, in the case where the USB interface of the host device is excluded as SDP, it can be determined through S504 and S506 whether the USB interface of the host device is CDP or DCP.

[0106] Result 3: The USB interface of the host device is SDP

[0107] like Figure 4a , which is an enlarged view of a part of the structure of the electronic device 100 provided in the embodiment of the present application. In the electronic device 100, the USB interface 101 is an SDP. The interface circuit 103 includes a pull-down resistor R DP and R DM , where the pull-down electron R DP One end is connected to DP pin 1, and the pull-down electronic R DP The other end of the pull-down electronic R DM One end is connected to DM pin 1, and the pull-down electronic R DM The other end of is grounded, that is, the DM pin 1 and the DP pin 1 in the USB interface 101 are disconnected from each other.

[0108] Figure 4a The interface circuit 103 shown is an interface circuit of SDP. In the current USB interface identification process, when the pin voltage of DP pin 1 is pulled up, since the circuit between DP pin 1 and DM pin 1 is open, the pin voltage of DM pin 1 will not be pulled up, and thus the pin voltage of DM pin 2 will not be pulled up. That is to say, in the current USB interface identification process, when the USB interface 101 is SDP, after the control unit of the slave device turns on the DP voltage source, the pin voltage of the DM pin of the slave device is not greater than the DP reference voltage V ref_DP Therefore, after executing S502, the control unit of the slave device cannot receive the DM detection signal, and can further determine that the USB interface of the master device (electronic device 100) is SDP.

[0109] It can be seen that only when the USB interface of the host device is SDP, the pin voltage of the DM pin 2 in S502 is not greater than the DM reference voltage V ref_DM Thus, the SDP can be distinguished from other ports (CDP and DCP) through S501 and S502.

[0110] At present, most electronic devices that support reverse charging function have SDP as the USB interface, such as Figure 4a Therefore, when the slave device executes S503, it generally identifies the USB interface of the master device as SDP, and then charges according to the SDP protocol. However, the SDP protocol stipulates that the charging current cannot exceed 500mA, resulting in a slow reverse charging speed.

[0111] In view of this, the embodiment of the present application improves the master device (electronic device 100) by simulating the CDP identification process, so that the slave device can identify the USB of the master device as CDP. The BC1.2 protocol stipulates that the applicable charging current of CDP is 1.5-5A, so the technical solution provided by the embodiment of the present application is conducive to realizing a large current reverse charging current, thereby facilitating the speed of reverse charging.

[0112] Figure 6 The following is a schematic flow chart of a charging method provided by an embodiment of the present application, which can be applied to a main device or a control unit of a main device. Figure 6 As shown, it mainly includes the following steps:

[0113] S601: The USB interface is connected to the main device interface of the OTG connection device. Specifically, the USB interface of the electronic device is connected to the main device interface of the OTG connection device, indicating that the electronic device needs to serve as a main device to charge the slave device.

[0114] S602: Control the interface circuit to provide a DM voltage to the DM pin of the USB interface.

[0115] Taking the electronic device 100 as an example, after the USB interface 101 is connected to the host device interface (A interface) of the OTG connection device 300, the control unit 102 can control the interface circuit 103 to provide a DM voltage to the DM pin 1. The electronic device 200 acts as a slave device, and the voltage of its DM pin 2 is pulled up accordingly, so that when the slave device (electronic device 200) executes S503, it can be determined that the pin voltage of the DM pin 2 is greater than the DM reference voltage V ref_DM This allows the electronic device 200 to continue to execute S504, thereby preventing the electronic device 200 from identifying the USB interface 101 of the electronic device 100 as an SDP.

[0116] Since the USB interface 101 is an SDP, its interface circuit 103 is adapted to the SDP, that is, the circuit between the DP pin 1 and the DM pin 1 of the USB interface 101 is open, so the electronic device 200 performs S504: turning on the DM voltage source S 2 V_DM After that, the pin voltage of DP pin 2 will not be pulled up to a level greater than the DP reference voltage V ref_DP Therefore, when the electronic device 200 executes S507, it can be determined that the pin voltage of the DP pin 2 is not greater than the DP reference voltage V ref_DP The electronic device 200 then proceeds to execute S508 to determine that the USB interface 101 is a CDP.

[0117] After that, the electronic device 200 can be enumerated and charged with 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 be reverse charged with a larger charging current (up to 5A), which is beneficial to increase the speed of reverse charging.

[0118] Exemplarily, the control unit 102 of the master device (electronic device 100) in the embodiment of the present application can control the interface circuit 103 to output the DM voltage to the DM pin 1 by at least any one of the following implementations:

[0119] Implementation method 1

[0120] After determining that the USB interface 101 is connected to the host device interface of the OTG connection device 300, the control unit 102 can immediately control the interface circuit 103 to output the DM voltage to the DM pin 1. It can also be understood that the control unit 102 can receive the ID voltage comparator A ID After the ID detection signal is output, the DM voltage source S in the interface circuit 103 is turned on. 1 V_DM DM voltage source S 1 V_DM A DM voltage can be output to the DM pin 1.

[0121] It should be noted that the electronic device 100 itself can be used as a slave device to receive charging power provided by other devices. For example, the electronic device 100 can be a smart phone, which can receive charging power provided by a charger. Therefore, the interface circuit 103 of the electronic device 100 also has a DP voltage source S 1 V_DP and DM voltage source S 1 V_DM , used to identify the type of USB interface of the host device when the electronic device 100 acts as a slave device.

[0122] That is, although there is also a DP voltage source S in the electronic device 100 1 V_DP and DM voltage source S 1 V_DM However, in the current USB interface identification process, when the electronic device 100 is used as a master device, the DP voltage source S 1 V_DP and DM voltage source S 1 V_DM In the process of interface identification, it is not turned on. In the embodiment of the present application, the DM voltage source S is used, which is turned on only when the electronic device 100 is used as a slave device. 1 V_DM , by turning on the DM voltage source S 1V_DM Applying a DM voltage to the DM pin 1 allows the electronic device 200 to identify the USB interface 101 as a CDP.

[0123] Implementation method 2

[0124] After the electronic device 100 outputs the charging voltage, the electronic device 200 may not immediately perform USB interface recognition. The USB interface recognition process is mainly initiated by the electronic device 200, and the electronic device 100 cannot determine the specific time point. If the electronic device 100 immediately provides the DM voltage to the DM pin 1 after outputting the charging voltage, it may affect other recognition processes that are being performed simultaneously.

[0125] In view of this, in a possible implementation, the control unit 102 may also turn on the DP detection circuit 1032 after determining that the USB interface is connected to the host device interface of the OTG connection device 300. Figure 4a As shown, the working principle of the DP detection circuit 1032 can refer to the DP detection circuit 2032, which will not be described in detail.

[0126] When the electronic device 200 starts to identify the USB interface, the electronic device 200 turns on the DP voltage source S 2 V_DP , so that the pin voltage of DP pin 1 and DP pin 2 is pulled up to a level greater than the DP reference voltage V ref_DP The DP detection circuit 1032 can detect when the voltage at the DP pin 1 is greater than the DP reference voltage V ref_DP When , a DP detection signal is sent to the control unit 102.

[0127] Therefore, after the control unit 102 receives the DP detection signal, it means that the electronic device 200 has started to identify the USB interface. In this case, the control unit 102 controls the interface circuit 103 to provide the DM voltage to the DM pin 1. This implementation method can more accurately control the interface circuit 103 to reduce the impact of providing the DM voltage to the DM pin 1.

[0128] Implementation method three

[0129] Generally speaking, some slave devices will not immediately identify the USB interface after determining that the pin voltage of the USB pin is pulled up. For example, some slave devices currently perform non-standard detection before USB interface identification to detect whether the USB interface of the master device is a non-standard port, where a non-standard port can also be understood as a port not defined in the BC1.2 protocol. For example, if the USB interface of the master device is damaged, the USB interface is not connected accurately, or the USB interface is not produced properly, it is possible that the slave device will identify the USB interface of the master device as a non-standard port. The slave device can identify the USB interface type of the master device after determining that the USB interface of the master device is a standard port (i.e., a port defined in the BC1.2 protocol).

[0130] In view of this, the control unit 102 can also turn on the DP detection circuit 1032 after controlling the charging management unit 105 to output the charging voltage for a first period of time, so as to more accurately control the interface circuit 103, thereby helping to further reduce the impact of providing the DM voltage to the DM pin 1.

[0131] Exemplarily, the first duration may be no greater than the time interval between when the slave device determines that the pin voltage of the USB pin is pulled up and when the USB interface identification is started. For example, in the above example, after the slave device determines that the pin voltage of the USB pin is pulled up, it needs to perform non-standard detection first and then perform USB interface identification. In this case, the first duration may be determined based on the time taken for the non-standard detection. For example, the first duration may be 100ms.

[0132] In the embodiment of the present application, the first duration can be obtained in various ways such as according to the BC1.2 protocol, data statistics, experience evaluation, etc., and the embodiment of the present application does not impose any restrictions on this.

[0133] In the embodiment of the present application, the control unit 102 may periodically turn on the DP detection circuit 1032 until a DP detection signal is received, or until the number of times the DP detection circuit 1032 is turned on reaches a threshold number of times. For example, the periodic interval of turning on the DP detection circuit 1032 each time may be 20 ms, and the threshold number of times may be 50 times.

[0134] Specifically, the control unit 102 may turn on the DP detection circuit 1032 every 20 ms to detect the pin voltage of the DP pin 1. If the control unit 102 receives a DP detection signal before the number of times the DP detection circuit 1032 is turned on reaches 50 times, the control unit 102 may stop turning on the DP detection circuit 1032 and control the interface circuit 103 to provide the DM voltage to the DM pin 1.

[0135] If the control unit 102 does not receive the DP detection signal after the number of times the DP detection circuit 1032 is turned on reaches 50 times, the DP detection circuit 1032 is stopped from being turned on. For example, when the electronic device 200 identifies the USB interface 101 of the electronic device 100 as a non-standard port, the electronic device 200 may not identify the type of the USB interface 101, which will result in the control unit 102 not receiving the DP detection signal after the number of times the DP detection circuit 1032 is turned on reaches the number threshold.

[0136] The control unit 102 controls the interface circuit 103 to provide a DM voltage to the DM pin 1, so that the electronic device 200 can identify the USB interface 101 as a CDP. In a possible implementation, the interface circuit 103 can continue to apply the DM voltage to the DM pin 1 until the electronic device 200 completes the identification of the USB interface 101.

[0137] For example, after the electronic device 200 determines that the USB interface 101 of the electronic device 100 is a CDP, the control unit 202 may also turn on the DP voltage source S again. 2 V_DP , so that the DP voltage is applied to the DP pin 2 of the USB interface 201 again. The DP pin 1 in the USB interface 101 is pulled up accordingly. In this case, after the control unit 101 receives the DP detection signal from the DP detection circuit 1032 again, the control interface circuit 103 stops providing the DM voltage to the DM pin 1.

[0138] In another possible implementation, the control unit 102 may also control the interface circuit 103 to stop providing the DM voltage to the DM pin after the duration for which the control interface circuit 103 provides the DM voltage to the DM pin 1 reaches a second duration. Exemplarily, the second duration is not less than the time required for the electronic device 200 to identify the pin voltage of the DM pin 2. For example, the second duration may be 100ms. In the embodiment of the present application, the second duration may be obtained in various ways such as according to the BC1.2 protocol, data statistics, and empirical evaluation, and the embodiment of the present application does not impose any restrictions on this.

[0139] Next, Figure 7 As an example, the charging method provided in the embodiment of the present application is further illustrated. Figure 7 As shown, it mainly includes the following steps:

[0140] S701: The USB interface 101 of the electronic device 100 is connected to the host device interface of the OTG connection device 300, so that the pin voltage of the ID pin 1 is pulled down. ID The voltage at the ID pin 1 can be less than the ID reference voltage V ref_IDWhen the ID detection signal is received, the control unit 102 sends an ID detection signal. After receiving the ID detection signal, the control unit 102 can determine that the USB interface 101 is connected to the main device interface of the OTG connection device 300.

[0141] S702: The electronic device 100 outputs a charging voltage. For example, the charging voltage may be 5 V. For example, the control unit 102 may output the charging voltage to the VBUS pin 1 through the charging management unit 105 .

[0142] S703: In the electronic device 200, the pin voltage of the VBUS pin 2 is pulled up accordingly, and the VBUS voltage comparator A in the interface circuit 203 VBUS The voltage at VBUS pin 2 can be greater than the VBUS reference voltage V ref_VBUS When the VBUS detection signal is received, the control unit 202 sends a VBUS detection signal to the control unit 202. After receiving the VBUS detection signal, the control unit 202 can determine that the electronic device 200 has completed the physical connection with the master device as a slave device.

[0143] In a possible implementation, the electronic device 200 may first perform a non-standard detection on the USB interface 101 of the electronic device 100, and after determining that the USB interface 101 is a standard interface, identify the type of the USB interface 101. For example, the electronic device 200 may continue to execute S704: the electronic device 200 performs a non-standard detection. Figure 4b As shown, the interface circuit 203 also includes a non-standard detection current source S I_tes , non-standard detection current source S I_tes One end is connected to DP pin 2, and the non-standard detection current source S I_tes The other end is used to receive the non-standard detection voltage V LGC_HI In S704, the electronic device 200 may turn on the non-standard detection current source S I_tes and DP current source S 2 I_DP , for non-standard testing.

[0144] According to S704, there are at least two results:

[0145] Result 1: S705, DP pin 2 pin voltage is non-standard detection voltage V LGC_HI In this case, S720 may be continued to determine that the USB interface 101 is a non-standard port. After determining that the USB interface 101 is a non-standard port, the electronic device 200 cannot communicate with the electronic device 100 through the USB connection, and the electronic device 200 can only accept a maximum charging current of 500 mA.

[0146] Result 2: S706, the pin voltage of DP pin 2 is within the standard voltage range. In this case, the electronic device 200 can determine that the USB interface 101 is a standard port specified by the BC1.2 protocol.

[0147] The following is a simple analysis: After the electronic device 100 determines that the USB interface 101 is connected to the main device interface of the OTG connection device 300, it will turn on the DP pull-down resistor R in the interface circuit 103. DP and DM pull-down resistor R DM If the USB interface 101 and the USB interface 102 are connected normally, the DP pull-down resistor R DP A voltage divider will be generated, making the voltage of DP pin 2 lower than the non-standard detection voltage V LGC_HI . The non-standard detection current source S I_tes and DP current source S 2 I_DP Then the DP pull-down resistor R in the interface circuit 103 can be DP The current in the DP pull-down resistor R DP The magnitude of the voltage division produced is known. Generally speaking, the standard voltage range is 100mV to 323mV.

[0148] If the USB interface 101 and the USB interface 102 are not connected normally, the DP pull-down resistor R in the interface circuit 103 DP No voltage division will be generated. The voltage of DP pin 2 is the non-standard detection voltage V LGC_HI Therefore, in S705 , USB 101 can be considered as a non-standard port.

[0149] After determining that the USB interface 101 is a standard port, the electronic device 200 may continue to identify the type of the USB interface 101. For example, the electronic device 200 may continue to execute S707: the electronic device 200 turns on the DP voltage source S 2 V_DP and DM current source S 2 I_DM It is understandable that the electronic device 200 also needs to turn off the DP current source S 2 I_DP The specific implementation of this step can refer to the above embodiment, which will not be described in detail.

[0150] The electronic device 100 can be improved as follows: Figure 7As shown in the dashed box, after the electronic device 100 starts to output the charging voltage (S702), it will continue to execute 508: the electronic device 100 waits for a first time period and then turns on the DP detection circuit 1032. During the first time period, the electronic device 200 can execute S703 to S706, or S703 to S705.

[0151] S709: The electronic device 100 detects that the voltage of the DP pin 1 is greater than the DP reference voltage V ref_DP Specifically, when the electronic device 200 executes S707, it turns on the DP voltage source S 2 V_DP , so that the pin voltage of DP pin 1 is pulled up accordingly. DP detection circuit 1032 can detect the pin voltage of DP pin 1 when it is greater than DP reference voltage V ref_DP When the DP detection signal is sent to the control unit 102, the control unit 102 may continue to execute S710 after receiving the DP detection signal: turning on the DP voltage source S 1 V_DP .

[0152] In S710, the electronic device 100 continuously turns on the DM voltage source S 1 V_DM After the time reaches the second time length, the electronic device 100 can turn off the DM voltage source S 1 V_DM During the second time period, the voltage of DM pin 2 is pulled up to a level greater than the DM reference voltage V ref_DM , so that the electronic device 200 can continue to execute S711 after S707, and detect that the pin voltage of DM pin 2 is greater than the DM reference voltage V ref_DM .

[0153] In this case, the electronic device 200 may continue to execute S712: determine that the USB interface 101 is not a SDP. The electronic device 200 then executes S713: the electronic device 200 turns on the DM voltage source S 2 V_DM and DP current source S 2 I_DP Since the DP pin 1 and the DM pin 1 in the USB interface 101 of the electronic device 100 are open circuited, the electronic device 200 will continue to execute S714 and detect that the pin voltage of the DM pin 2 is not greater than the DM reference voltage V ref_DM In this case, the electronic device 200 may continue to execute S717: determine that the USB interface 101 is a CDP. Then, the electronic device 200 and the electronic device 100 may perform high current charging according to the CDP protocol and may also communicate with each other.

[0154] Since in the embodiment of the present application, the electronic device 100 can make the slave device recognize the USB interface 101 as a CDP when serving as a master device, the electronic device 100 provided in the embodiment of the present application can be used as a USB hub.

[0155] For example, Figure 1 The electronic device 200 shown may also be a mobile hard disk 200. When the electronic device 100 detects the mobile hard disk 200, the mobile hard disk 200 may identify the USB interface 101 as a CDP. In this case, the electronic device 100 may communicate with the mobile hard disk 200 through the USB interface 101, thereby realizing the detection of the mobile hard disk 200. At the same time, the electronic device 100 may also provide a high current power supply to the mobile hard disk 200 through the USB interface 101, so that the mobile hard disk 200 does not need to be connected to other external power supplies.

[0156] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0157] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0158] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0159] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0160] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. An electronic device, It is characterized in that It comprises a universal serial bus USB interface, a control unit and an interface circuit, wherein the control unit is used to execute a standard downstream port SDP protocol; the USB interface comprises a digital negative DM pin and a digital positive DP pin, wherein the DM pin is disconnected from the DP pin; the interface circuit comprises a DP detection circuit, wherein the DP detection circuit is connected to the control unit and the DP pin respectively; After the USB interface of the electronic device is connected to the USB interface of the slave device through the USB active OTG connection device, the DP pin of the USB interface is connected to the DP pin of the slave device, and the DM pin of the USB interface is connected to the DM pin of the slave device; The control unit is used to: after the USB interface is connected to the host device interface of the USB active OTG connection device, turn on the DP detection circuit; The DP detection circuit is used to: output a second detection signal to the control unit when the pin voltage of the DP pin is greater than the DP reference voltage; The control unit is further configured to: after receiving the second detection signal, control the interface circuit to provide a DM voltage to the DM pin; When the slave device starts to identify the USB interface of the electronic device, it applies a DP voltage to the DP pin of the slave device, and after detecting that the voltage of the DM pin of the slave device is greater than the DM reference voltage, it applies a DM voltage to the DM pin of the slave device, and when the voltage of the DP pin of the slave device is less than the DP reference voltage, it identifies the USB interface as a charging downstream port CDP.

2. The electronic device according to claim 1, It is characterized in that The interface circuit includes a DM voltage source; The control unit is further used for: The DM voltage source is turned on, and the DM voltage source is used to provide the DM voltage to the DM pin.

3. The electronic device according to claim 1, It is characterized in that The interface circuit comprises a trigger comparator, and the trigger comparator is respectively connected to the trigger pin of the USB interface and the control unit; The trigger comparator is used to: send a first detection signal to the control unit when the pin voltage of the trigger pin is lower than the trigger reference voltage; The control unit is further used to: after receiving the first detection signal, determine that the USB interface is connected to the main device interface of the OTG connection device.

4. The electronic device according to claim 1, It is characterized in that The electronic device further comprises a charging management unit; The charging management unit is used to output a charging voltage to the VBUS pin of the USB interface; The control unit is also used for: After the USB interface is connected to the main device interface of the OTG connection device, controlling the charging management unit to output a charging voltage to the VBUS pin of the USB interface; After the duration for which the charging management unit outputs the charging voltage reaches a first duration, the DP detection circuit is turned on.

5. The electronic device according to any one of claims 1 to 4, It is characterized in that The control unit is further used for: The DP detection circuit is periodically turned on until the second detection signal is received, or until the number of times the DP detection circuit is turned on reaches a number threshold.

6. The electronic device according to any one of claims 1 to 4, It is characterized in that The control unit is further used for: After the duration for controlling the interface circuit to provide the DM voltage to the DM pin reaches a second duration, controlling the interface circuit to stop providing the DM voltage to the DM pin.

7. A charging method, It is characterized in that A control unit applied to an electronic device, the control unit is used to execute a standard downstream port SDP protocol, the electronic device further comprises a universal serial bus USB interface and an interface circuit; the USB interface comprises a digital negative DM pin and a digital positive DP pin, the DM pin is disconnected from the DP pin, and the control unit is connected to the DP pin; After the USB interface of the electronic device is connected to the USB interface of the slave device through the USB active OTG connection device, the DP pin of the USB interface is connected to the DP pin of the slave device, and the DM pin of the USB interface is connected to the DM pin of the slave device; The method comprises: After the USB interface is connected to the host device interface of the USB active OTG connection device, the pin voltage of the DP pin is detected by the interface circuit, and after the pin voltage of the DP pin is greater than the DP reference voltage, the interface circuit is controlled to provide a DM voltage to the DM pin; When the slave device starts to identify the USB interface of the electronic device, it applies a DP voltage to the DP pin of the slave device, and after detecting that the voltage of the DM pin of the slave device is greater than the DM reference voltage, it applies a DM voltage to the DM pin of the slave device, and when the voltage of the DP pin of the slave device is less than the DP reference voltage, it identifies the USB interface as a charging downstream port CDP.

8. The method according to claim 7, It is characterized in that The interface circuit includes a DM voltage source; Controlling the interface circuit to provide the DM voltage to the DM pin includes: The DM voltage source is turned on, and the DM voltage source is used to output the DM voltage to the DM pin.

9. The method according to claim 7, It is characterized in that The method further comprises: When the pin voltage of the trigger pin of the USB interface is greater than the trigger reference voltage, it is determined that the USB interface is connected to the main device interface of the OTG connection device.

10. The method according to claim 7, It is characterized in that After the USB interface is connected to the host device interface of the USB active OTG connection device, detecting the pin voltage of the DP pin includes: After the USB interface is connected to the main device interface of the OTG connection device, outputting a charging voltage to the VBUS pin of the USB interface; After the duration of outputting the charging voltage reaches a first duration, the pin voltage of the DP pin is detected through the interface circuit.

11. The method according to any one of claims 7 to 10, It is characterized in that Detecting the pin voltage of the DP pin through the interface circuit includes: The pin voltage of the DP pin is periodically detected through the interface circuit until the pin voltage of the DP pin is greater than the DP reference voltage, or the number of times the pin voltage of the DP pin is detected reaches a number threshold.

12. The method according to any one of claims 7 to 10, It is characterized in that After controlling the interface circuit to provide the DM voltage to the DM pin, the method further includes: After the duration for controlling the interface circuit to provide the DM voltage to the DM pin reaches a second duration, controlling the interface circuit to stop providing the DM voltage to the DM pin.

13. A charging system, It is characterized in that Including master device, OTG connection device and slave device; The USB interface of the master device is connected to the master device interface of the OTG connection device, and the USB interface of the slave device is connected to the slave device interface of the OTG connection device; The master device is the electronic device according to any one of claims 1 to 6, and the master device is used to charge the slave device through the OTG connection device.

14. The charging system according to claim 13, It is characterized in that The master device is also used to transmit data with the slave device via the OTG connection device.