Interface plug-out detection method, electronic device, and storage medium
By switching the constant current source in the power supply equipment and combining it with voltage threshold judgment, the problem of repeated charging during the charging process of the Type-C interface is solved, achieving low power consumption and accurate interface unplug detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN INJOINIC TECH
- Filing Date
- 2026-03-03
- Publication Date
- 2026-06-05
AI Technical Summary
During Type-C interface charging, if the power supply to the device is turned off but the device remains connected without being unplugged, the CC pin of the power supply device will be repeatedly reset, causing repeated charging.
By setting a first constant current source and a second constant current source in the power supply equipment, the constant current source is switched in response to the stop output signal. Combined with the duration of disconnection and voltage threshold judgment, the interface disconnection status is accurately identified to prevent repeated charging.
This technology reduces power consumption after the device is fully charged, prevents repeated connections between the power supply and the device, reduces power consumption, and improves the accuracy and anti-interference capability of connection detection.
Smart Images

Figure CN122152609A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of interface detection technology, and in particular to an interface unplugging detection method, electronic device, and storage medium. Background Technology
[0002] An interface refers to the collective term for connecting components and communication protocols that enable data transmission, signal exchange, and power supply between two or more independent systems / devices. Interfaces can be classified according to transmission function, interface form, and application scenario. Among them, the Type-C interface, due to its policy mandate, technological versatility, and environmental benefits, has become the core standard for global electronic devices. The development of the Type-C interface has entered a stage of widespread adoption, with more and more consumer electronics products using Type-C interfaces as charging ports. Adapters, vehicle charging interfaces, and power banks, as common communication ports, are also increasingly using Type-C interfaces.
[0003] Some problems have been exposed during the promotion of Type-C interfaces in the field of power banks. For example, after the device is fully charged, the power supply device will repeatedly reset the CC pin of the power supply device to connect to the device in order to reduce power consumption and then turn off the output power supply, causing repeated recharging. Summary of the Invention
[0004] The embodiments of this application aim to provide an interface unplugging detection method, circuit, and electronic device to improve the technical problem that after the power supply device is fully charged, in order to reduce power consumption, it shuts off the output power supply and repeatedly resets the CC pin of the power supply device to connect to the power supply device, causing repeated recharging.
[0005] The first aspect of this invention provides an interface unplugging detection method applied to a power supply device. The power supply device supplies power to a user device and includes an interface, a first constant current source, and a second constant current source. The interface is connected to the first constant current source and the second constant current source, respectively. The interface unplugging detection method includes: responding to a stop output signal, controlling the first constant current source to turn off and controlling the second constant current source to turn on, wherein the stop output signal is a signal indicating that the power supply device stops outputting power, the first constant current source is configured to supply power to the user device, the second constant current source is configured to detect the operating state of the interface, and the current of the first constant current source is greater than the current of the second constant current source; responding to a device unplugging signal, determining a unplugging duration, wherein the device unplugging signal is the user device being unplugged from the interface of the power supply device, and the unplugging duration is the duration when the communication terminal voltage of the interface is at a first level; if the unplugging duration is greater than a preset removal duration, generating device unplugging information, the device unplugging information indicating that the user device is unplugged from the interface of the power supply device.
[0006] Optionally, in a first implementation of the first aspect of the present invention, the power supply device further includes a window comparison module connected to the interface. After controlling the first constant current source to turn off and the second constant current source to turn on in response to a stop output signal, the interface unplug detection method further includes: in response to a disconnection signal from the power device, controlling the communication terminal voltage of the interface to be greater than the window comparison upper limit voltage; determining the disconnection duration, the disconnection duration being the duration for which the communication terminal voltage is greater than a preset window comparison upper limit voltage, the window comparison upper limit voltage being a voltage threshold used by the window comparison module to determine that the communication terminal of the interface is at a high level; if the disconnection duration is less than the preset removal duration, generating device not unplugged information, the device not unplugged information being used to indicate information about the interface connection between the power device and the power supply device.
[0007] Optionally, in a second implementation of the first aspect of the present invention, the preset removal duration is longer than the duration of the disconnect signal.
[0008] Optionally, in a third implementation of the first aspect of the present invention, before responding to the stop output signal, the method further includes: responding to the communication terminal voltage of the interface being greater than a preset lower window voltage and less than or equal to a preset upper window voltage, controlling the first constant current source to turn on, so that the first constant current source supplies power to the electrical device, and keeping the second constant current source off.
[0009] Optionally, in a fourth implementation of the first aspect of the present invention, after responding to the communication terminal voltage of the interface being greater than a preset lower window voltage and less than or equal to a preset upper window voltage, the method further includes: if the communication terminal voltage of the interface is between the lower window voltage and the upper window voltage, then generating a device connection signal, wherein the device connection signal represents a signal that the power supply device is connected to the power consumption device and the power supply device stops supplying power to the power consumption device.
[0010] Optionally, in a fifth implementation of the first aspect of the present invention, the window comparison module includes a first window comparator, and the generation of the device connection signal includes: determining a level detection duration, wherein the level detection duration is the duration during which the first window comparator continuously detects a second level, and the first level and the second level are different levels; if the level detection duration is greater than a preset level period, then a device connection signal is generated.
[0011] Optionally, in a sixth implementation of the first aspect of the present invention, after generating the device connection signal, the method further includes: determining an access duration, wherein the access duration is the duration during which the communication terminal voltage of the interface is greater than a preset lower window voltage and less than or equal to a preset upper window voltage; if the access duration is greater than a preset debouncing duration, then controlling the power supply device to supply power to the device, wherein the preset debouncing duration is the duration for filtering jitter.
[0012] Optionally, in a seventh implementation of the first aspect of the present invention, controlling the power supply device to supply power to the electrical device includes: in response to the output state of the communication terminal switching from a first state to a second state, controlling the interface to output power, wherein the first state is a state in which the communication terminal stops outputting power, and the second state is a state in which the communication terminal outputs power; keeping the first constant current source on and keeping the second constant current source off.
[0013] A second aspect of the present invention provides a power supply device, including a memory and a processor, the memory being connected to the processor, the processor being configured to execute one or more computer programs stored in the memory, wherein when the processor executes the one or more computer programs, the power supply device enables the aforementioned interface unplug detection method.
[0014] A third aspect of the present invention provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the aforementioned interface unplug detection method.
[0015] The embodiments of this application can achieve the following technical effects: After the power supply device is fully charged, in order to reduce power consumption, the power supply device shuts off the output power supply. In response to the stop output signal, the embodiments of this application control the first constant current source to turn off and control the second constant current source to turn on. The current of the first constant current source is greater than the current of the second constant current source. At this time, the communication CC pin of the power supply device is still connected to the power supply device. By switching the first constant current source to the second constant current source with a smaller current, the power supply device is kept connected, making the power supply device think that it has not been disconnected from the power supply device, thereby preventing the power supply device from repeatedly connecting to the power supply device, while reducing power consumption. By comparing the duration of disconnection with the preset removal duration, it is possible to more accurately determine whether the power supply device has been disconnected. The setting of the preset removal duration can filter the time when the power supply device actively disconnects, preventing the power supply device from repeatedly charging the power supply device. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a simplified timing diagram of a traditional Type-C charging interface connection in related technologies; Figure 2 This is a simplified timing diagram of a traditional Type-C charging interface connection in another related technology; Figure 3 This is a simplified timing diagram of a traditional Type-C charging interface connection in another related technology; Figure 4 This is a schematic diagram of the power supply equipment provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of the Type-C charging interface provided in the embodiments of this application; Figure 6 This is a flowchart of an interface unplugging detection method provided in an embodiment of this application; Figure 7 This is a simplified timing diagram of a Type-C charging interface connection provided in an embodiment of this application; Figure 8 This is another simplified timing diagram of a Type-C charging interface connection provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of an interface unplugging detection device provided in an embodiment of this application; Figure 10 This is a schematic diagram of another power supply device provided in an embodiment of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0019] It should be noted that, unless there is a conflict, the various features in the embodiments of this application can be combined with each other, all of which are within the protection scope of this application. Furthermore, although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than the module division in the device or the order in the flowchart. Moreover, the terms "first," "second," and "third" used in this application do not limit the data or execution order, but only distinguish identical or similar items with essentially the same function and effect.
[0020] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.
[0021] The inventors discovered a related technology in the process of implementing the embodiments of this application; please refer to [link / reference]. Figure 1 The relevant technologies enable the power supply equipment to charge the power consumption equipment as follows: The DRP is in the CCToogle stage. DRP (Dual Role Port) refers to a USB Type-C port that can dynamically switch between a source device and a sink device. A source device is a device that actively outputs and provides power; such devices include chargers, power adapters, car power ports, computer USB ports, and socket-type power modules. A sink device is a device that consumes and receives power; such devices include mobile phones, tablets, laptops, headphones, power banks, lamps, and motors. The CCToogle stage is where the CC pin of the sink device switches between high and low levels. This switching involves changing from a low level to a high level. The high level is achieved by pulling up a first constant current source, and the low level is achieved by pulling down a second constant current source. In related technologies, the first constant current source is 330μA, and the second constant current source is 180μA.
[0022] Connect the power supply equipment; the power supply terminal CC pin of the equipment is connected via 5.1. The pull-down resistor is grounded. The power supply terminal CC pin of the electrical device is connected to the power supply terminal CC pin of the power supply device. The power supply terminal CC pin of the power supply device is configured as a 330μA or 180μA constant source pull-up. The power supply terminal CC pin generates an intermediate level. 180μA corresponds to an intermediate level of 0.918V, and 330μA corresponds to an intermediate level of 1.683V. 180μA and 330μA indicate that the power supply terminal can support different load capacities. 180μA indicates that the load capacity of the power supply terminal is 1.5A, and 330μA indicates that the load capacity is 3A. Load capacity refers to the maximum operating current that the power supply device can stably output.
[0023] After the intermediate level lasts for tCCDeb, the power supply device considers the device to be successfully inserted and outputs the rated voltage to the VBUS bus to provide power to the device. tCCDeb represents the debouncing time for connection detection of the CC pin of the power supply terminal. The VBUS bus is the core power bus in the USB Type-C interface specifically used for transmitting power.
[0024] After the device is removed, the power supply device detects that the device is unplugged and shuts off the VBUS bus to power the device. RemovedDeb represents the debouncing time for unplugging detection, which is used by the power supply device to determine that the device is effectively unplugged.
[0025] The aforementioned female connector, based on the traditional Type-C charging interface connection timing design, has the following two problems during the charging process: Question 1: After fully charging the electrical equipment and turning off the power supply, please refer to [the relevant instructions]. Figure 2 At this point, the device is not unplugged, and its CC pin remains connected to the power supply. The power supply does not detect that the device has been unplugged and continues to maintain a 330μA pull-up current through the first constant current source. The device continues to operate under the 5.1 current supply. The pull-down resistor remains pulled down. Even though the power supply equipment stops supplying power, the 330μA of the power consumption terminal CC pin of the power-consuming equipment is still pulled down by 5.1K, and there is still a 330μA power consumption. The power consumption terminal CC pin of the power-consuming equipment is still connected to the power supply equipment, which leads to an increase in the power consumption of the power supply equipment.
[0026] Question 2: After the electrical equipment is fully charged and the power supply is turned off, the equipment detects a voltage interruption. Please refer to [link / reference needed]. Figure 3The device actively disconnects its CC pin from the power supply for a period of time to reset its Type-C interface. However, the device and the power supply are still connected through the CC cable. When the power supply detects the CC connection, it turns on the output again. But the device is already fully charged, so the power supply turns off the output again. The device then disconnects the CC pin again to reset its Type-C interface. This cycle repeats, causing the device to be repeatedly charged. A CC connection refers to the connection between the CC pin of the power supply and the CC pin of the device.
[0027] Therefore, this application provides a power supply device. Please refer to [link / reference]. Figure 4 The power supply equipment 100 includes an interface 11, a square wave generator 12, a first constant current source 13, a second constant current source 14, a controller 15, a window comparison module 16, a clock module 17, and a power supply module 18.
[0028] Interface 11 is used to realize the connection detection and power transmission between the power supply device 100 and the power consumption device. Interface 11 can be a Mini USB interface, Micro USB interface, USB Type-C interface, and Lightning interface. Interface 11 is provided with a power supply CC pin, which is connected to the power consumption CC pin of the power consumption device. The power supply CC pin is a dedicated detection pin in the Type-C interface of the power supply device 100. The power supply CC pin is used to detect the insertion of the power consumption device, the amount of current that can be supplied, and when the constant current source is switched on and off. The power consumption CC pin is the USB Type-C configuration channel pin of the power consumption device. It is used to ground through an internally preset 5.1kΩ pull-down resistor and cooperate with the constant current source pull-up of the power supply CC pin to form a characteristic intermediate level, thereby realizing connection status recognition and power supply capability detection. Type-C interfaces are divided into DRP, DFP, and UFP interfaces. The DFP interface is a Type-C downlink port, serving as the power supply end and the host end. It outputs pull-up current through the CC pin to detect connected devices and provide power supply voltage. The UFP interface is a Type-C uplink port, serving as the power receiving end and the device end. It connects a 5.1kΩ pull-down resistor through the CC pin, which, together with the pull-up current of the DFP interface, forms a detection level to achieve connection identification. The DRP interface is a Type-C dual-role port that can dynamically switch between DFP and UFP roles. It alternately sends pull-up and detection levels through the CC pin to automatically complete role negotiation and connection establishment.
[0029] Portable power banks typically use a DRP interface, which can be used as a power supply to provide output voltage for external discharge, or as a power user to receive input voltage for internal charging.
[0030] The Type-C charging port female connectors of adapters, car charging ports, and power banks are primarily used for power transmission and are generally not used for data transmission. Please refer to [link / reference]. Figure 5 Taking power banks as an example, Type-C charging ports typically only retain A1, B1, A4, B4, A5, B5, A6, B6, A7, B7, A9, B9, A12, and B12.
[0031] Among them, A1, B1, A12, and B12 are GND, which are the negative terminals of the power supply pins. A4, B4, A9, and B9 are VBUS bus pins, which are the positive terminals of the power supply pins. A5 and B5 are CC pins, used for Type-C interface charging information communication. They are used in Type-C protocol communication, which is a low-level hardware protocol communication mechanism based on the USB Type-C specification. Through the CC pin, it uses pull-up current sources, pull-down resistors, characteristic level detection, and timing debouncing to realize the connection status identification, role negotiation, power supply capability confirmation, and plug-in / plug-out detection between the power supply device 100 and the power consumption device. A6 and B6 are D+ pins, and A7 and B7 are D- pins, which are USB 2.0 communication pins used in QC (Quick Charge) protocol communication. QC protocol communication is a dedicated communication mechanism in Qualcomm's fast charging protocol where the power supply end and the power consumption end transmit specific voltage signals through the USB D+ / D- pins to complete handshake negotiation, so as to dynamically adjust the output voltage / current and achieve safe and efficient fast charging.
[0032] The square wave generator 12 is connected to the interface 11. The square wave generator 12 is used to provide timing signals. The square wave generator 12 is a module that generates periodic square wave signals with a fixed frequency and a fixed duty cycle. The periodic square wave signal refers to an electrical signal that repeats and alternates between high level and low level according to a fixed period and a regular pattern. The high level indicates that the voltage in the circuit is in a stable state in a preset higher potential range, and the low level indicates that the voltage in the circuit is in a stable state in a preset lower potential range.
[0033] The first constant current source 13 and the second constant current source 14 are respectively connected to the interface 11. The first constant current source 13 and the second constant current source 14 refer to current sources with fixed output current that do not change significantly with voltage / load. In this embodiment, the first constant current source 13 can be set to a current source of 330μA and the second constant current source 14 can be set to a current source of 20μA. The current magnitude of the first constant current source 13 and the second constant current source 14 is not limited to the above values.
[0034] The controller 15 is connected to the square wave generator 12, the first constant current source 13 and the second constant current source 14 respectively, and is used to control the opening or closing of the first constant current source 13 and the second constant current source 14 as well as to control the power supply of the power supply equipment 100.
[0035] The window comparison module 16 is connected to the controller 15 and is used to determine which preset range the voltage of the CC pin of the power supply terminal falls within. The window comparison module 16 includes a first window comparator and a second window comparator. The first window comparator can obtain the upper limit voltage of the window, and the second window comparator can obtain the lower limit voltage of the window. The preset range is the range limited by the upper limit voltage and the lower limit voltage of the window.
[0036] The clock module 17 is connected to the controller 15 and is used to provide a stable time reference for the entire power supply device 100 for timing tCCDeb and RemovedDeb.
[0037] The power supply module 18 is connected to the controller 15 and the interface 11 respectively, and is used to provide output voltage to the interface 11.
[0038] For ease of understanding, the specific process of the embodiments of this application is described below, please refer to it. Figure 6 and Figure 7 The embodiment of this application implements the interface 11 unplug detection method through steps S61 to S63, and applies it to the power supply equipment 100, as shown below: S61. In response to the stop output signal, control the first constant current source 13 to turn off and control the second constant current source 14 to turn on, wherein the stop output signal is a signal for the power supply device 100 to stop outputting power, the first constant current source 13 is configured to supply power to the power-consuming device, the second constant current source 14 is configured to detect the working status of the interface 11, and the current of the first constant current source 13 is greater than the current of the second constant current source 14.
[0039] When the power supply device 100 actively shuts down the power supply module 18, for example, when the power supply device 100 detects that the power-consuming device is fully charged or the user actively triggers the shutdown of the power-consuming device, the controller 15 controls the shutdown of the first constant current source 13 and simultaneously turns on the second constant current source 14. When the power-consuming device is fully charged, the VBUS bus current of the power supply device 100 is ≤100μA.
[0040] The power supply device 100 controls the first constant current source 13 to shut down, stopping the output of the 330μA current source, and controls the second constant current source 14 to turn on, outputting a 20μA current source to the power-consuming device. The first constant current source 13 is used to inform the power-consuming device of the power supply device 100's power supply capability, and the second constant current source 14 is used for detecting the removal of the CC pin at the power-consuming terminal. When the power supply device 100 actively shuts down its output, it switches the 330μA current source to a 20μA current source for power supply. (5.1) The pull-down resistor's power supply pin (CC pin) is continuously connected to the power supply pin (CC pin) of the power supply device 100.
[0041] Switching the first constant current source 13 to the second constant current source 14 can prevent the electrical device from thinking that it has been disconnected from the power supply device 100, prevent the electrical device from repeatedly connecting to the power supply device 100, and switch to the second constant current source 14 with a smaller current can reduce the power consumption of the power supply device 100.
[0042] If the power supply terminal CC pin of the electrical equipment remains continuously connected to the power supply terminal CC pin of the power supply equipment 100, then the electrical equipment shall comply with 5.1 The pull-down resistor and the power supply device 100 remain connected as a 20μA current source pull-up. At this time, the internal flags of the controller 15 keep CC_connect at 1 and CC_SRC_OK at 0. CC_connect refers to the connection status between the power supply terminal CC pin of the power-consuming device and the power supply terminal CC pin of the power supply device 100. CC_connect = 1 indicates that the power supply terminal CC pin of the power-consuming device is connected to the power supply terminal CC pin of the power supply device 100, and CC_connect = 0 indicates that the power supply terminal CC pin of the power-consuming device is not connected to the power supply terminal CC pin of the power supply device 100. CC_SRC_OK refers to the output status of the power supply device 100. CC_SRC_OK = 1 indicates that the power supply device 100 outputs power, and CC_SRC_OK = 0 indicates that the power supply device 100 outputs power.
[0043] S62. In response to a device unplug signal, determine the unplug duration, wherein the device unplug signal is the electrical device being unplugged from the interface 11 of the power supply device 100, and the unplug duration is the duration when the communication terminal voltage of the interface 11 is at a first level.
[0044] When the controller 15 receives the device unplug signal, it controls the clock module 17 to keep track of the duration of the unplugging. In this embodiment, the first level is set to a high level, and the communication terminal voltage is the voltage of the CC pin of the power supply terminal.
[0045] S63. If the duration of the unplugging is longer than the preset removal duration, device unplugging information is generated. The device unplugging information is used to indicate that the electrical device is unplugged from the interface 11 of the power supply device 100.
[0046] When the electrical equipment is unplugged, the CC pin of the power supply terminal of the power supply device 100 returns to a high level, and the high level duration is greater than the preset removal time T. 20After `DEB`, the device removal information is generated, indicating that the power supply has been removed. At this time, the internal flags of controller 15 remain `CC_connect=0` and `CC_SRC_OK=0`. Square wave generator 12 is turned on, first constant current source 13 is turned off, and second constant current source 14 remains off. When no power supply is inserted or the device has just been removed, power supply device 100 does not supply power or output a large current; only square wave generator 12 is turned on. Once a power supply is inserted, power supply device 100 can immediately detect the intermediate level, maintaining its detection capability but not supplying power, thus achieving low power consumption, safe standby, and real-time detection. Preset removal duration T. 20 Deb represents the set duration for which the electrical device is disconnected from the interface 11 of the power supply device 100 when the second constant current source 14 is turned on and the first constant current source 13 is turned off.
[0047] Please see Figure 7 In some embodiments, after controlling the first constant current source 13 to turn off and the second constant current source 14 to turn on in response to the stop output signal, the interface 11 unplug detection method further includes: in response to the disconnection signal of the power device, controlling the communication terminal voltage of the interface 11 to be greater than the window comparison upper limit voltage; determining the disconnection duration, the disconnection duration being the duration for which the communication terminal voltage is greater than a preset window comparison upper limit voltage, the window comparison upper limit voltage being a voltage threshold used by the window comparison module 16 to determine that the communication terminal of the interface 11 is at a high level; if the disconnection duration is less than the preset removal duration, generating device not unplugged information, the device not unplugged information being used to indicate information that the power device is connected to the interface 11 of the power supply device 100.
[0048] The communication terminal of interface 11 is the power supply CC pin. The upper limit voltage of the window comparison is used as the high-level judgment threshold to determine whether the power supply CC pin has entered the disconnect state. If the disconnection duration is less than the preset removal duration T, the connection will be closed. 20 If the value is "Deb", it is determined to be a jitter / momentary disconnection, not a real disconnection. The device is generated as not disconnected, and the original connection state is maintained. No complete power-off or reset operation is performed, so that the device and the power supply device 100 will not be repeatedly connected. The power supply device 100 actively shuts down the power supply module 18 to stop the output voltage. The device actively disconnects from the CC pin of the power supply terminal because the power supply is shut down. After a period of time, the device reconnects to the CC pin of the power supply terminal.
[0049] The power supply device 100 actively shuts down its output module. The controller 15 controls the first constant current source 13 to stop the power output, while simultaneously turning on the second constant current source 14 to detect the disconnected state of the power supply device. Because the power supply is shut off, the power supply device actively disconnects from the CC pin of the power supply terminal. The voltage on the CC pin of the power supply terminal returns to a high level. If the voltage on the CC pin of the power supply terminal is greater than the upper limit voltage VRP1 of the window comparison, and the disconnection duration is less than the preset removal duration T... 20 If Deb is generated, the device is not unplugged information is generated, indicating that the power supply equipment is not unplugged. The 10020μA current source of the power supply equipment is pulled up. At this time, the internal flags of controller 15 are CC_connect=1 and CC_SRC_OK=0.
[0050] In some embodiments, a preset removal duration T is provided. 20 Deb is greater than the duration of the disconnect signal, which is the preset removal duration T. 20 The `DEB` parameter specifies the duration for which the power supply device actively disconnects from the CC pin. This setting filters the time when the device actively disconnects, preventing it from being mistakenly identified as accidentally unplugged / disconnected. It also prevents the power supply device 100 from arbitrarily shutting down or resetting, ensuring that the power supply device 100 only disconnects when the actual physical disconnect signal duration exceeds the preset removal duration `T`. 20 The unplugging process is only executed during the Deb phase to improve detection accuracy and timing compatibility with the power supply equipment. In this embodiment, a preset removal duration T is used. 20 The range of Deb can be set from 500ms to 1s to adapt to the duration of the active disconnection of the CC pin of mainstream power devices. The range of the duration of the active disconnection of the CC pin of the power supply terminal, Tmove, can be set from 100ms to 500ms.
[0051] Please see Figure 8 In some embodiments, before responding to the stop output signal, the method further includes: responding to the communication terminal voltage of the interface 11 being greater than a preset lower window voltage and less than or equal to a preset upper window voltage, controlling the first constant current source 13 to turn on, so that the first constant current source 13 supplies power to the electrical device, and keeping the second constant current source 14 off.
[0052] The lower limit voltage of the window can be set to 0.8V, and the upper limit voltage of the window can be set to 2.6V. The corresponding pull-up current is only provided after the power supply is confirmed to be effectively connected. This ensures that the detection and power supply logic are triggered in an orderly manner, avoids level confusion caused by multiple constant current sources working at the same time, and improves the accuracy of connection identification and the reliability of power supply control.
[0053] In some embodiments, after responding to the communication terminal voltage of the interface 11 being greater than a preset lower window voltage and less than or equal to a preset upper window voltage, the method further includes: if the communication terminal voltage of the interface 11 is between the lower window voltage and the upper window voltage, then a device connection signal is generated, the device connection signal representing a signal that the power supply device 100 is connected to the power consumption device and the power supply device 100 stops supplying power to the power consumption device.
[0054] When the intermediate level voltage of the CC pin of the power supply terminal is between the lower limit voltage and the upper limit voltage of the window, it is considered that the pull-down resistor is connected to the power supply device 100, generating a device connection signal. This can accurately and stably distinguish whether the power supply device is connected but not powered, avoiding misjudgment of status caused by level drift, noise or contact jitter, and improving the reliability and anti-interference capability of connection detection.
[0055] In some embodiments, the window comparison module 16 includes a first window comparator, and the generation of the device connection signal includes: determining a level detection duration, wherein the level detection duration is the duration during which the first window comparator continuously detects a second level, the first level and the second level are different levels, and if the level detection duration is greater than a preset level period, then generating the device connection signal.
[0056] Originally, the CCToggle state switches between high and low levels. When a device is plugged in, it pulls the high level down, resulting in a low level for the second stage. When the first window comparator continuously detects a low level for more than a preset level cycle, a device connection signal is generated. At this time, the internal flags CC_connect=1 and CC_SRC_OK=0 in controller 15. Controller 15 shuts down the square wave generator 12 and turns on the first constant current source 13. Meanwhile, controller 15 keeps the power supply module 18 and the second constant current source 14 off. The preset level cycle is the high and low level cycle time. By judging the duration of the second level, transient interference and jitter can be filtered out, ensuring that only a stable and valid level can trigger the device connection signal, thus improving connection detection accuracy and anti-interference capability.
[0057] In some embodiments, after generating the device connection signal, the method further includes: determining an access duration, wherein the access duration is the duration during which the communication terminal voltage of the interface 11 is greater than a preset lower window voltage and less than or equal to a preset upper window voltage, and the access duration is greater than a preset debouncing duration, then controlling the power supply device 100 to supply power to the device, wherein the preset debouncing duration is the duration for filtering jitter.
[0058] The clock module 17 times the duration of the connection, and the controller 15 determines the duration of the connection. When the power device is connected to the power supply device 100 via a cable, the pull-down resistor on the power supply terminal CC pin of the power device and the pull-up current source of the power supply terminal CC pin in the CCToggle state generate an intermediate level of 1.68V. When the intermediate level voltage of the communication terminal of interface 11 is between the lower limit voltage and the upper limit voltage of the window, it is considered that the pull-down resistor is connected to the power supply device 100, that is, the power device is connected to the power supply device 100. If the connection duration is longer than the preset debouncing duration, it is considered that the load connection is successful, and the power supply device 100 is controlled to supply power to the power device.
[0059] In some embodiments, controlling the power supply device 100 to supply power to the electrical device includes: in response to the output state of the communication terminal switching from a first state to a second state, controlling the interface 11 to output power, wherein the first state is the state in which the communication terminal stops outputting power and the second state is the state in which the communication terminal outputs power, keeping the first constant current source 13 on and keeping the second constant current source 14 off.
[0060] When CC_SRC_OK changes from 0 to 1, i.e., the rising edge signal of CC_SRC_OK is detected, the controller 15 controls the power supply module 18 to turn on, the first constant current source 13 remains on, and the second constant current source 14 remains off. At this time, the power supply device 100 is validly connected to the power supply device and the power supply device 100 is allowed to supply power to the power supply device.
[0061] If the power supply device is removed at this time, the power supply device 100 will still maintain a 330uA pull-up after the power supply device is actively unplugged midway. At this time, the voltage of the CC pin of the power supply terminal is greater than the upper limit voltage of the window comparison. After RemovedDeb, the power supply device 100 considers the power supply device to be removed, and the internal flags of the controller 15 are CC_connect=0 and CC_SRC_OK=0.
[0062] When CC_connect=0 and CC_SRC_OK=0, controller 15 controls power supply module 18 to shut down to stop output power, turns on square wave generator 12, turns off first constant current source 13, and keeps second constant current source 14 off.
[0063] In summary, the embodiments of this application have at least the following technical effects: 1) In this embodiment of the application, by switching the first constant current source 13 to the second constant current source 14 with a smaller current, the electrical device is kept connected, so that the electrical device thinks that it has not been disconnected from the power supply device 100, thereby preventing the power supply device 100 from repeatedly connecting to the electrical device, and reducing power consumption. 2) In this embodiment of the application, the preset removal time setting can filter the time when the power supply device 100 actively disconnects, preventing the power supply device 100 from repeatedly charging the power consumption device; 3) The embodiments of this application can identify whether the electrical equipment has been physically unplugged; 4) The embodiments of this application can accurately and stably distinguish whether the electrical equipment is connected but not powered, avoiding misjudgment of status caused by level drift, noise or contact jitter, and improving the reliability and anti-interference capability of connection detection.
[0064] It should be noted that in the above embodiments, there is no necessarily a certain order between the steps. Those skilled in the art can understand from the description of the embodiments of this application that the above steps may have different execution orders in different embodiments, that is, they may be executed in parallel or in turn, etc.
[0065] As another aspect of the embodiments of this application, this application provides an interface unplugging detection device 200. The interface unplugging detection device 200 can be a software module, which includes several instructions stored in a memory. A processor can access the memory and execute the instructions to complete the interface unplugging detection method described in the various embodiments above.
[0066] In some embodiments, the interface removal detection device 200 can also be constructed from hardware devices. For example, the interface removal detection device 200 can be constructed from one or more chips, and the chips can work together to complete the interface removal detection method described in the various embodiments above. As another example, the interface removal detection device 200 can also be constructed from various logic devices, such as general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), microcontrollers, ARM (Acorn RISC Machine) or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components.
[0067] Please see Figure 9 The interface unplug detection device 200 includes a control module 21, a timing module 22, and an information generation module 23.
[0068] Control module 21 is used to control the first constant current source 13 to turn off and control the second constant current source 14 to turn on in response to the stop output signal. Timing module 22 is used to calculate the duration of the pull-out. Information generation module 23 is used to generate device pull-out information if the duration of the pull-out is longer than the preset removal duration.
[0069] In some embodiments, the control module 21 is further configured to, in response to the disconnection signal of the power device, control the communication terminal voltage of the interface to be greater than the upper limit voltage of the window comparison, determine the disconnection duration, wherein the disconnection duration is the duration during which the communication terminal voltage is greater than the preset upper limit voltage of the window comparison, wherein the upper limit voltage of the window comparison is a voltage threshold used by the window comparison module 16 to determine that the communication terminal of the interface is at a high level, and if the disconnection duration is less than the preset removal duration, generate device not unplugged information, wherein the device not unplugged information is used to indicate the interface connection information between the power device and the power supply device 100.
[0070] In some embodiments, the control module 21 is further configured to control the first constant current source 13 to turn on in response to the communication terminal voltage of the interface being greater than a preset lower window voltage and less than or equal to a preset upper window voltage, so that the first constant current source 13 supplies power to the electrical device, and keeps the second constant current source 14 off.
[0071] In some embodiments, the information generation module 23 is further configured to generate a device connection signal if the communication terminal voltage of the interface is between the lower limit voltage of the window and the upper limit voltage of the window.
[0072] In some embodiments, the information generation module 23 is further configured to determine the level detection duration, which is the duration during which the first window comparator continuously detects the second level, wherein the first level and the second level are different levels, and if the level detection duration is greater than a preset level period, a device connection signal is generated.
[0073] In some embodiments, the control module 21 is further configured to determine the access duration, wherein the access duration is the duration during which the communication terminal voltage of the interface is greater than a preset lower window voltage and less than or equal to a preset upper window voltage; if the access duration is greater than a preset debouncing duration, the control module 21 controls the power supply device 100 to supply power to the power-consuming device, wherein the preset debouncing duration is the duration of filtering jitter.
[0074] In some embodiments, the control module 21 is further configured to control the interface to output power in response to the switching of the output state of the communication terminal from a first state to a second state, wherein the first state is the state in which the communication terminal stops outputting power and the second state is the state in which the communication terminal outputs power, and to keep the first constant current source 13 on and keep the second constant current source 14 off.
[0075] It should be noted that the aforementioned interface unplugging detection device 200 can execute the interface unplugging detection method provided in the embodiments of this application, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in the embodiments of the interface unplugging detection device 200 can be found in the interface unplugging detection method provided in the embodiments of this application.
[0076] See Figure 10 The power supply device 100 includes one or more processors 19 and a memory 110. The memory 110 is connected to one or more processors 19, for example, via a bus.
[0077] Processor 19 is configured to support the power supply device 100 in performing the corresponding functions in the methods described in the above method embodiments. Processor 19 may be a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof. The aforementioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0078] Memory 110 is used to store program code, etc. Memory 110 may include volatile memory (VM), such as random access memory (RAM); memory 110 may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); memory may also include combinations of the above types of memory.
[0079] The memory 110 can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the interface unplug detection method in the embodiments of this application. The processor 19 executes various functional applications and data processing of the interface unplug detection method and the interface unplug detection device 200 by running the non-volatile software programs, instructions, and modules stored in the memory 110, that is, it realizes the functions of the interface unplug detection method and the various modules or units of the interface unplug detection device 200 provided in the above method embodiments.
[0080] The memory 110 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and application programs required for at least one function. The data storage area may store data created based on the use of the interface unplug detection device 200, etc. In some embodiments, the memory 110 may optionally include remotely located memories 110 relative to the processor 19, which can be connected to the interface unplug detection device 200 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0081] The one or more modules are stored in the memory 110. When executed by the one or more processors 19, they execute the interface unplug detection method in any of the above method embodiments. For example, they execute the method steps described in the above method embodiments to realize the functions of the modules described in the above device embodiments.
[0082] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a power supply device 100, cause the power supply device 100 to perform the method described in the foregoing embodiments.
[0083] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0084] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A method for detecting interface unplugging, characterized in that, An application is made in power supply equipment, which supplies power to electrical devices. The power supply equipment includes an interface, a first constant current source, and a second constant current source. The interface is connected to the first constant current source and the second constant current source, respectively. The interface unplugging detection method includes: In response to a stop output signal, the first constant current source is controlled to turn off and the second constant current source is controlled to turn on, wherein the stop output signal is a signal for the power supply device to stop outputting power, the first constant current source is configured to supply power to the power-consuming device, the second constant current source is configured to detect the working status of the interface, and the current of the first constant current source is greater than the current of the second constant current source. In response to a device unplug signal, the duration of unplugging is determined, wherein the device unplug signal is the electrical device being unplugged from the interface of the power supply equipment, and the duration of unplugging is the duration when the communication terminal voltage of the interface is at a first level; If the duration of the unplugging exceeds the preset removal duration, device unplugging information is generated, which indicates that the electrical device has been unplugged from the interface of the power supply device.
2. The interface unplugging detection method according to claim 1, characterized in that, The power supply equipment further includes a window comparison module connected to the interface. After responding to the stop output signal, controlling the first constant current source to turn off and controlling the second constant current source to turn on, the interface unplug detection method further includes: In response to the disconnection signal of the electrical equipment, the communication terminal voltage of the interface is controlled to be greater than the upper limit voltage of the window comparison. The duration of disconnection is determined as the duration during which the voltage at the communication terminal is greater than a preset upper limit voltage for window comparison. The upper limit voltage for window comparison is the voltage threshold used by the window comparison module to determine that the communication terminal of the interface is at a high level. If the duration of the disconnection is less than the preset removal duration, then device not unplugged information is generated. The device not unplugged information is used to indicate the interface connection information between the electrical device and the power supply device.
3. The interface unplugging detection method according to claim 2, characterized in that, The preset removal duration is greater than the duration of the disconnect signal.
4. The interface unplugging detection method according to any one of claims 1-3, characterized in that, Prior to responding to the stop output signal, the method further includes: In response to the communication terminal voltage of the interface being greater than a preset lower window voltage and less than or equal to a preset upper window voltage, the first constant current source is controlled to turn on so that the first constant current source supplies power to the electrical device, while the second constant current source remains off.
5. The interface unplugging detection method according to claim 4, characterized in that, After the communication terminal voltage responding to the interface is greater than a preset lower window voltage and less than or equal to a preset upper window voltage, the method further includes: If the communication terminal voltage of the interface is between the lower limit voltage and the upper limit voltage of the window, a device connection signal is generated. The device connection signal indicates that the power supply device is connected to the power consumption device and the power supply device stops supplying power to the power consumption device.
6. The interface unplugging detection method according to claim 5, characterized in that, The window comparison module includes a first window comparator, and the generating device connection signal includes: The level detection duration is determined as the duration during which the first window comparator continuously detects the second level, wherein the first level and the second level are different levels; If the level detection duration is longer than the preset level period, a device connection signal is generated.
7. The interface unplugging detection method according to claim 5, characterized in that, Following the generation of the device connection signal, the following is also included: The access duration is determined as the duration during which the communication terminal voltage of the interface is greater than a preset lower window voltage and less than or equal to a preset upper window voltage. If the duration of the access is longer than the preset debouncing duration, the power supply device is controlled to supply power to the electrical device, wherein the preset debouncing duration is the duration for filtering jitter.
8. The interface unplugging detection method according to claim 4, characterized in that, The control of the power supply equipment to supply power to the electrical device includes: In response to the output state of the communication terminal switching from a first state to a second state, the interface is controlled to output power, wherein the first state is the state in which the communication terminal stops outputting power, and the second state is the state in which the communication terminal outputs power; Keep the first constant current source on and keep the second constant current source off.
9. A power supply device, characterized in that, The power supply device further includes a memory and a processor, the memory being connected to the processor, the processor being configured to execute one or more computer programs stored in the memory, the processor causing the power supply device to implement the interface unplug detection method as described in any one of claims 1-8 when executing the one or more computer programs.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the interface unplugging detection method as described in any one of claims 1-8.