Charging control method, device, electronic device and readable storage medium
By improving the charging control logic of electronic devices, detecting the number of times the power adapter is actively disconnected and determining the charging current, the problem of repeated power outages during fast charging is solved, improving charging efficiency and avoiding quality problems.
Patent Information
- Application Number
- CN202110507824.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-10
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-05-10
AI Technical Summary
During fast charging, when electronic devices use power adapters with unreasonable ground impedance, repeated power outages are prone to occur, resulting in interruption of charging or even inability to charge.
By improving the charging control logic of the electronic device, the number of times the power adapter is actively disconnected, and the charging current is determined based on the number of times, and a charging request is sent to the power adapter to charge with the provided charging current.
It effectively avoids the problem of repeated power outage of the power adapter, improves charging efficiency, and avoids quality problems caused by charging interruptions.
Smart Images

Figure CN115333174B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of charging technology, and in particular to a charging control method, device, electronic device and readable storage medium. Background Art
[0002] With the rapid development of technology, users' requirements for the charging efficiency of electronic devices are gradually increasing, and a large number of fast charging technologies have emerged in the industry.
[0003] Electronic devices contain application processors (AP) and advanced digital signal processors (ADSP). With the development of technology, the charging control logic has moved from the AP side to the ADSP side, that is, both normal charging and fast charging are controlled by the ADSP. During fast charging, the charging interface of the electronic device is connected to the power adapter, such as the Type-C interface.
[0004] However, during the fast charging process, when the grounding impedance of the power adapter is unreasonable, electronic devices are prone to repeated power outages when using the power adapter for fast charging, causing the electronic devices to charge intermittently or even fail to charge. Summary of the invention
[0005] The embodiments of the present application disclose a charging control method, device, electronic device and readable storage medium, which improve the software of the electronic device to avoid the problem of repeated power outages during the charging process.
[0006] In a first aspect, an embodiment of the present application provides a charging control method, which is applied to an electronic device, comprising: after being connected to a power adapter, determining the number of times the power adapter is actively disconnected;
[0007] Determining the charging current according to the number of times the power adapter is actively disconnected;
[0008] Sending a charging request carrying the charging current to the power adapter;
[0009] The battery is charged using the charging current provided by the power adapter.
[0010] In a second aspect, an embodiment of the present application provides a charging control device, including:
[0011] A processing module, used to determine the number of times the power adapter is actively disconnected after being connected to the power adapter;
[0012] A determination module, used to determine the charging current according to the number of times the power adapter is actively disconnected;
[0013] A transceiver module, used for sending a charging request carrying the charging current to the power adapter;
[0014] A charging module is used for charging using the charging current provided by the power adapter.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method described in the first aspect or various feasible implementation methods of the first aspect.
[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method described in the first aspect or various feasible implementation methods of the first aspect.
[0017] In a fifth aspect, an embodiment of the present application provides a computer program product comprising a computing program, and when the computer program is executed by a processor, the method described in the first aspect or various feasible implementation methods of the first aspect is implemented.
[0018] The embodiments of the present application provide a charging control method, device, electronic device, and readable storage medium. When an electronic device is connected to a power adapter with a large ground impedance and easy to be repeatedly disconnected, the electronic device determines the number of times the power adapter has been actively disconnected since the electronic device was connected to the power adapter, and determines the charging current based on the number of active disconnections. Afterwards, the electronic device sends the charging current to the power adapter, so that the power adapter provides the charging current to the electronic device, and the electronic device uses the charging current to charge the battery of the electronic device. With this solution, when the ground impedance of the power adapter is relatively large, the charging control logic of the electronic device is improved, thereby avoiding the problem of repeated power outages of the power adapter during charging, improving the charging efficiency, and avoiding quality problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 It is a schematic diagram of the implementation environment of the charging control method provided in the embodiment of the present application;
[0021] Figure 2 is a flow chart of a charging control method provided in an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0023] Figure 4 is another flow chart of the charging control method provided in an embodiment of the present application;
[0024] Figure 5 A schematic diagram of the structure of a charging control device provided in an embodiment of the present application;
[0025] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] With the rapid development of charging technology, a large number of fast charging technologies have emerged, such as Power Delivery (PD), Quick Charge (QC), VOOC, SuperVOOC (SVOOC), etc. Among them, the charging voltage of VOOC3.0 is 5V and the charging current is 6A, recorded as 5V / 6A, and SuperVOOC2.0 includes 65W, 50W, etc. In addition, fast charging technology also includes 125W programmable power supply (PPS), etc.
[0028] For VOOC and SVOOC, initially, an external fast-charging chip, referred to as the fast-charging microcontroller unit (MCU), was arranged on the printed circuit board (PCB) of the electronic device. The fast-charging MCU was used to control the logic implementation of fast charging. Initially, the fast-charging MCU was located at the core (kernel) end, that is, the application processor (AP) end. Later, for the purpose of cost saving, the charging logic was moved from the AP end to the advanced digital signal processor (ADSP) end, and the underlying hardware control logic of the fast-charging MCU was integrated into the power management integrated circuit (PMIC), thereby saving a fast-charging MCU.
[0029] At present, when electronic devices leave the factory, the standard configuration includes a power adapter and a Universal Serial Bus (USB). When the grounding impedance of the power adapter is unreasonable, for example, the estimated grounding impedance is 90 milliohms (mΩ), but in fact the grounding impedance of the power adapter may be 180mΩ, that is, the grounding impedance of the power adapter is relatively large. When the grounding impedance is relatively large, the differential signal of the power adapter is abnormal, and the differential signal is the signal transmitted on the D+ pin and D- pin of the power adapter. After the abnormality occurs, assuming that the low-level threshold set by the power adapter is 1.1V, but in fact when the low level reaches 0.7V, the power adapter is incorrectly received, that is, the 0 sent by the mobile phone is read as 1, resulting in a frame header error, which in turn causes abnormal fast charging communication.
[0030] Based on the above, it can be seen that during the fast charging process, when the grounding impedance of the power adapter is unreasonable, the electronic device is prone to repeated power outages when using the power adapter for fast charging, resulting in intermittent charging of the electronic device or even failure to charge.
[0031] Based on this, the embodiments of the present application provide a charging control method, device, electronic device and readable storage medium, which improve the software of the electronic device to avoid the problem of repeated power outages during the charging process.
[0032] Figure 1 This is a schematic diagram of the implementation environment of the charging control method provided in the embodiment of the present application. Figure 1 The implementation environment includes an electronic device 101 and a power adapter 102. The electronic device 101 and the power adapter 102 can be connected through a charging interface of the electronic device 101, and the power adapter 102 is connected to an external power source.
[0033] In the embodiment of the present application, the electronic device 101 includes a battery, and the electronic device 101 is any device that needs to charge the battery. For example, the electronic device 101 can be a smart phone, a tablet computer, an e-reader, a smart speaker, etc. The embodiment of the present application does not limit the specific type of the electronic device 101.
[0034] The power adapter 102 supports charging protocols of fast charging technologies such as VOOC, SVOOC, and PD. The embodiment of the present application does not limit the fast charging protocols supported by the power adapter 102.
[0035] Figure 2 is a flow chart of the charging control method provided in the embodiment of the present application. The charging control method can be applied to Figure 1 The electronic device in the implementation environment shown. This embodiment includes the following steps:
[0036] 201. After being connected to a power adapter, determine the number of times the power adapter actively disconnects.
[0037] In an embodiment of the present application, the active disconnection of the power adapter means that: the power adapter and the charging interface of the electronic device are connected via a USB cable, and the power adapter is connected to an external power source, such as being plugged into a socket or a laptop computer, but the power adapter no longer provides charging current, resulting in intermittent charging of the electronic device.
[0038] The opposite of active disconnection is passive disconnection, that is, the user unplugs the USB cable from the charging port of the electronic device, or disconnects the power adapter from the external power supply.
[0039] When the ground impedance of the power adapter is relatively large, after the electronic device is connected to the power adapter, if the differential pins of the power adapter, that is, the level recognition of the D+ pin and the D- pin is correct, the power adapter will not actively disconnect. If the level recognition of the D+ pin or the D- pin of the power adapter is wrong, the power adapter will actively disconnect, reconnect after active disconnection, and disconnect again after reconnection... In order to solve this problem, the user needs to unplug the power adapter, that is, the power adapter is passively disconnected. After passive disconnection, the power adapter is stationary for a period of time and then connected to the electronic device, and then it is possible that the phenomenon of active disconnection will not occur. From the user's point of view, a problematic power adapter, that is, a power adapter with a relatively large ground impedance and an electronic device are connected, and the electronic device cannot be charged. As long as the power adapter is passively disconnected and the electronic device is connected again after three to five minutes, it is possible to solve the problem of repeated active disconnection of the power adapter.
[0040] In an embodiment of the present application, the charging control logic of the electronic device is improved, and the charging current is controlled according to the number of times the power adapter is actively disconnected, so as to avoid constantly plugging and unplugging the power adapter.
[0041] In this step, after the electronic device is connected to the power adapter, that is, the electronic device and the power adapter are connected through the charging interface of the electronic device, the power adapter 102 is connected to the external power supply. The electronic device detects the number of times the power adapter is actively disconnected, and each time an active disconnection is detected, the number of active disconnections is accumulated. In other words, each time the electronic device detects that the power adapter is actively disconnected, the number of active disconnections is increased by 1.
[0042] 202. Determine a charging current according to the number of times the power adapter is actively disconnected.
[0043] Exemplarily, the electronic device compares the number of active disconnections with the preset number of times, and when the number of active disconnections is greater than or equal to the preset number of times, determines that the charging current is the preset current, which is, for example, 4A. When the number of active disconnections is less than the preset number of times, the charging current is calculated based on some parameters of the battery of the electronic device, such as battery temperature, power, etc., and the calculated charging current is, for example, 6A.
[0044] 203. Send a charging request carrying the charging current to the power adapter.
[0045] Exemplarily, after determining the charging current, the electronic device sends a current request carrying the charging current to the power adapter to request the power adapter to provide the charging current to the electronic device.
[0046] 204. Rapidly charge using the charging current provided by the power adapter.
[0047] Exemplarily, after receiving the charging request, the power adapter determines the magnitude of the charging current, and then provides the charging current to the electronic device, so that the electronic device charges the battery according to the charging current provided by the power adapter.
[0048] The charging control method provided in the embodiment of the present application is that when an electronic device is connected to a power adapter with a large ground impedance and is prone to repeated active disconnection, the electronic device determines the number of times the power adapter has been actively disconnected since the electronic device was connected to the power adapter, and determines the charging current based on the number of active disconnections. Afterwards, the electronic device sends the charging current to the power adapter, so that the power adapter provides the charging current to the electronic device, and the electronic device uses the charging current to charge the battery of the electronic device. With this solution, when the ground impedance of the power adapter is relatively large, the charging control logic of the electronic device is improved, thereby avoiding the problem of repeated power outages of the power adapter during charging, improving the charging efficiency, and avoiding quality problems.
[0049] In the above embodiment, the electronic device includes a power management integrated circuit (PMIC) and an advanced digital signal processor (ADSP), the PMIC is connected to the charging interface of the electronic device, and the charging interface is connected to the power adapter. In the embodiment of the present application, when the electronic device determines the charging current based on the number of times the power adapter is actively disconnected, when an automatic energy-saving transmission APSD interruption occurs between the electronic device and the power adapter, and the port corresponding to the APSD interruption is a dedicated charging port DCP, it is determined whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number. Afterwards, when the number of times the power adapter is actively disconnected is greater than or equal to the preset number, it is determined that the charging current is the preset current.
[0050] Exemplarily, when the power adapter is connected to the electronic device, a PMIC plug-in interrupt will be generated, and when the power adapter is actively disconnected, a PMIC plug-out interrupt will be generated. A few hundred milliseconds (ms) after the PMIC plug-in interrupt is generated, the electronic device identifies the Automatic Power Save Delivery (APSD) interrupt of the charger type based on the BC1.2 fast charging protocol. When the port corresponding to the APSD interrupt is not a standard downstream port (SDP) or a charging downstream port (CDP), but a dedicated charging port (DCP), the electronic device determines the charging current based on the number of times the power adapter is actively disconnected. The reason for identifying the APSD interrupt and determining that the port is a DCP port is because the fast charging protocol is a secondary identification protocol, that is, the electronic device first identifies that the power adapter is connected to an external power supply, and the corresponding port is DCP when the APSD interrupt is sent.
[0051] In the process of determining the charging current, the electronic device determines whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number of times. When the number of times the power adapter is actively disconnected is greater than or equal to a preset number of times, the charging current is determined to be a preset current, which is, for example, 4A. The preset number of times is, for example, 3 times, etc., which is not limited in the embodiment of the present application.
[0052] When the number of times the power adapter is actively disconnected is greater than or equal to the preset number, after the electronic device determines that the charging current is the preset current, the electronic device resets the number of times the power adapter is actively disconnected to zero to prevent affecting the subsequent setting of the charging current.
[0053] With this solution, when the electronic device determines that the power adapter is connected to an external power source, the charging current is determined based on the number of times the power adapter is actively disconnected, thereby improving the accuracy of the charging current.
[0054] Optionally, in the above embodiment, when the number of times the power adapter is actively disconnected is less than a preset number, the charging current is determined according to the battery temperature and / or battery power of the battery of the electronic device.
[0055] Exemplarily, when the number of times the power adapter is actively disconnected is less than a preset number, the electronic device calculates the charging current in real time based on the battery temperature, the temperature of the electronic device charging interface, and the charge level of the electronic device battery, and the charging current is usually greater than the preset current.
[0056] With this solution, when the power adapter is actively disconnected less frequently, the electronic device determines the charging current in real time based on parameters such as battery temperature and battery power, thereby improving the accuracy of the charging current and the charging efficiency.
[0057] In the above embodiment, before determining the charging current based on the number of times the power adapter is actively disconnected, after being connected to the power adapter, when the power adapter is actively disconnected, the disconnection time point of the power adapter is obtained; when the power adapter is disconnected and reconnected to the electronic device, the reconnection time point of the power adapter is obtained. When the duration between the reconnection time point and the disconnection time point is less than the preset duration, the number of times the power adapter is actively disconnected is accumulated; when the duration between the reconnection time point and the disconnection time point is greater than or equal to the preset duration, the number of times the power adapter is actively disconnected is cleared.
[0058] For example, when the ground impedance of the power adapter is relatively large, after the power adapter is connected to the electronic device and the electronic device is plugged into an external power source, the electronic device determines whether the current disconnection is an active disconnection by determining the time between the disconnection time point when the power adapter is actively disconnected and the time point when the power adapter is reconnected for the first time after the disconnection. If the current disconnection is an active disconnection, the number of active disconnections is increased by 1, that is, the number of active disconnections is accumulated.
[0059] During the judgment process, the electronic device judges that the time between the reconnection time point and the disconnection time point is less than the preset time, which is, for example, 1 second. If the time between the reconnection time point and the disconnection time point is less than the preset time, it means that the power adapter is actively disconnected, and at this time, the electronic device accumulates the number of times the power adapter is actively disconnected.
[0060] When the time between the reconnection time point and the disconnection time point is greater than or equal to the preset time, it indicates that the user has most likely manually unplugged the power adapter. At this time, the electronic device resets the number of times the power adapter is actively disconnected.
[0061] By adopting this solution, the electronic device can accurately determine the charging current by continuously updating the number of times the power adapter is actively disconnected.
[0062] In the above embodiment, not all power adapters have problems, that is, not all power adapters have relatively large ground impedance, which is prone to cause repeated power outages. In order to avoid affecting power adapters without problems, when the time between the reconnection time point and the disconnection time point is less than the preset time, before the electronic device accumulates the number of times the power adapter actively disconnects, the electronic device also determines that the first charging protocol is the target charging protocol, and the first type code is the target type code, the first charging protocol is the charging protocol obtained by the electronic device when the power adapter is most recently connected to the electronic device before the power adapter is actively disconnected, and the first type code is the type code obtained by the electronic device when the power adapter is most recently connected to the electronic device before the power adapter is actively disconnected.
[0063] Exemplarily, assuming that the power adapter with a larger ground impedance is a Type-C interface and a 65W fast charging adapter, then, when the electronic device is connected to this type of power adapter, the scheme of determining the charging current according to the number of active disconnections in this application is started. Each power adapter with a Type-C interface has its own type code. For example, the type code of a 65W power adapter is 0X14, and the type code of a 50W power adapter is 0X12. Each time the electronic device reconnects, it obtains the first charging protocol and the first type code of the power adapter. When the power adapter actively disconnects, the electronic device determines whether the first charging protocol obtained during the most recent reconnection is the target protocol. If the first charging protocol is the target protocol, the variable pre_pd_svooc is set to true (true). If the first type code is 0x14, the variable pre_fast_chg_type=0X14 is set.
[0064] After reconnecting again, the electronic device determines whether pre_pd_svooc is true, whether pre_fast_chg_type is equal to 0X14, and whether the duration between the reconnection time point and the disconnection time point is less than the preset duration. If all three are true, the electronic device accumulates the number of times the power adapter is actively disconnected, that is, the number of active disconnections is increased by 1. If pre_pd_svooc is not true, pre_fast_chg_type is not 0X14, or the duration between the reconnection time point and the disconnection time point is greater than or equal to the preset duration, that is, if any one of the three conditions is not true, the electronic device clears the number of times the power adapter is actively disconnected.
[0065] Based on the above, it can be known that only when the electronic device is connected to a power adapter with a Type-C interface and a charging power of 65W, the method of determining the charging current based on the number of times the power adapter is actively disconnected as described in the embodiment of the present application is started to avoid affecting power adapters other than the Type-C interface and other than 65W.
[0066] With this solution, only when the electronic device is connected to a power adapter with a large ground impedance, the electronic device determines the charging current according to the number of times the power adapter is actively disconnected, thereby preventing other power adapters from being affected.
[0067] In the above embodiment, when the power adapter is actively disconnected, after obtaining the disconnection time point of the power adapter, the electronic device also saves the first charging protocol and the first type code. When the power adapter and the electronic device are reconnected, the second charging protocol and the second type code are obtained; the first charging protocol is updated to the second charging protocol, and the first type code is updated to the second type code.
[0068] Taking three disconnections and reconnections as an example, after the electronic device is connected to the power adapter for the first time, when the charging current rises to 6A, the power adapter actively disconnects. Before actively disconnecting, the electronic device obtains the first charging protocol of the power adapter as PD and SVOOC, and the first type code is 0X14. The first charging protocol and the first type code indicate that the power adapter supports PD and SVOOC, is a power adapter with a Type-C interface, and is a 65W fast charging adapter. Therefore, the electronic device sets four variables, namely pd_svooc and fast_chg_type, pre_pd_svooc and pre_fast_chg_type. When the first charging protocol is PD and SVOOC, pd_svooc = true, otherwise, pd_svooc = false. fast_chg_type = 0X14.
[0069] After the first active disconnection, the electronic device sets pre_pd_svooc = pd_svooc, pre_fast_chg_type = fast_chg_type, and clears pd_svooc and fast_chg_type.
[0070] When the electronic device and the power adapter are reconnected for the first time, the electronic device records the time of the first active disconnection and the time of the reconnection. After reconnection, the electronic device determines three conditions: pre_pd_svooc=true, pre_fast_chg_type=0X14, reconnection time-1000ms>disconnection time. If all three conditions are met, the electronic device will add 1 to the number of times the power adapter is actively disconnected. If any of the three conditions is not met, the electronic device will reset the number of times the power adapter is actively disconnected.
[0071] After the first reconnection, the electronic device and the power adapter start communicating, and the electronic device obtains the second charging protocol and the second type code. If the second charging protocol is PD and SVOOC, pd_svooc = true, if the second charging protocol is not PD and SVOOC, pd_svooc = false. If the second type code is 0X14, fast_chg_type = 0X14, otherwise, fast_chg_type ≠ 0X14. After obtaining the second charging protocol and the second type code, update pre_pd_svooc and pre_fast_chg_type. That is, pre_pd_svooc = pd_svooc, pre_fast_chg_type = fast_chg_type.
[0072] After reconnection, if the charging current rises to 6A, the power adapter actively disconnects for the second time, and reconnects for the second time after disconnection. After the second reconnection, the electronic device records the time point of the second active disconnection and the time point of the second reconnection. Afterwards, the electronic device determines whether the following three conditions are met: pre_pd_svooc=true, pre_fast_chg_type=0X14, reconnection time point-1000ms>disconnection time point. If these three conditions are met, the number of times the power adapter actively disconnects will continue to be increased by 1. If one or more of the three conditions are not met, the number of times the power adapter actively disconnects will be cleared.
[0073] After the second reconnection, the electronic device communicates with the power adapter to continue to obtain the type code and charging protocol, and updates pre_pd_svooc and pre_fast_chg_type. That is, before clearing pd_svooc and fast_chg_type each time, it is necessary to update pre_pd_svooc according to pd_svooc, and update pre_fast_chg_type according to fast_chg_type.
[0074] By adopting this solution, the charging current can be accurately determined by continuously updating the number of times the power adapter is actively disconnected.
[0075] In the above embodiment, if the power adapter is unplugged by the user, it takes 1 second to 2 seconds, and the power adapter actively disconnects and reconnects, and the time required is approximately 700ms-800ms. Therefore, in the embodiment of the present application, the preset time is set to 1 second. When the time between the reconnection time point and the disconnection time point is less than 1 second, it is considered that the power adapter is actively disconnected. However, there is another situation where the user quickly plugs in and out the power adapter. In this case, the user quickly unplugs the power adapter and immediately plugs it in. This plug-in method is called pressure plug-in. In the pressure plug-in scenario, the time between the connection and unplugging of the power adapter is approximately 500ms. If the preset time is set to 1 second, when the user pressure plugs the power adapter, it is easy to misjudge the pressure plug-in as the active disconnection of the power adapter. In order to avoid this situation, the electronic device introduces an insertion detection mechanism.
[0076] Under the insertion detection mechanism, the electronic device determines the charging current based on the number of times the power adapter is actively disconnected. When the power adapter is disconnected from the electronic device, the electronic device determines whether the level of the hardware comparator changes, and the hardware comparator is connected to the ground pin of the power adapter. When the level of the hardware comparator does not change, it is determined that the power adapter is actively disconnected. When the level of the hardware comparator changes, it is determined that the power adapter is unplugged by the user, that is, the power adapter is quickly plugged and unplugged by the user, that is, pressure plugging occurs.
[0077] Exemplarily, after the power adapter is connected to the electronic device, a ground (GND) pin of the power adapter is connected to a hardware comparator, which is connected to the AP of the electronic device. When the power adapter is connected to the electronic device via a USB cable, if the power adapter is actively disconnected, the level on the hardware comparator will not change. Once the USB cable is inserted or unplugged, that is, the power adapter is unplugged by the user, the level on the hardware comparator changes, triggering the bound software interrupt. The level of the general-purpose input / output (GPIO) is read in the software interrupt. If the level is equal to 1, it indicates that the USB cable hardware has been unplugged.
[0078] This solution can prevent the electronic device from misjudging the user's quick plugging and unplugging of the power adapter as the power adapter being actively disconnected, thereby reducing misjudgments.
[0079] Optionally, in the above embodiment, if the electronic device recognizes that the power adapter is unplugged by the user, the AP of the electronic device clears the number of times the power adapter is actively disconnected via the glink bus to indicate that the power adapter is unplugged by the user.
[0080] With this solution, when the electronic device is unplugged by the user, the electronic device promptly resets the number of times the power adapter is actively disconnected, thereby achieving the purpose of accurately determining the charging current.
[0081] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Figure 3 The electronic device provided in this embodiment includes an application processor (AP), an advanced digital signal processor (ADSP), a power management integrated circuit (PMIC) module, a USB module, a fuel gauge, a charge pump, and an external charging IC. The external charging IC communicates with the AP via I2C, and the charge pump and the AP also communicate via I2C.
[0082] The fuel gauge communicates with ADSP via I2C to detect the status data of the battery of the electronic device. The battery status data includes battery temperature, battery power, battery voltage, and battery charging current.
[0083] The PMIC module is connected to the ADSP through the System Power Management Interface (SPMI) bus. The PMIC module is provided with a fast charging unit, such as a VOOCPHY unit. The VOOCPHY unit is connected to a power adapter, which is used to connect an external power supply. The USB module and the ADSP are also connected through the SPMI bus.
[0084] The VOOCPHY unit is responsible for interacting with the power adapter and storing the data frames sent by the power adapter. When the power adapter is connected to the electronic device and generates a plug interrupt of the PMIC, or the power adapter is actively disconnected and generates a plugout interrupt of the PMIC, the VOOCPHY notifies the ADSP of the plug interrupt or plugout interrupt. After the ADDSP processes the data, it sends it to the VOOCPHY unit through the SPMI bus, and the VOOCPHY unit sends it to the power adapter.
[0085] The interaction between ADSP and AP is completed through the Glink bus. During the fast charging process, ADSP transmits the fast charging status to AP, and AP displays fast charging animation and monitors buried data according to the fast charging status.
[0086] Figure 4 is another flow chart of the charging control method provided in an embodiment of the present application. This embodiment includes:
[0087] 401. A power adapter is connected to the electronic device.
[0088] 402. The electronic device detects a plug-in interruption.
[0089] Exemplarily, when the power adapter is connected to the electronic device, a PMIC plug-in interruption is generated, and when the power adapter is actively disconnected, a PMIC plug-out interruption is generated.
[0090] 403. After the electronic device and the power adapter are connected for the first time, a first charging protocol and a first type code are obtained.
[0091] At this time, if the first charging protocol is PD and SVOOC, and the first type code is 0X14, pd_svooc=true, otherwise, pd_svooc=false. fast_chg_type=0X14.
[0092] 404. When the power adapter is actively disconnected, obtain a disconnection time point of the power adapter.
[0093] 405. Save the first charging protocol and the first type code.
[0094] During the saving process, the electronic device sets pre_pd_svooc=pd_svooc, pre_fast_chg_type=fast_chg_type, and clears pd_svooc and fast_chg_type.
[0095] In an embodiment of the present application, the power adapter with a larger ground impedance is, for example, an adapter with a type-C interface, and is a 65W fast charging adapter. In order to avoid affecting power adapters with non-Type-C interfaces and power adapters with Type-C interfaces but not 65W, it is necessary to detect whether the power adapter connected to the electronic device is a Type-C interface and whether it is a 65W power adapter. Since the power adapter with a Type-C interface supports the PD protocol and the SVOOC protocol, and the 65W power adapter has its own exclusive code, that is, the type code of the 65W power adapter is 0X14. Therefore, two parameters are set: pd_svooc and fast_chg_type.
[0096] In addition, the embodiment of the present application also sets pre_pd_svooc and pre_fast_chg_type. The reason for setting these two parameters is that after the power adapter is actively disconnected, the electronic device will clear pd_svooc and fast_chg_type. Before clearing, pd_svooc and fast_chg_type need to be recorded for use when reconnecting next time.
[0097] 406. The electronic device clears the first charging protocol and the first type code.
[0098] After clearing, the values of pd_svooc and fast_chg_type are both empty, pre_pd_svooc = pd_svooc, pre_fast_chg_type = fast_chg_type.
[0099] 407 , the electronic device and the power adapter are reconnected, and the electronic device obtains a reconnection time point, and then executes steps 408 and 411 .
[0100] 408. The electronic device determines whether the power adapter is a power adapter with a type-C interface, whether the type code of the power adapter is the target type code, and whether the duration between the reconnection time point and the disconnection time point is greater than 1 second. If all three conditions are met, step 409 is executed; if one or more of the three conditions are not met, step 410 is executed.
[0101] 409. The number of times the electronic device actively disconnects the power adapter is increased by 1.
[0102] 410. The number of times the electronic device actively disconnects the power adapter is reset to zero.
[0103] In this step, the purpose of clearing the number of times the power adapter is actively disconnected is to prevent affecting the subsequent setting of the charging current of the power adapter.
[0104] 411. Based on the BC1.2 fast charging protocol, an APSD interrupt of the charger type is identified, and the port corresponding to the APSD interrupt is neither SDP nor CDP.
[0105] 412. Initialize fast charging parameters of electronic devices.
[0106] 413. The electronic device determines whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number of times. If the number of times the power adapter is actively disconnected is greater than or equal to the preset number of times, execute step 414; if the number of times the power adapter is actively disconnected is less than the preset number of times, execute step 415.
[0107] The number of times the power adapter is actively disconnected is greater than or equal to the preset number. When the preset number is 3 times, it means that the power adapter has been actively disconnected 3 times. If a larger charging current is used to charge, the power adapter will be actively disconnected again. Therefore, the electronic device determines that the charging current is a preset current such as 4A.
[0108] 414 . Set the charging current to a preset current, and then execute step 410 .
[0109] 415. Determine the charging current according to the battery temperature and / or battery power of the battery of the electronic device.
[0110] After step 406, the electronic device also obtains the second charging protocol and the second type code. After obtaining the second charging protocol and the second type code, pd_svooc=false or pd_svooc=true is set according to whether the second charging protocol is the target charging protocol, and fast_chg_type is set according to the second type code. After that, pre_pd_svooc and pre_fast_chg_type are updated. That is, pre_pd_svooc=pd_svooc, pre_fast_chg_type=fast_chg_type. After the update, pd_svooc and fast_chg_type are cleared, that is, pd_svooc and fast_chg_type are set to empty.
[0111] After the electronic device and the power adapter are reconnected, if the charging current rises to 6A and the power adapter is actively disconnected, the process continues as in step 403 .
[0112] In the above embodiment, under normal circumstances, when the time between the reconnection time point and the disconnection time point is less than the preset time, it indicates that the power adapter is actively disconnected. However, if the user plugs and unplugs the power adapter at a very fast speed, that is, the pressure plug phenomenon occurs, the time between the reconnection time point and the disconnection time point is about 500ms. Therefore, in order to reduce misjudgment, the embodiment of the present application introduces an insertion detection mechanism. The insertion detection mechanism simply means that after the power adapter is connected to the electronic device, a ground pin of the power adapter is connected to the hardware comparator of the electronic device, and the hardware comparator is set at the AP end of the electronic device. When the power adapter is actively disconnected due to excessive ground impedance, the level of the hardware comparator will not change. When a pressure plug occurs or the user actively unplugs the power adapter, the level of the hardware comparator will change, and then an insertion detection interrupt will be generated. After the AP of the electronic device reads the change in the GPIO level, it indicates that the USB cable hardware is unplugged. At this time, the AP clears the number of times the ADSP-side power adapter is actively disconnected through the Glink bus.
[0113] In addition, in the solution described in the embodiment of the present application, when the preset number of times is 3 times, the user can perceive that the power adapter is actively disconnected three times, and it will no longer be actively disconnected after three consecutive active disconnections. If the user is not allowed to perceive that the power adapter is actively disconnected, the following two points are improved: First, when actively disconnected, the electronic device sets a flag mark, which indicates the presence of a power adapter. At the same time, the electronic device sets a 1-second timer, and after the timer expires, it determines whether the Vbus pin exists. If the VBUS pin does not exist, it means that the power adapter has been unplugged by the user. At this time, the electronic device clears the flag mark and reports it to the AP, and the AP clears the charging icon displayed on the user interface of the electronic device.
[0114] Second, the interrupt of insertion detection is 50ms later than the plugout interrupt. When the power adapter is unplugged by the user, that is, the USB cable is unplugged, the electronic device generates an unplug interrupt of insertion detection. At this time, the electronic device clears the flag and cancels the 1-second timer.
[0115] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0116] Figure 5 A schematic diagram of the structure of a charging control device provided in an embodiment of the present application. The charging control device 500 includes: a processing module 51 , a determination module 52 , a transceiver module 53 and a charging module 54 .
[0117] The processing module 51 is used to determine the number of times the power adapter is actively disconnected after being connected to the power adapter;
[0118] A determination module 52, configured to determine a charging current according to the number of times the power adapter is actively disconnected;
[0119] The transceiver module 53 is used to send a charging request carrying the charging current to the power adapter;
[0120] The charging module 54 is used for charging by using the charging current provided by the power adapter.
[0121] In a feasible implementation, the determination module 52 is used to determine whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number of times when an automatic energy-saving transmission APSD interruption occurs between the electronic device and the power adapter, and the port corresponding to the APSD interruption is a dedicated charging port DCP; when the number of times the power adapter is actively disconnected is greater than or equal to the preset number of times, determine that the charging current is the preset current.
[0122] In a feasible implementation, the processing module 51 is also used to obtain the disconnection time point of the power adapter when the power adapter actively disconnects after being connected to the power adapter, before the determination module 52 determines the charging current based on the number of times the power adapter actively disconnects; when the power adapter is reconnected to the electronic device after being disconnected, obtain the reconnection time point of the power adapter; when the time length between the reconnection time point and the disconnection time point is less than a preset time length, accumulate the number of times the power adapter actively disconnects; when the time length between the reconnection time point and the disconnection time point is greater than or equal to the preset time length, clear the number of times the power adapter actively disconnects.
[0123] In a feasible implementation, when the duration between the reconnection time point and the disconnection time point is less than the preset duration, the processing module 51 is also used to determine that the first charging protocol is the target charging protocol, and the first type code is the target type code before accumulating the number of times the power adapter actively disconnects. The first charging protocol is the charging protocol acquired by the electronic device when the power adapter was most recently connected to the electronic device before the power adapter actively disconnects. The first type code is the type code acquired by the electronic device when the power adapter was most recently connected to the electronic device before the power adapter actively disconnects.
[0124] In a feasible implementation, when the power adapter is actively disconnected, the processing module 51 obtains the disconnection time point of the power adapter and is also used to save the first charging protocol and the first type code; when the power adapter and the electronic device are reconnected, the second charging protocol and the second type code are obtained; the first charging protocol is updated to the second charging protocol, and the first type code is updated to the second type code.
[0125] In a feasible implementation, the processing module 51 is also used to determine whether the level of a hardware comparator changes when the power adapter is disconnected from the electronic device, before the determination module 52 determines the charging current based on the number of times the power adapter is actively disconnected, and the hardware comparator is connected to the ground pin of the power adapter; when the level of the hardware comparator does not change, it is determined that the power adapter is actively disconnected; when the level of the hardware comparator changes, it is determined that the power adapter is unplugged by the user.
[0126] In a feasible implementation, when the level of the hardware comparator changes, the processing module 51 determines that the power adapter is unplugged by the user and is further used to clear the number of times the power adapter is actively disconnected.
[0127] In a feasible implementation, the determination module 52 is further used to determine the charging current according to the battery temperature and / or battery power of the electronic device battery when the number of times the power adapter is actively disconnected is less than a preset number.
[0128] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown, the electronic device 600 includes:
[0129] Processor 61 and memory 62;
[0130] The memory 62 stores computer instructions;
[0131] The processor 61 executes the computer instructions stored in the memory 62 , so that the processor 61 performs the charging control method as described above.
[0132] The specific implementation process of the processor 61 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0133] Optionally, the electronic device 600 further includes a communication interface 63 , wherein the processor 61 , the memory 62 and the communication interface 63 may be connected via a bus 64 .
[0134] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the charging control method as described above.
[0135] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the charging control method as described above is implemented.
[0136] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0137] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A charging control method, It is characterized in that Applied to electronic equipment, the method comprises: After connecting to the power adapter, determining the number of times the power adapter actively disconnects; Determining the charging current according to the number of times the power adapter is actively disconnected; Sending a charging request carrying the charging current to the power adapter; Charging using the charging current provided by the power adapter; The step of determining the charging current according to the number of times the power adapter is actively disconnected includes: When an interruption occurs between the electronic device and the power adapter, and the port corresponding to the interruption is a dedicated charging port DCP, determining whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number; When the number of times the power adapter is actively disconnected is greater than or equal to a preset number, it is determined that the charging current is a preset current.
2. The method according to claim 1, It is characterized in that When an interruption occurs between the electronic device and the power adapter, and the port corresponding to the interruption is a dedicated charging port DCP, determining whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number includes: When an automatic power saving transmission APSD interruption occurs between the electronic device and the power adapter, and the port corresponding to the APSD interruption is a dedicated charging port DCP, it is determined whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number.
3. The method according to claim 1, It is characterized in that Before determining the charging current according to the number of times the power adapter is actively disconnected, the method further includes: After being connected to a power adapter, when the power adapter actively disconnects, obtaining a disconnection time point of the power adapter; When the power adapter is disconnected and then reconnected to the electronic device, obtaining a reconnection time point of the power adapter; When the time between the reconnection time point and the disconnection time point is less than a preset time, accumulating the number of times the power adapter actively disconnects; When the time length between the reconnection time point and the disconnection time point is greater than or equal to a preset time length, the number of times the power adapter is actively disconnected is reset to zero.
4. The method according to claim 3, It is characterized in that When the time between the reconnection time point and the disconnection time point is less than the preset time, before accumulating the number of times the power adapter actively disconnects, the method further includes: Determine that a first charging protocol is a target charging protocol, and a first type code is a target type code, wherein the first charging protocol is a charging protocol acquired by the electronic device when the power adapter is most recently connected to the electronic device before the power adapter is actively disconnected, and the first type code is a type code acquired by the electronic device when the power adapter is most recently connected to the electronic device before the power adapter is actively disconnected.
5. The method according to claim 4, It is characterized in that When the power adapter is actively disconnected, after obtaining the disconnection time point of the power adapter, the method further includes: Saving the first charging protocol and the first type code; When the power adapter and the electronic device are reconnected, obtaining a second charging protocol and a second type code; The first charging protocol is updated to the second charging protocol, and the first type code is updated to the second type code.
6. The method according to any one of claims 1 to 5, It is characterized in that Before determining the charging current according to the number of times the power adapter is actively disconnected, the method further includes: When the power adapter is disconnected from the electronic device, determining whether the level of the hardware comparator changes, the hardware comparator being connected to the ground pin of the power adapter; When the level of the hardware comparator does not change, determining that the power adapter is actively disconnected; When the level of the hardware comparator changes, it is determined that the power adapter is unplugged by the user.
7. The method according to claim 6, It is characterized in that When the level of the hardware comparator changes, after determining that the power adapter is unplugged by the user, the method further includes: The number of times the power adapter is actively disconnected is reset to zero.
8. The method according to any one of claims 2 to 5, It is characterized in that Also includes: When the number of times the power adapter is actively disconnected is less than a preset number, the charging current is determined according to the battery temperature and / or battery power of the battery of the electronic device.
9. A charging control device, It is characterized in that include: A processing module, used to determine the number of times the power adapter is actively disconnected after being connected to the power adapter; A determination module, used to determine the charging current according to the number of times the power adapter is actively disconnected; A transceiver module, used for sending a charging request carrying the charging current to the power adapter; A charging module, used for charging using the charging current provided by the power adapter; The determination module is specifically used to determine whether the number of times the power adapter is actively disconnected is greater than or equal to a preset number when an interruption occurs between the electronic device and the power adapter, and the port corresponding to the interruption is a dedicated charging port DCP; When the number of times the power adapter is actively disconnected is greater than or equal to a preset number, it is determined that the charging current is a preset current.
10. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the electronic device implements the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.
12. A computer program product, It is characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.
