Power supply control method and power supply device
By detecting the power supply role and timestamp difference at the power supply device port, the self-charging output is cut off, which solves the problem of power waste and overheating caused by misoperation of mobile power devices, and improves the reliability and safety of the device.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-03
- Publication Date
- 2026-03-13
AI Technical Summary
When using devices such as power banks with multiple input and output ports, users may accidentally cause the device to enter a "self-charging" state, continuously consuming power and potentially causing the device to overheat or shorten battery life.
By detecting the current power supply role of all ports of the power supply device, obtaining the timestamps of the power supply party and the power receiving party, calculating the time difference, and cutting off the power supply output when the time difference is less than a preset threshold, the self-charging phenomenon can be identified and prevented.
It improves the reliability of the power supply device, prevents equipment from overheating, extends battery life, and ensures the safety and stability of the equipment in complex and diverse usage scenarios.
Smart Images

Figure CN121663690A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power control technology, and in particular to a power supply control method and power supply device. Background Technology
[0002] When using devices such as power banks with multiple input / output ports, if a user connects two ports of the same power bank using a single charging cable, the device may mistakenly trigger its charging logic, causing it to enter a "self-charging" state. This abnormal state will continuously consume the energy stored in the power bank through circuit switching, and prolonged cycles may lead to overheating or shortened battery life. Summary of the Invention
[0003] To address the existing technical problems, this application provides a power supply control method and power supply device that can improve reliability.
[0004] In a first aspect, embodiments of this application provide a power supply control method applied to a power supply device. The power supply control method includes: detecting the current power supply role of all ports of the power supply device; wherein the power supply role includes a power supply provider and a power receiving provider; in response to the simultaneous existence of at least one power supply provider and at least one power receiving provider among the current power supply roles of all ports, obtaining the timestamps corresponding to the power supply provider and the power receiving provider when determining their current power supply roles; calculating the time difference between the timestamp corresponding to the power supply provider and the timestamp corresponding to the power receiving provider; and in response to the time difference being less than a preset threshold, cutting off the power supply output of the port corresponding to the power supply provider.
[0005] In a second aspect, a power supply device is provided for performing the power supply control method as described in any embodiment of this application.
[0006] In the power supply control method provided in the above embodiments, the current power supply role of all ports of the power supply device is detected; when at least one power supply party and at least one power receiving party exist simultaneously, the timestamps corresponding to when the power supply party and the power receiving party determine their current power supply roles are obtained respectively; the time difference between the timestamps corresponding to the power supply party and the timestamps corresponding to the power receiving party is calculated; and in response to the time difference being less than a preset threshold, the power supply output of the port corresponding to the power supply party is cut off. Thus, when both a power supply party and a power receiving party are detected, it is possible that the same charging cable is connected between the two ports, forming a "self-charging" process of power transmission between these two ports. If the time difference between the timestamps corresponding to the power supply roles determined by these two ports is less than the preset threshold, it indicates that the two ports almost simultaneously complete the determination of their power supply roles, confirming that they are connected based on the same charging cable. Therefore, the power supply output of the power supply party can be cut off in a timely manner to improve the reliability of the power supply device.
[0007] The power supply device provided in the above embodiments belongs to the same concept as the corresponding power supply control method embodiments, and thus has the same technical effect as the corresponding power supply control method embodiments, which will not be repeated here. Attached Figure Description
[0008] Figure 1 This is a flowchart illustrating a power supply control method in one embodiment of this application;
[0009] Figure 2 This is a flowchart illustrating the power supply control method in another embodiment of this application; Figure 3 This is a flowchart illustrating the power supply control method in another embodiment of this application. Detailed Implementation
[0010] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0011] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0012] In the following description, the phrase "some embodiments" refers to a subset of all possible embodiments. It should be noted that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0013] In the following description, the terms "first," "second," and "third" are used merely to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first," "second," and "third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0014] like Figure 1 As shown, one embodiment of this application provides a power supply control method applied to a power supply device. The power supply control method may include: S10: Detect the current power supply role of all ports of the power supply device.
[0015] In this embodiment, the power supply device can be a device that connects to and supplies power to a load device, such as a power bank. All ports of the power supply device can include input ports and output ports, and the ports can be USB ports, Type-C ports, or other types of ports.
[0016] In one embodiment, the port can be used to connect a load device or to connect an external power source. The port can be used to output power signals, such as providing a power signal to a load device, or to input power signals, such as inputting a power signal from an external power source to charge the power supply device.
[0017] In one embodiment, the power supply role may include a source and a receiver, and may also include a dossun triggered role. The power supply role can be used to characterize the actions performed by the port after a connection is established. Establishing a connection may refer to establishing a connection with a load device or an external power source, such as establishing a connection via a charging cable.
[0018] For example, when the power supply role is that of the power provider, the port can be used to output power supply signals, such as supplying power to the connected load device through power output. When the power supply role is that of the power receiver, the port can be used to receive power signals, such as receiving power signals provided by a connected external power source.
[0019] In one embodiment, detecting the current power supply role of all ports of the power supply device may include: determining the power supply role corresponding to the port by querying the power supply role status variables corresponding to all ports of the power supply device.
[0020] Here, the power supply role status variable can be Current_Role, which can be used to record the current power supply role of the port. This status variable is updated every time the power supply role of the port is switched or updated.
[0021] S20: In response to the simultaneous existence of at least one power supply party and at least one power receiving party in the current power supply roles of all ports, obtain the timestamps corresponding to when the power supply party and the power receiving party determine the current power supply role.
[0022] In one embodiment, the simultaneous existence of at least one power supply party and at least one power receiving party can mean that at least one port is currently a power supply party and at least one port is currently a power receiving party.
[0023] In one embodiment, the timestamp corresponding to the determination of the current power supply role can characterize the moment when power negotiation and the determination of the current power supply role are completed. Specifically, "determining the current power supply role" refers to the moment when both power negotiation and the determination of the current power supply role for the current connection state are completed.
[0024] Here, a timestamp is a digital identifier used to represent a point in time (i.e., a moment). For example, the timestamp can be determined by querying the system timestamp status variable corresponding to the port. For a port represented as [Port_X], the status variable can be in the form of, for example, "Role_Activation_Timestamp[Port_X] = Get_System_Tick()". The status variable is updated each time the power supply role is switched or updated.
[0025] Here, "obtaining the timestamps corresponding to when the power supply party and the power receiving party determine their current power supply roles" can refer to an exhaustive path based on global scanning. This involves determining all possible port pair combinations on the power supply device, and for any port combination where one is the power supply party and the other is the power receiving party, extracting the time information (i.e., timestamps) at which both parties establish their power supply roles. This global port scanning method provides comprehensive security protection, ensuring that even in complex power supply devices with multiple ports, where users continuously or alternately insert multiple cables within a very short time, all possible "power supply-power receiving" combinations can be exhausted to completely eliminate detection blind spots and accurately identify hidden self-charging loops. Furthermore, this method does not rely on the single action sequence of a specific port, effectively preventing anomaly misses caused by hardware interrupt responses, system task scheduling, or multi-port concurrent handshakes. Therefore, in various complex and diverse real-world usage scenarios, it ensures that the power supply device can promptly cut off abnormal outputs, significantly improving the overall reliability and security of the equipment.
[0026] Here, "obtaining the timestamps corresponding to when the power supply party and the power receiving party determine their current power supply roles" can also refer to the fact that this detection process is driven in real time by changes in port status, aiming to identify the pair of ports that have most recently completed role establishment and whose power supply roles are opposite to each other on the current timeline. Specifically, when the power supply device detects that a certain port (denoted as the latest port) has recently completed power negotiation and established its power supply role, the system immediately records and obtains the completion time of the latest port as the first moment, and simultaneously retrieves the establishment time of another port (denoted as the next newest port) that is closest to it in the time sequence and whose power supply role is opposite to that of the latest port as the second moment. In this way, by extracting only the two "latest" establishment times that are at the end of the time sequence and whose roles are complementary, the system can accurately reconstruct the real process of the handshake action triggered by the insertion of the same cable into two ports in a very short period of time, thereby eliminating interference from other irrelevant ports that are already in a stable connection state, and providing the most direct timing evidence for determining the self-charging loop.
[0027] S30: Calculate the time difference between the timestamp corresponding to the power supplier and the timestamp corresponding to the power receiver.
[0028] In one embodiment, the time difference between the timestamp corresponding to the power supplier and the timestamp corresponding to the power receiver can be calculated based on the difference between the timestamp corresponding to the power supplier and the timestamp corresponding to the power receiver.
[0029] In one embodiment, the time difference represents the interval between the time when the power supplier determines its current power supply role and the time when the power receiver determines its current power supply role.
[0030] In one embodiment, the larger the time difference, or the larger the absolute value of the time difference, the longer the interval between the power supplier determining the current power supply role and the power receiver determining the current power supply role.
[0031] S40: In response to the time difference being less than a preset threshold, cut off the power supply output of the corresponding port of the power supply provider.
[0032] In one embodiment, the time difference is less than a preset threshold, or the absolute value of the time difference is less than a preset threshold. The preset threshold can be a pre-set threshold used to determine the duration of self-charging or self-connection.
[0033] It is understandable that the "power supply corresponding port" refers specifically to the physical interface or port identified as the "power supply" in the detection process. When the time difference between the power supply port and the power receiving port establishing their roles is less than a preset threshold, it is determined that there is a risk of "self-charging" or "logic conflict". At this time, the "corresponding port" becomes the execution target, and the control chip instructs the switching transistor (MOSFET) on its power path to turn off, thereby precisely cutting off the port's ability to output current to the outside, in order to protect the circuit safety.
[0034] In one embodiment, the preset threshold is 80ms-120ms. For example, the preset threshold can be a fixed value such as 80ms, 100ms, or 120ms.
[0035] Understandably, when a user connects two ports of a power supply device using the same cable, the closing of the physical circuit causes both ports to sense a level change on the order of microseconds. Since the same chip and firmware logic handle the process, the time difference between these two ports completing power negotiation and establishing their power supply roles is very small, less than 80ms. Therefore, by setting a preset threshold greater than or equal to 80ms, abnormal behavior triggered by the same cable can be effectively identified.
[0036] Understandably, due to slight differences in sampling frequency, filtering circuits, and judgment thresholds in the hardware implementation of PD protocol chips from different manufacturers, and the varying internal logic round-trip time (RTT) of different devices during power negotiation, the handshake deviation between normal devices often exceeds 120ms. If the preset threshold is set to be greater than 120ms, normal cross-device connections are easily misjudged as "self-charging" anomalies, leading to incorrect power output cutoff. Therefore, by setting the preset threshold to be less than or equal to 120ms, sufficient scheduling and protocol processing margins can be reserved to avoid false alarms. Furthermore, because it is much smaller than the physical time required for manual operation of two ports, it ensures that even in the event of a misconnection of cables from the same source, a rapid response and anomaly can still be detected within the preset time, achieving an optimal balance between safety protection and operational reliability.
[0037] Alternatively, in other embodiments, the values selected may be based on the currently determined port types of the power supply and the power receiving party.
[0038] For example, when the port type corresponding to the power supply party is the same as the port type corresponding to the power receiving party, the preset threshold can be a first threshold; when the port type corresponding to the power supply party is different from the port type corresponding to the power receiving party, the preset threshold can be a second threshold. The first threshold can be less than the second threshold.
[0039] The corresponding port types can include USB, Type-C, etc. Thus, when port types differ, the handshake establishment delay between ports may be longer. In this case, the preset threshold can be increased to improve accuracy. In one embodiment, cutting off the power output of the corresponding port of the power supplier can refer to switching the corresponding port of the power supplier to a disabled or locked state. For example, the output of the corresponding port of the power supplier and the input of the corresponding port of the powered party can be cut off, such as switching the corresponding port of the power supplier and the corresponding port of the powered party to a disabled or locked state.
[0040] Understandably, the "power receiving port" refers specifically to the physical interface or port identified as the "power receiving port" during the detection process. When the time difference between the power supply port and the power receiving port establishing their roles is less than a preset threshold, it is determined that there is a risk of "self-charging" or "logic conflict." At this time, the "corresponding port" becomes the execution target, and the control chip instructs the switching transistor (MOSFET) on its power path to turn off, thereby precisely cutting off the port's ability to output current to the outside, in order to protect the circuit safety.
[0041] During power supply control, the specific method of cutting off power output can be flexibly selected based on the safety requirements of the actual application scenario. On the one hand, power output can be precisely cut off only to specific port pairs currently identified as participating in the abnormal "self-charging" connection (i.e., the power supply port and the power receiving port that meet the timestamp difference condition). In this way, the invalid power circulation caused by the misconnection of the same cable can be blocked immediately, preventing the equipment from overheating and extending the battery life. At the same time, it can ensure that other ports not involved in the abnormal loop can still maintain normal power supply or power receiving status to the greatest extent, thereby ensuring the user experience and system operating efficiency in multi-port concurrent working scenarios.
[0042] On the other hand, in response to the power supply device being in a preset mode requiring safety protection, a more stringent global protection strategy can be implemented, namely, directly cutting off the power output of all ports on the device. This global disconnection method has higher safety redundancy, can achieve complete risk isolation, and can completely eliminate any potential impact that abnormal states may have on the internal circuits of the power supply device and other external devices, thereby significantly improving the overall safety and reliability of the device in complex or high-risk working environments.
[0043] In one embodiment, in the locked state, the lock state needs to be unlocked after detecting that all external connections to the ports have been disconnected. Unlocking the lock state means restoring normal operation.
[0044] In one embodiment, unlocking the state after detecting that all external connections to the ports are disconnected may further include: unlocking the state after detecting that all external connections to the ports are disconnected and a preset instruction operation is detected. The preset instruction operation may be a tap, long press, or multiple presses of a specified button, or a selection or click operation of a specified option on the display interface, etc.
[0045] Thus, when both a power supply and a power receiving party are detected simultaneously, there may be a "self-charging" process where the same charging cable is connected between the two ports to transmit power between them. If the time difference between the timestamps corresponding to the power supply roles of the two ports is less than a preset threshold, it indicates that the two ports have completed the determination of the power supply roles almost simultaneously. It can be determined that the two ports are connected to each other based on the same charging cable. Therefore, the power output of the power supply party can be cut off in time to improve the reliability of the power supply device.
[0046] In some embodiments, detecting the current power supply role of all ports of the power supply device includes: In response to a change in the connection status of at least one port, and / or a change in the power supply role of at least one port, the current power supply role of all ports of the power supply device is detected.
[0047] In one embodiment, a change in the connection state of at least one port may include switching the connection state of at least one port from a state without external connection to a state with external connection, or a change in the object of connection. In the state of external connection, the port may act as a power supplier providing output or as a power receiver providing input. A change in the object of connection may refer to a re-negotiation of power negotiation and a power delivery (PD) protocol handshake.
[0048] In one embodiment, the power supply role of at least one port changes, which may include at least one port changing its power supply role from power supply to power receiving, or from power receiving to power supply, or from no power supply role to power supply, or from no power supply role to power receiving, etc.
[0049] Thus, when the connection status of any port in the power supply device changes, and / or when the power supply role changes, the power supply role of the port is detected, so as to promptly detect the possibility of two ports interconnecting and forming self-charging, thereby improving the reliability of the power supply device.
[0050] In some embodiments, before detecting the current power supply role of all ports of the power supply device, the method may further include: In response to detecting a power negotiation on one of the ports and determining that the power supply role has been completed, the completion time is recorded as the timestamp corresponding to the port.
[0051] In one embodiment, "power negotiation and determination of the power supply role have been completed" can refer to the completion of power negotiation and PD protocol handshake. The corresponding completion time can refer to the moment when the power supply role is determined, such as the moment when the port starts working as a power supply or power receiver after its power supply role is determined to be either a power supplier or a power receiver.
[0052] In this embodiment, when two ports of the same power supply device are connected by a cable, the physical circuit is closed the instant the second plug contacts the port. For the power supply device's processor MCU, the two ports connected by the cable sense the level change of the CC pin and begin handshaking almost simultaneously on the order of microseconds. Because the same chip and the same firmware logic are being used, the time interval Δt between these two ports completing the handshake (i.e., determining the power supply role) is very small, much smaller than a preset threshold such as 100ms.
[0053] For different devices connected by a single cable, the protocol chips of the two devices are different. The internal logic processing speed of PD (Power Delivery) protocol chips from different manufacturers is different, from physical layer detection (CC pin level change) to protocol layer handshake (sending Source_Capabilities messages, etc.).
[0054] Furthermore, different devices operate with different logic. For example, some devices might attempt a 5V handshake first, while others might directly request high voltage. The round-trip time (RTT) differences between these logics often exceed a preset threshold, such as 100ms. For instance, the CC controller of mobile phone A and the CC controller of power supply device B are manufactured by different companies, and their voltage fluctuation filtering circuits, sampling frequencies, and judgment thresholds have slight differences. Even if they are physically inserted at the same time, the timing when the hardware layer determines that a "connection has been established" will still have some deviation.
[0055] Thus, based on the timestamps of completed power negotiation and role establishment, it is possible to accurately determine whether the two ports, as the power supply party and the power receiving party, established their power supply roles almost simultaneously. This allows us to determine whether the two ports are connected by a charging cable, improving the accuracy of the judgment.
[0056] In some embodiments, such as Figure 2 As shown, step S40 may include: S41: Determine the current operating mode of the power supply device; S42: In response to the current operating mode being a preset mode requiring safety protection, cut off the power supply output of all ports.
[0057] In one embodiment, the current operating mode may include a normal mode and a preset mode requiring security protection. The preset mode requires a higher level of security protection or a higher level of stringency than the normal mode.
[0058] In one embodiment, determining the current operating mode of the power supply device may include: determining the current operating mode of the power supply device based on the number and / or type of ports currently in an external connection state.
[0059] For example, if the number of ports in external connection state is greater than a preset number, the current working mode is determined to be a preset mode that requires security protection. The preset number can be 1, 2 or other positive integers.
[0060] For example, when the port type in the external connection state is a preset type, the current working mode is determined to be a preset mode requiring security protection. The preset type can be Type-C, USB, or other types.
[0061] For example, if the number of ports in external connection state is greater than a preset number and all ports in external connection state are of a preset type, the current working mode is determined to be a preset mode requiring safety protection. Thus, by setting the trigger condition for the "preset mode requiring safety protection" to be that the number of external connection ports is greater than a preset value and all ports are of a preset type, more precise and intelligent risk control can be provided for the power supply device. The technical advantage of this dual-discrimination logic lies in its extremely high discrimination confidence: in complex scenarios with multiple concurrent ports (such as multiple Type-C interfaces occupying simultaneously), the probability of self-charging loop formation increases significantly. By locking "multiple ports + specific types," global protection measures can be implemented more decisively. By limiting the trigger conditions, false triggering in low-risk scenarios such as single-port charging and discharging is effectively avoided, ensuring the continuity of normal use; secondly, when multiple cables are intertwined, by implementing the highest level of global power-off protection, power loss and heat accumulation can be reduced, thereby significantly extending battery life and ensuring hardware safety under extreme connection conditions.
[0062] In one embodiment, cutting off the power supply to all ports can mean switching the operating state of all ports to a disabled or locked state.
[0063] In one embodiment, in the locked state, the lock state needs to be unlocked after detecting that all external connections to the ports have been disconnected. Unlocking the lock state means restoring normal operation.
[0064] In one embodiment, unlocking the state after detecting that all external connections to the ports are disconnected may further include: unlocking the state after detecting that all external connections to the ports are disconnected and a preset instruction operation is detected. The preset instruction operation may be a tap, long press, or multiple presses of a specified button, or a selection or click operation of a specified option on the display interface, etc.
[0065] In this way, when a safety protection preset mode is required, the power output of all ports is cut off, thus achieving global protection and avoiding any impact on any other ports or their connected devices, resulting in higher security.
[0066] In some embodiments, such as Figure 3 As shown, after cutting off the power output to all ports, it may also include: S50: In response to detecting that at least one of the power supply port and the power receiving port is disconnected from the external connection, restore the working state of the port.
[0067] Here, restoring the working state of the port means releasing the port from its disabled or locked state. This can be done by restoring the working state of all ports, or by restoring the working state of at least one port whose power output has been cut off (i.e., entered a disabled or locked state).
[0068] In one embodiment, the disconnection of the power supply port from the external connection can mean that the power supply role of the power supply port is switched to none, or that the connection state of the power supply port is switched to a disconnected state. Similarly, the disconnection of the power receiving port from the external connection can mean that the power supply role of the power receiving port is switched to none, or that the connection state of the power receiving port is switched to a disconnected state.
[0069] In one embodiment, restoring the working state of a port in response to detecting that at least one of the corresponding ports of the power supply and the corresponding ports of the power receiver is disconnected from the external connection may include: restoring the working state of a port in response to detecting that all ports of the power supply device are disconnected from the external connection.
[0070] In one embodiment, restoring the working state of a port in response to detecting that all ports of the power supply device are disconnected from external connections may include: restoring the working state of the port in response to detecting that all ports of the power supply device are disconnected from external connections and detecting a preset instruction operation. The preset instruction operation may be a tap, long press, or multiple presses of a designated button, or a selection or click operation of a designated option on the display interface, etc.
[0071] Thus, when at least one of the corresponding ports of the power supply side and the corresponding ports of the power receiving side is disconnected from the external connection, the disconnection between the two ports that form the self-charging abnormal connection will not have a subsequent impact on the power supply device. At this time, the working state of the port can be restored and it can continue to be used to provide output to other devices.
[0072] In one embodiment, after cutting off the power supply output of all ports, the method further includes: restoring the working state of the ports in response to detecting a reset operation of a preset button.
[0073] Here, the reset operation can refer to the operation of restoring the preset button to its initial position. Alternatively, when the preset button is a reset button, the reset operation can refer to the operation of pressing the preset button (which may include short press, long press, short press a predetermined number of times, etc.).
[0074] In some embodiments, the step of cutting off the power output of the corresponding port of the power supplier in response to the time difference being less than a preset threshold may include: In response to the time difference being less than a preset threshold, the power supply output of the corresponding port of the power supply is cut off, and the light-emitting module is controlled to emit light based on at least one of the preset flashing frequency, flashing count, light emission color and number of light-emitting elements, and / or, a reminder message is displayed based on the display module.
[0075] In one embodiment, the preset flashing frequency can be the preset flashing frequency of one or more light-emitting elements. The flashing frequencies of different light-emitting elements can be the same or different. For example, multiple light-emitting elements can be arranged in a combination with all the same, some the same, or all different flashing frequencies to indicate different situations. In the above case, all multiple light-emitting elements can flash at the first flashing frequency.
[0076] In one embodiment, the preset number of flashes can be a preset number of flashes for one or more light-emitting elements. The different light-emitting elements can have the same number of flashes or different numbers of flashes. For example, multiple light-emitting elements can be arranged in a combination with all the same, some the same, or all different flashes to indicate different situations. In the above case, multiple light-emitting elements can all flash with the first count. For example, the first count can be 3 or 5 times.
[0077] In one embodiment, the preset emission color can be the preset emission color of one or more emission elements. The emission colors of different emission elements can be the same or different. For example, multiple emission elements can be arranged in combinations with all the same, some the same, or all different emission colors to indicate different situations. In the above case, multiple emission elements can all emit light with the first emission color.
[0078] In one embodiment, the light-emitting element may also flash with at least one of the preset light emission color, flashing frequency, and flashing number, such as flashing green light at a first flashing frequency for the first number of flashes. The flashing frequencies of different light-emitting elements may all be the same, some may be the same, or all may be different; the light emission colors of different light-emitting elements may all be the same, some may be the same, or all may be different; and the flashing numbers of different light-emitting elements may all be the same, some may be the same, or all may be different.
[0079] In one embodiment, the preset number of light-emitting elements can refer to a specified number of light-emitting elements in the light-emitting module that emit light or flash. In the above case, controlling the light-emitting module to emit light based on the preset number of light-emitting elements can refer to controlling a specified number of light-emitting elements in the light-emitting module to emit light or flash.
[0080] For example, the light-emitting module in the power supply device has a first number of light-emitting elements. Controlling the light-emitting module to emit light based on a preset number of light-emitting elements can be achieved by controlling a second number of light-emitting elements in the light-emitting module to emit light, wherein the second number can be less than or equal to the first number.
[0081] In one embodiment, controlling a specified number of light-emitting elements in the light-emitting module to emit light or flash may include: controlling the specified number of light-emitting elements in the light-emitting module to emit light or flash based on at least one of a preset flashing frequency, flashing count, and emission color. Wherein, when the specified number is greater than 1, the flashing frequencies of different light-emitting elements may all be the same, some may be the same, or all may be different; the emission colors of different light-emitting elements may all be the same, some may be the same, or all may be different; and the flashing counts of different light-emitting elements may all be the same, some may be the same, or all may be different.
[0082] In one embodiment, displaying the reminder information based on the display module can be done by displaying the reminder information on the display interface. The reminder information is used to notify the user of an abnormal connection where two ports are interconnected by a cable. The reminder information can be in text, icon, number, or letter format, etc.
[0083] In this way, by flashing lights or displaying outputs, a reminder is given to the user. While the power supply output of the port is cut off and a locked state is formed, the user is promptly reminded to disconnect the connection between the two ports that are generating self-charging power, so that the normal working state of the power supply device can be restored in a timely manner.
[0084] In some embodiments, the method further includes: In response to the fact that there is no simultaneous presence of at least one power supply party and at least one power receiving party in the current power supply roles of all ports, the power supply role and operating state of the port are maintained.
[0085] In one embodiment, the absence of at least one power supply party and at least one power receiving party in the current power supply roles of all ports may include the following situations: only a power supply party exists in the current power supply roles of all ports, or only a power receiving party exists in the current power supply roles of all ports, or neither a power supply party nor a power receiving party exists in the current power supply roles of all ports.
[0086] In one embodiment, maintaining the power supply role and operating state of the port may include: maintaining the output state of the port when it is a power source, and / or maintaining the input state of the port when it is a power receiver. Here, maintaining the operating state means not entering a disabled or locked state.
[0087] In some embodiments, the method further includes: In response to the time difference being greater than or equal to a preset threshold, the power supply role and working state of the port are maintained.
[0088] In one embodiment, in response to the time difference being greater than or equal to a preset threshold, the difference between the time difference and the preset threshold is determined; if the difference between the time difference and the preset threshold is greater than or equal to a preset threshold value, the power supply role and working state of the port are maintained; if the difference between the time difference and the preset threshold is less than the preset threshold value, the power supply role and working state of the port are maintained, and a prompt message is output.
[0089] Here, the prompt message can be used to remind the user to check and confirm whether an abnormal connection has occurred where the two ports of the power supply device are interconnected to form a self-charging connection. This can remind the user to check and confirm when the time difference is small compared with the preset threshold, and to investigate possible abnormal self-charging situations. This avoids the situation where the timestamp difference is large due to accidental factors, making it impossible to identify the abnormal situation. At the same time, the power supply output is not cut off to avoid affecting normal use.
[0090] In one embodiment, outputting prompt information may include controlling the light-emitting module to emit light based on at least one of a preset flashing frequency, flash count, light emission color, and number of light-emitting elements, and / or displaying the prompt information based on a display module.
[0091] The way of outputting prompt information can be the same as the way of outputting the aforementioned reminder information, or it can be different. For example, at least one of the following can be used to control the light-emitting module to emit light: different flashing frequencies, different flashing times, different light-emitting colors, and different numbers of light-emitting elements. Alternatively, different content can be displayed based on the display module.
[0092] In this way, if no abnormal self-charging connection is detected, the original power supply role and input / output status of each port are maintained, and normal operation is maintained.
[0093] As one possible implementation, this application provides a power supply control method that can solve the problem of self-charging of power supply devices such as mobile power banks, specifically including: 1. Set a preset threshold, also known as the self-connection timeout threshold (Self_Plug_Timeout, T_sp): This is a preset time constant, such as 100 milliseconds. This threshold is much smaller than the time interval between normal user operations on two ports, but larger than the inherent hardware and software processing latency of port negotiation and system response.
[0094] 2. System status tracking: The firmware needs to maintain the following state variables for each port on the power supply device (let's say Port_0, Port_1): Power supply role status variable Current_Role: Records the power supply role (SOURCE, SINK, or DISCONNECTED) that has been successfully negotiated for this port. System timestamp status variable Role_Activation_Timestamp: Records the system high-precision timer (Tick) value when the current power supply role of this port is successfully established.
[0095] 3. Core detection algorithm flow: This is an event-driven process that is triggered when the connection status or power supply role of any port changes.
[0096] Step A: Event Capture and Logging When the port controller (TCPM) notifies the firmware via interrupt or polling that a certain port (denoted as Port_X) has completed power negotiation and established a new power supply role (NEW_ROLE): Update the Current_Role of this port to NEW_ROLE.
[0097] The Get_System_Tick() function records the current system timestamp, which is represented as: Role_Activation_Timestamp[Port_X] = Get_System_Tick().
[0098] Step B: Abnormal Condition Judgment The algorithm then immediately checks the combination state of all port pairs on the power supply device. For any two distinct ports Port_i and Port_j, the following logical judgment is performed: Role condition: Check if exactly one port is SOURCE and the other port is SINK. That is, satisfy the following condition: (Role_i == SOURCE&&Role_j == SINK), Alternatively, (Role_i == SINK &&Role_j == SOURCE); Where Role_i is the power supply role of port Port_i, and Role_j is the power supply role of port Port_j.
[0099] Timing conditions: If the role conditions are met, calculate the time difference between the establishment of the two port power supply roles, that is, the absolute value of the difference between the corresponding timestamps of the two timestamps: Δt = |Timestamp_i - Timestamp_j|; Timestamp_i is the timestamp that establishes the power supply role for port Port_i, and Timestamp_j is the timestamp that establishes the power supply role for port Port_j.
[0100] Determine if the time difference Δt is less than the preset self-connection timeout threshold T_sp: Step C: Judgment and Protective Actions If both the "role condition" and the "timing condition" are met, an abnormal "self-charging" connection is determined to have occurred. In this case, protection actions are immediately executed, with the following priority: Force shut down the SOURCE port: Prioritizes identifying and forcibly shutting down the power output of the port currently in the SOURCE role (even if it enters a disabled or error recovery state).
[0101] Global protection: In more stringent implementations, such as the default security protection mode, the output function of all ports can be shut down simultaneously to ensure security.
[0102] User alerts: The system uses LED indicators to flash in a specific error pattern (e.g., flashing three times and then pausing, or looping) or displays reminder information such as error codes to inform the user of connection problems.
[0103] System Lock: Enters a protection lock state to prevent the port from automatically recovering. Typically, the user needs to disconnect all connecting cables for the system to automatically or via button reset to unlock and resume normal operation.
[0104] If the above conditions are not met, it is considered a normal user scenario, and the system maintains the current state of each port and continues to work.
[0105] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0106] This application also provides a power supply device that can be used to execute the power supply control method described in any one or more of the foregoing method embodiments, which will not be repeated here.
[0107] For example, a power supply device can be a device, equipment, or system with power supply function, such as a power bank, charger, power adapter, or a device, equipment, or system with multiple functions. For instance, a power supply device can also be a device that simultaneously has the functions of an adapter and a power bank, that is, a device that simultaneously has the functions of being powered by AC power and powered by a power bank battery.
[0108] In one embodiment, the power supply device may include a control module, such as an MCU, which can be used to execute the power supply control method described in any one or more of the foregoing method embodiments.
[0109] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are generated entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0110] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0111] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A power supply control method, applied to a power supply device, characterized in that, The power supply control method includes: Detect the current power supply role of all ports of the power supply device; wherein, the power supply role includes the power supplier and the power receiver; In response to the simultaneous existence of at least one power supply party and at least one power receiving party in the current power supply roles of all ports, the timestamps corresponding to when the power supply party and the power receiving party determined the current power supply role are obtained respectively; Calculate the time difference between the timestamp corresponding to the power supplier and the timestamp corresponding to the power receiver; In response to the time difference being less than a preset threshold, the power output of the corresponding port of the power supplier is cut off.
2. The power supply control method according to claim 1, characterized in that, The detection of the current power supply role of all ports of the power supply device includes: In response to a change in the connection status of at least one port, and / or a change in the power supply role of at least one port, the current power supply role of all ports of the power supply device is detected.
3. The power supply control method according to claim 1, characterized in that, Before detecting the current power supply role of all ports of the power supply device, the method further includes: In response to detecting a power negotiation on one of the ports and determining that the power supply role has been completed, the completion time is recorded as the timestamp corresponding to the port.
4. The power supply control method according to claim 1, characterized in that, The preset threshold is 80ms-120ms.
5. The power supply control method according to claim 1, characterized in that, The step of cutting off the power output at the corresponding port of the power supplier includes: Determine the current operating mode of the power supply device; In response to the current operating mode being a preset mode requiring safety protection, the power supply output to all ports is cut off.
6. The power supply control method according to claim 5, characterized in that, Determining the current operating mode of the power supply device includes: The current operating mode of the power supply device is determined based on the number and / or type of ports currently in external connection status; In response to the number of ports in external connection state being greater than a preset number, and / or in response to the port type in external connection state being a preset type, the current working mode is determined to be a preset mode requiring security protection.
7. The power supply control method according to claim 5, characterized in that, After cutting off power output to all ports, it also includes: In response to detecting that at least one of the power supply port and the power receiving port is disconnected from the external connection, the port's operating state is restored.
8. The power supply control method according to claim 5, characterized in that, After cutting off power output to all ports, it also includes: In response to the detection of a reset operation by a preset button, the port's working state is restored.
9. The power supply control method according to claim 1, characterized in that, The step of cutting off the power output of the corresponding port of the power supplier in response to the time difference being less than a preset threshold includes: In response to the time difference being less than a preset threshold, the power supply output of the corresponding port of the power supply is cut off, and the light-emitting module is controlled to emit light based on at least one of the preset flashing frequency, flashing count, light emission color and number of light-emitting elements, and / or, a reminder message is displayed based on the display module.
10. The power supply control method according to claim 1, characterized in that, The method further includes: In response to the fact that there is no simultaneous presence of at least one power supply party and at least one power receiving party in the current power supply roles of all ports, the power supply role and operating state of the port are maintained.
11. The power supply control method according to claim 1, characterized in that, The method further includes: In response to the time difference being greater than or equal to a preset threshold, the power supply role and working state of the port are maintained.
12. A power supply device, characterized in that, Used to perform the power supply control method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Charging and discharging management method and electronic equipment
CN115333193A
Fault determination method and device of power supply system, electronic equipment and power supply system
CN120824905A
Photographing method and electronic device
US20240406556A1