Detailed Description
While this disclosure may be susceptible to embodiment in different forms, there is shown in the drawings and will herein be described in detail only some specific embodiments thereof with the understanding that the present description is to be considered as an exemplification of the principles of the disclosure and is not intended to limit the disclosure to that as illustrated herein.
Thus, a feature indicated in this specification will serve to explain one of the features of one embodiment of the disclosure, and not to imply that every embodiment of the disclosure must have the stated feature. Further, it should be noted that this specification describes many features. Although some features may be combined to show a possible system design, these features may also be used in other combinations not explicitly described. Thus, the combinations illustrated are not intended to be limiting unless otherwise specified.
In the embodiments shown in the drawings, directional references (such as upper, lower, left, right, front and rear) are used to explain the structure and movement of the various elements of the disclosure not absolutely, but relatively. These descriptions are appropriate when the elements are in the positions shown in the drawings. If the description of the positions of these elements changes, the indication of these directions changes accordingly.
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted.
Preferred embodiments of the present disclosure are described in further detail below with reference to the accompanying drawings of the present specification.
The embodiment of the disclosure provides a method for detecting battery leakage current, which can be applied to an intelligent terminal and a mobile terminal device configured with a battery power supply system. The device to be charged may be, for example, a terminal or a communication terminal including, but not limited to, a device arranged to receive/transmit communication signals via a wireline connection, such as via a Public Switched Telephone Network (PSTN), a Digital Subscriber Line (DSL), a digital cable, a direct cable connection, and/or another data connection/network and/or via, for example, a cellular network, a Wireless Local Area Network (WLAN), a digital television network such as a digital video broadcasting-handheld (DVB-H) network, a satellite network, an amplitude modulation-frequency modulation (AM-FM) broadcast transmitter, and/or a wireless interface of another communication terminal. Communication terminals arranged to communicate over a wireless interface may be referred to as "wireless communication terminals", "wireless terminals", and/or "smart terminals". Examples of smart terminals include, but are not limited to, satellite or cellular phones; personal Communication System (PCS) terminals that may combine a cellular radiotelephone with data processing, facsimile and data communication capabilities; personal Digital Assistants (PDAs) that may include radiotelephones, pagers, internet/intranet access, Web browsers, notepads, calendars, and/or Global Positioning System (GPS) receivers; and conventional laptop and/or palmtop receivers or other electronic devices that include a radiotelephone transceiver. In addition, the terminal may further include, but is not limited to, a rechargeable electronic device having a charging function, such as an electronic book reader, a smart wearable device, a mobile power source (e.g., a charger, a travel charger), an electronic cigarette, a wireless mouse, a wireless keyboard, a wireless headset, a bluetooth speaker, and the like.
Please refer to fig. 1a and 1 b. The electronic device may comprise a back cover 11, a display 12, a circuit board, a battery. It should be noted that the electronic device is not limited to include the above contents. Wherein the rear shell 11 may form the outer contour of the electronic device. In some embodiments, the rear housing 11 may be a metal rear housing, such as a metal such as magnesium alloy, stainless steel, and the like. It should be noted that the material of the rear case 11 in the embodiment of the present application is not limited to this, and other manners may also be adopted, such as: the rear housing 11 may be a plastic rear housing, a ceramic rear housing, a glass rear housing, or the like.
Wherein the display screen 12 is mounted in the rear case 11. The display screen 12 is electrically connected to the circuit board to form a display surface of the electronic device. In some embodiments, the display surface of the electronic device may be provided with non-display areas, such as: the top end or/and the bottom end of the electronic device may form a non-display area, that is, the electronic device forms a non-display area on the upper portion or/and the lower portion of the display screen 12, and the electronic device may mount a camera, a receiver, and the like on the non-display area. Note that the display surface of the electronic device may not be provided with the non-display area, that is, the display 12 may be a full-screen. The display screen can be laid on the whole display surface of the electronic equipment, so that the display screen can be displayed on the display surface of the electronic equipment in a full screen mode.
The display 12 may be one or a combination of liquid crystal display, organic light emitting diode display, electronic ink display, plasma display, and display using other display technologies. The display screen 12 may include an array of touch sensors (i.e., the display screen 12 may be a touch display screen). The touch sensor may be a capacitive touch sensor formed by a transparent touch sensor electrode (e.g., an Indium Tin Oxide (ITO) electrode) array, or may be a touch sensor formed using other touch technologies, such as acoustic wave touch, pressure sensitive touch, resistive touch, optical touch, and the like, and the embodiments of the present application are not limited thereto.
It should be noted that, in some embodiments, a cover plate may be disposed on the display 12, and the cover plate may cover the display 12 to protect the display 12. The cover may be a clear glass cover so that the display 12 is shown through the cover. In some embodiments, the cover plate may be a glass cover plate made of a material such as sapphire. In some embodiments, after the display screen 12 is mounted on the rear case 11, a receiving space is formed between the rear case 11 and the display screen 12, and the receiving space can receive components of the electronic device, such as a circuit board, a battery, and the like. The circuit board is mounted in the rear case 11, and may be a main board of the electronic device, and one, two or more functional devices of a motor, a microphone, a speaker, an earphone interface, a universal serial bus interface, a camera, a distance sensor, an ambient light sensor, a receiver, a processing unit, and the like may be integrated on the circuit board.
In some embodiments, the circuit board may be fixed within the rear case 11. Specifically, the circuit board may be screwed to the rear case 11 by screws, or may be snap-fitted to the rear case 11 by means of a snap. It should be noted that the way of fixing the circuit board to the rear shell 11 specifically is not limited to this, and other ways, such as a way of fixing by a snap and a screw together, are also possible. Wherein a battery is mounted in the rear case 11, and the battery 11 is electrically connected to the circuit board to supply power to the electronic device. The rear case 11 may serve as a battery cover of the battery. The rear case 11 covers the battery to protect the battery, reducing damage to the battery due to collision, dropping, etc. of the electronic apparatus.
Referring to fig. 2, fig. 2 is a block diagram of an electronic device according to an embodiment of the present disclosure. The electronic device may comprise a storage and processing circuit 131, and the storage and processing circuit 131 may be integrated on a circuit board. The storage and processing circuit 131 may include a memory unit, such as a hard disk drive memory unit, a non-volatile memory unit (e.g., a flash memory or other electronically programmable read only memory unit used to form a solid state drive, etc.), a volatile memory unit (e.g., a static or dynamic random access memory unit, etc.), and the like, and embodiments of the present application are not limited thereto. Processing circuitry in the storage and processing circuitry 131 may be used to control the operation of the electronic device. The processing circuitry may be implemented based on one or more micro-processing units, microcontrollers, digital signal processing units, baseband processing units, power management units, audio codec chips, application specific integrated circuits, display driver integrated circuits, and the like.
The storage and processing circuit 131 may be used to run software in the electronic device, such as an Internet browsing application, a Voice Over Internet Protocol (VOIP) phone call application, an email application, a media playing application, operating system functions, and the like.
The electronic device may include input-output circuitry 132, and the input-output circuitry 132 may be disposed on a circuit board. The input-output circuitry 132 may be used to enable the electronic device to enable input and output of data, i.e., to allow the electronic device to receive data from and also to allow the electronic device to output data from the electronic device to an external device. The input-output circuit 132 may further include a sensor 1321. The sensors 1321 can include ambient light sensors, optical and capacitive based proximity sensors, touch sensors (e.g., optical based touch sensors and/or capacitive touch sensors, where the touch sensors can be part of a touch display screen or used independently as a touch sensor structure), acceleration sensors, temperature sensors, and other sensors, among others.
The electronic device may include power management circuitry and other input-output units 1322. Input-output units may include buttons, joysticks, click wheels, scroll wheels, touch pads, keypads, keyboards, cameras, light emitting diodes and other status indicators, and the like.
A user may input commands through the input-output circuitry 132 to control the operation of the electronic device and may use the output data of the input-output circuitry 132 to enable receiving status information and other outputs from the electronic device.
The electronic device further comprises a charging circuit 133. The charging circuit 133 may charge the battery cell 14 of the electronic device. The charging circuit 133 may be used to further regulate the charging voltage and/or charging current input from the adapter to meet the charging requirements of the battery.
The electronic device is configured with a charging interface, and the charging interface 123 may be, for example, a USB2.0 interface, a Micro USB interface, or a USB TYPE-C interface. In some embodiments, the charging interface may also be a lightning interface, or any other type of parallel or serial interface capable of being used for charging. The charging interface 400 is connected with the adapter through a data line, the adapter obtains electric energy from mains supply, and the electric energy is transmitted to the charging circuit through the data line and the charging interface 400 after voltage conversion, so that the electric energy can be charged into the battery cell to be charged through the charging circuit.
The battery 14 in the present disclosure includes a housing, and a battery core, a battery protection board, and the like, which are wrapped in the housing. The battery protection board is an integrated circuit board which plays a role in protecting the battery core. The battery protection board is generally provided with a sampling circuit and a protection circuit. Battery 14 may include a single cell or multiple cells. When the battery 14 includes multiple cells, the multiple cells may be connected in series. Therefore, the charging voltage which can be borne by the battery 14 is the sum of the charging voltages which can be borne by a plurality of battery cores, the charging speed can be increased, and the charging heat emission can be reduced.
For example, taking the electronic device 10 as a mobile phone as an example, when the battery 14 of the electronic device 10 includes a single cell, the voltage of the internal single cell is generally between 3.0V and 4.35V. And when the battery 14 of the electronic device 10 includes two cells connected in series, the total voltage of the two cells connected in series is 6.0V-8.7V. Therefore, when a plurality of cell segments are connected in series, the output voltage of the charging circuit 133 can be increased as compared with a single cell. Compared with a single battery cell, the charging speed is equivalent, and the charging current required by multiple battery cells is about 1/N of the charging current required by a single battery cell (N is the number of the battery cells connected in series in the electronic device 10). In other words, on the premise of ensuring the same charging speed (the same charging current), the scheme of multiple cell segments can reduce the magnitude of the charging current, thereby reducing the heat productivity of the electronic device 10 during the charging process. On the other hand, compared with the single-cell scheme, the charging voltage can be increased by adopting the multi-cell series scheme under the condition that the charging current is kept the same, so that the charging speed is increased.
The following describes a related adapter for charging the electronic device 10 in the related art.
In the related art, the adaptor may operate in a constant voltage mode, and the voltage output therefrom is maintained substantially constant, such as 5V, 9V, 12V, or 20V. The output current can be pulsating direct current (the direction is unchanged, the amplitude is changed along with time), alternating current (both the direction and the amplitude are changed along with time) or constant direct current (both the direction and the amplitude are not changed along with time). The voltage output by the associated adapter is not suitable for being directly applied to the terminals of the battery, but needs to be converted by a conversion circuit in the electronic device 10 to obtain the desired charging voltage and/or charging current of the battery in the electronic device 10.
The adapter may also operate in a voltage-following manner. That is, the adapter performs bidirectional communication with the electronic device 10 to be charged, and the adapter adjusts the voltage and current output by itself according to the charging voltage and charging current required by the electronic device 10, so that the output voltage and current can be directly loaded on the battery of the electronic device 10 to charge the battery, and the electronic device 10 does not need to readjust the charging voltage and charging current again.
The conversion circuit may control the charging voltage and/or the charging current of the battery during different charging phases. For example, during the constant current charging phase, the inverter circuit may utilize a current feedback loop to cause the magnitude of the current into the battery to meet the magnitude of the first charging current expected by the battery. In the constant voltage charging stage, the conversion circuit may utilize a voltage feedback loop so that the magnitude of the voltage applied across the battery satisfies the magnitude of the charging voltage expected by the battery. During the trickle charge phase, the conversion circuit may utilize a current feedback loop such that the magnitude of the current into the battery meets the magnitude of a second charge current expected by the battery (the second charge current being less than the first charge current).
For example, when the voltage output by the relevant adapter is greater than the expected charging voltage of the battery, the conversion circuit is configured to perform a voltage-down conversion process on the voltage output by the relevant adapter, so that the magnitude of the charging voltage obtained through the voltage-down conversion meets the expected charging voltage of the battery.
The charging mode for the battery of the electronic device 10 is roughly a "normal charging mode" or a "quick charging mode". The normal charging mode refers to the adapter outputting a relatively small current value (typically less than 2.5A) or charging the battery in the device to be charged with a relatively small power (typically less than 15W). It usually takes several hours to fully charge a larger capacity battery (e.g., 3000 ma-hour capacity battery) in the normal charging mode. The fast charging mode means that the adapter is capable of outputting a relatively large current (typically greater than 2.5A, such as 4.5A, 5A or even higher) or charging the battery in the device to be charged with a relatively large power (typically greater than or equal to 15W). Compared with the ordinary charging mode, the adapter has higher charging speed in the quick charging mode, and the charging time required for completely charging the battery with the same capacity can be obviously shortened.
A PD charging scheme for charging the electronic device 10 according to a PD charging protocol is described below.
USB-Power Delivery (USBPD) is one of the mainstream fast-charge protocols at present. Is a fast charging specification established by the USB-IF organization. The USBPD increases power delivery through the USB cable and connector, extending the cable bus power supply capability in USB applications. The specification can realize higher voltage and current, the transmitted power can reach 100 watts at most, and the transmission direction of the power can be freely changed.
Referring to fig. 2, the USBPD communication is a process of modulating a message of a protocol layer into a 24MHZ FSK signal and coupling the FSK signal to or obtaining the FSK signal from the VBUS to realize communication between a handset and an adapter.
As shown in fig. 2, in USB PD communication, 24MHz FSK is coupled to the dc level of VBUS through cAC-Coupling capacitor, and in order to prevent 24MHz FSK from affecting the VBUS dc voltage of Power Supply or USB boost, a low pass filter composed of zIsolation inductor is added in the loop to filter out FSK signal.
The charging interface of the PD adapter supporting the PD charging protocol generally includes a voltage pin VBUS, a ground pin GND, data pins USB _ D + (D +) and USB _ D- (D-), a first pin CC1 and a second pin CC 2. When an electronic device 10 supports the charging of the PD adapter, its USB PD protocol interface chip will pass through
Taking the Type-C interface on the electronic device 10 as an example, two sides of the Type-C interface respectively have 12 pins. Wherein, TX1+, TX1-, RX1+, RX1-, TX2+, TX2-, RX2+ and RX 2-are four pairs of differential signal pins, GND is a ground pin, D + and D-are USB differential signal pins compatible with USB2.0, VBUS is a power pin, CC1 and CC2 are pins for detecting positive and negative insertion, distinguishing master and slave, configuring VBUS voltage, etc., and SBU1 and SBU2 are bus pins.
Because the Type-C interface has four power pins and four ground connection pins, consequently, the Type-C interface can support 100W's power output in theory, and this is also the reason that the USB-PD quick charge can be realized to the Type-C interface. On this basis, the USB-PD fast charging refers to a process of requesting the adapter to adjust the output voltage and current by coupling an FSK signal at the VBUS dc level, and specifically includes the following steps:
step 1: the electronic device 10 recognizes whether the inserted adapter is a PD adapter supporting fast charging, and if so, switches to change the Type-C differential signal pin to be used for transmitting DP signals (including PD commands and data), and change the Type C SBU1 and SUB2 bus pins to be used for transmitting AUX auxiliary signals.
Step 2: starting a USB-PD equipment strategy manager, monitoring a Frequency-shift keying (FSK) signal coupled on a direct current level of VBUS by the strategy manager, decoding the FSK signal to obtain a capability resource (Capabilities Source) message, and analyzing the capability resource message according to a USB-PD specification to obtain all voltage and current pair lists supported by a PD adapter;
and step 3: the electronic device 10 selects a voltage and current pair from the Capabilities Source message based on the user's configuration and loads the voltage and current pair into the payload portion of the charge Request (Request) message, and the policy manager then couples the FSK signal to the VBUS dc level.
And 4, step 4: the adapter decodes the FSK signal and sends a receive (Accept) message to the electronic device 10 while adjusting the output voltage and current of the adapter.
And 5: after receiving the Accept message, the electronic device 10 adjusts the charging voltage and current of the charging IC.
Referring to fig. 3, fig. 3 shows a flowchart of a charging control method according to the present disclosure. Specifically, the charging control method firstly enters a main charging thread, and the main charging thread is suitable for electronic devices 10 with different hardware environments, and the charging control method specifically includes:
in step S20, the port type of the adapter is acquired.
In an embodiment, when the charging interface of the electronic device 10 is connected to the adapter, the charging control module in the electronic device 10 detects the port type according to the BC1.2 charging protocol. The Port types of the adapter include SDP (Standard Downstream Port), CDP (Charging Downstream Port), and DCP (Dedicated Charging Port).
Step S21, setting circuit parameters of the charging circuit in the electronic device 10 according to the port type of the adapter, and charging the electronic device 10 with the circuit parameters of the charging circuit.
In one embodiment, depending on the detected port type, a first charging current is obtained from the adapter to charge the electronic device if the charging control module detects that the adapter is of the SDP type, and a second charging current is obtained from the adapter to charge the electronic device if the charging control module detects that the adapter is of the CDP type. Taking the adaptor type as DCP as an example, when it is detected that the charging interface type of the electronic device 10 is DCP, the charging power of 5V and 2A input by the adaptor is received.
Meanwhile, in this embodiment, the charging control module controls the circuit parameters of the charging circuit through a logic circuit inside the hardware system to adapt to the current output by the adapter. Since the charging circuit in the electronic device 10 is connected to the adapter to form a path after the start of charging, the output of the adapter can be adjusted by adjusting the circuit parameters of the charging circuit.
Specifically, in this embodiment, a series of desired charging currents and/or charging voltages, such as a charging input current, a charging current, and a cutoff current, are set, and then a logic control circuit in a hardware system adjusts circuit parameters of the charging circuit according to the parameters.
In the next step, step S22, it is detected whether the adapter is a PD adapter.
Please refer to the method for detecting whether the adapter is a PD adapter in the above PD charging scheme section. There are two types of detection results depending on whether the adapter is a PD adapter. In the following examples, the first case is described first:
step S23, when the adapter is a PD adapter, acquiring the current battery voltage of the electronic device 10;
specifically, the current battery voltage may be obtained by reading a measurement value of a voltage measurement circuit on the battery protection board.
In step S24, the PD charging control script is executed according to the current battery voltage.
In this embodiment, when the PD charging control script is executed, a specific PD charging thread is entered. And then according to the steps in the PD charging thread, sending specific PD charging parameters to the adapter so as to acquire corresponding charging power from the PD adapter.
When the adapter is detected to be a specific PD adapter, a jump can be made to the charging chip file stored in the application processor in the electronic device 10 by means of the function pointer. A PD charging function specific to the electronic device 10 is written in this file.
The PD charging control script may be pre-set within the electronic device 10 according to charging parameters supported by the hardware system of the electronic device 10. Or may be set by the manufacturer or the user after the electronic device 10 is shipped.
The charging parameters supported by different hardware systems may differ, and thus the specific charging control parameters in the PD charging control script corresponding to each electronic device 10 may differ accordingly.
Specifically, when the PD charging control script runs, at least the following steps are performed:
when the current battery voltage is less than or equal to the first voltage threshold, the PD charging control script runs the following steps:
step S241 sets a first PD charging parameter according to the charging parameter supported by the PD adapter and the charging parameter supported by the electronic device 10, and charges the electronic device 10 with the first PD charging parameter.
When the adapter is detected to be a PD adapter, the charging process between the adapter and the electronic device 10 is performed according to a PD charging protocol, and according to the PD protocol, the PD adapter sends a list of all voltage and current pairs supported by the PD adapter to one end of the electronic device 10, so that one end of the electronic device 10 selects a specific one of the voltage and current pairs from the list, where the selection principle is that a hardware system of the electronic device 10 must support the charging voltage and charging current, and which specific selected set of voltage and current pairs may be according to a configuration for quickly charging a user or may be the highest available charging power.
Here, if the battery in the electronic device 10 has a high voltage already at the start of charging, the voltage rises quickly when charging is performed by the PD charging method, and the battery tends to generate a large amount of heat. Therefore, in the embodiment, the first voltage threshold is set to ensure safety during the charging process. When the current charging voltage is smaller than or equal to the first voltage threshold value, setting a first PD charging parameter, and sending the first PD charging parameter to the adapter for obtaining the charging power configured by the first PD charging parameter from the adapter.
Taking the adaptor type as DCP as an example, when it is detected that the charging interface type of the electronic device 10 is DCP in the charging main thread, the charging power of 5V and 2A input by the adaptor is received. And if the adapter is a PD adapter and the voltage is less than the preset 9V, jumping to a specific PD charging thread and executing related steps in the PD charging thread.
It will be appreciated that the operation of the PD charging control script is generally based on the PD charging protocol, and thus reference may be made to the PD charging protocol section above with respect to the information interaction process between the electronic device 10 and the PD adapter.
In the PD charging thread, when the PD adapter responds to the charging parameter sent by the electronic device 10, the output voltage and the output current are adjusted to supply power to the battery of the electronic device 10. However, the PD adapter needs a certain time to adjust its charging voltage and charging current to the first charging parameter. In the time process, the electronic device 10 cannot know when the PD adapter can complete the switching of the charging voltage and the charging current, so that the circuit parameter of the charging circuit cannot be adjusted to adapt to the charging current output by the PD adapter, and thus the circuit parameter of the charging circuit is not matched with the electric energy output by the PD adapter, which easily causes the electronic device 10 to draw an excessive current from the PD adapter, and causes the charging current output by the PD adapter to exceed the rated value thereof, thereby starting overcurrent protection.
Moreover, if a non-normal PD adapter is used, or the PD adapter has a relatively high compatibility with the charging parameter requested by the electronic device 10, the PD adapter does not output the charging voltage and the charging current according to the first charging parameter sent by the electronic device 10, so that the circuit parameter of the charging circuit adjusted by the charging circuit according to the first charging parameter is not matched with the actual output voltage and the actual charging current of the PD adapter, and the charging speed is too slow or the charging safety is threatened.
Therefore, referring to fig. 4, in the present embodiment, in the PD charging thread, the step of setting the first PD charging parameter according to the charging parameter supported by the PD adapter and the charging parameter supported by the electronic device 10, and the step of obtaining the charging power configured with the first PD charging parameter from the PD adapter further includes:
step S22, monitoring the output voltage of the PD adapter;
in step S25, when the output voltage of the PD adapter is adjusted to a voltage value matching the first PD charging parameter, a circuit parameter of the charging circuit is adjusted for matching the charging current configured according to the first PD charging parameter.
In this embodiment, a single thread is opened up for detecting a transition in the output voltage of the PD adapter. For example, the electronic device 10 requests the PD adapter with the first charging parameter to monitor the instant when the output voltage of the PD adapter jumps by monitoring the voltage on the current charging bus Vbus.
For example, the charging parameter set in the main charging thread by the electronic device 10 starts to be 5V, 2A, and after entering the PD charging thread, the electronic device 10 sets the first charging parameter to be 9V, 2A and applies for the PD adapter. The electronic device 10 then monitors the point in time when the output voltage of the PD adapter jumps from 5V to 9V.
Once the time point when the output voltage of the PD adapter jumps from 5V to 9V is monitored, the charging circuit parameter in the charging circuit 10 is adjusted to adapt the charging power configured with the first PD charging parameter, so as to ensure stable and safe charging process.
It should be noted that "adjustment of charging voltage and charging current by the PD adaptor in response to the request of the first PD charging parameter" when "the current charging voltage is adjusted to the voltage value matching the first PD charging parameter". The case where the output voltage of the PD adaptor is the same as the charging voltage in the first PD charging parameter includes a case where a certain charging parameter is automatically selected instead of the first PD charging parameter to output the charging power because the PD adaptor cannot output the charging voltage and the charging current corresponding to the first PD charging parameter.
Therefore, the circuit parameters of the charging circuit can be flexibly adjusted according to the actual output voltage and the charging current of the PD adapter, and can be timely adjusted when the output voltage of the PD adapter jumps, so that the circuit parameters of the charging circuit can be well matched with the output voltage of the PD adapter, and the stable and safe charging process is ensured;
in addition, through the adaptive mechanism of this embodiment, the circuit parameters of the charging circuit can be adjusted according to the output voltage of the PD adapter, so as to avoid the situation that the charging circuit adapts to the wrong current gear.
In an embodiment, the output voltage of the adapter may be monitored through thread polling, and in this embodiment, in order to save memory consumption and occupied CPU resources, the method in this embodiment further includes: when the output voltage of the PD adapter is adjusted to a voltage value matched with the first PD charging parameter, triggering to generate a first interrupt signal;
monitoring the output voltage of the PD adapter includes:
monitoring for the occurrence of a first interrupt signal;
when the output voltage of the PD adapter is adjusted to a voltage value matched with the first PD charging parameter, triggering to generate a first interrupt signal;
when the first interrupt signal is monitored, circuit parameters of the charging circuit are adjusted for matching a charging current configured according to the first PD charging parameters.
For example, when the output voltage of the adapter is adjusted from 5V to 9V, the first interrupt signal is automatically triggered. And then the step is skipped: circuit parameters of the charging circuit are adjusted for adapting the charging current configured with the first PD charging parameters.
In this embodiment, in order to save the memory consumption and the occupied CPU resource, the PD charging thread is only executed once when the battery voltage satisfies the condition. Specifically, the charging control method is executed only when the charging control method is operated for the first time in the current charging process. In this embodiment, the operating the PD charging control script to charge the electronic device according to the current battery voltage further includes:
when the PD charging control script is executed once, charging the electronic equipment by using the first PD charging parameter;
monitoring the receiving condition of the parameter adjusting instruction of the charging circuit every preset time length;
and when receiving a charging circuit parameter adjusting instruction, adjusting the circuit parameters of the charging circuit according to the charging parameter adjusting instruction.
When the electronic device 10 applies for the charging power configured with the first PD charging parameters, the adapter supplies power to the electronic device 10 according to the charging power. In a specific example, after the PD charging control script has been executed once, a corresponding flag is made so that the PD charging control script is not executed again when the charging control method is executed next time.
In this embodiment, when the electronic device 10 needs to adjust the charging current under some conditions, in order to enable the circuit parameter of the charging circuit to be matched with the current charging current at any time, in this embodiment, it is set that the circuit parameter of the charging circuit is adjusted correspondingly each time the charging current is adjusted.
Specifically, when the PD charge control script is marked, it indicates that the PD charge control script has been executed once, and the adapter is already outputting the charging power configured according to the first PD charging parameter. However, the electronic device 10 is capable of self-regulating the magnitude of the charging current. Therefore, when the electronic device 10 is in some special situations and the charging current is adjusted, the charging circuit parameter adjustment command is generated.
It is understood that there are many scenarios that may trigger the generation of the charging circuit parameter adjustment instruction, such as lighting, extinguishing, and making a call on the screen of the electronic device 10, which all affect the magnitude of the charging current.
In the above embodiments, the steps performed by the PD charge control script when the current battery voltage is less than or equal to the first voltage threshold are explained. As charging progresses, when the battery voltage approaches the rated voltage, the voltage may be too high to fully charge. Therefore, referring to fig. 5, in the embodiment, when the current battery voltage is greater than the first voltage threshold, the PD charge control script runs and includes the following steps:
step S242 sets a second PD charging parameter according to the charging parameter supported by the PD adapter and the charging parameter supported by the electronic device 10, and charges the electronic device with the second PD charging parameter.
Wherein the output voltage of the adapter configured with the second PD charging parameters is less than the output voltage of the adapter configured with the first PD charging parameters.
In the PD charging thread, when the acquired current battery voltage is greater than a first voltage threshold value, the battery voltage is high, and the charging is required to be carried out by using a small current and a small voltage. Therefore, at this time, the electronic device 10 sends the second PD charging parameter with smaller charging power to the PD adaptor, so that the PD adaptor outputs smaller charging power to avoid the phenomenon that the battery voltage is high and cannot be fully charged.
Similarly, after the electronic device 10 sends the second PD charging parameter to the PD adapter, when the PD adapter adjusts the charging power to output the second PD charging parameter from the first PD charging parameter output, the electronic device 10 cannot know when the PD adapter can complete the switching of the charging voltage and the charging current, and thus cannot adjust the circuit parameter of the charging circuit to adapt to the charging current output by the PD adapter, which is likely to cause the mismatch between the circuit parameter of the charging circuit and the electric energy output by the PD adapter to cause the electronic device 10 to draw an excessive current from the PD adapter, and cause the charging current output by the PD adapter to exceed its rated value to start overcurrent protection.
Therefore, in this embodiment, the step of setting in the PD charging thread, setting the second PD charging parameter according to the charging parameter supported by the PD adapter and the charging parameter supported by the electronic device 10, and charging the electronic device 10 with the second PD charging parameter further includes:
monitoring an output voltage of the PD adapter;
skipping to the main charging thread according to the result of the output voltage of the PD adapter, and acquiring the charging power from the PD adapter according to the PD charging script, and then:
and when the output voltage of the PD adapter is adjusted to a voltage value matched with the second PD charging parameter, adjusting the circuit parameter of the charging circuit for matching the charging current configured according to the second PD charging parameter.
Specifically, for example, the first PD charging parameter is 9V, 2A, and the second PD charging parameter is 5V, 2A, so that after the electronic device 10 sends the second charging parameter to the PD adapter, the electronic device 10 monitors a time point when the output voltage of the PD adapter jumps from 9V to 5V.
Once the time point when the output voltage of the PD adapter jumps from 9V to 5V is monitored, the charging circuit parameter in the charging circuit is adjusted to adapt the charging power configured with the first PD charging parameter, so as to ensure stable and safe charging process.
Referring to fig. 6, in the above embodiment, the case when the adaptor is a PD adaptor is explained, and the case when the adaptor is not a PD adaptor will be explained here. Specifically, the following steps are further included after detecting whether the adapter is a PD adapter:
step S26, when the adapter is not a PD adapter, monitoring the receiving condition of the parameter adjusting instruction of the charging circuit at preset time intervals;
in step S27, when the charging circuit parameter adjustment instruction is received, the circuit parameter of the charging circuit is adjusted according to the charging parameter adjustment instruction.
Specifically, when the adapter is not a PD adapter, the charging control method continues to execute according to the steps in the main charging thread. Considering that the charging current is adjusted when the electronic device 10 is in some special situations, the charging circuit parameter adjustment command is generated when the electronic device 10 adjusts the charging current.
It is understood that there are many scenarios that may trigger the generation of the charging circuit parameter adjustment instruction, such as lighting, extinguishing, and making a call on the screen of the electronic device 10, which all affect the magnitude of the charging current.
The embodiment of the present disclosure sets an interface of the PD charging control script for calling in the main charging thread applicable to various hardware environments of the electronic device 10, and the PD charging control script has specificity for the hardware environment of the electronic device 10 itself. Therefore, when the PD adapter is detected as the power supply device, the electronic device 10 can be quickly charged based on the PD charging protocol by calling the PD charging control script. The charging control method disclosed by the invention separates the charging step suitable for various hardware environments of the electronic equipment 10 from the specific PD charging step, so that the method can be applied to the electronic equipment 10 in various hardware environments, and therefore, the charging control method disclosed by the invention has better universality.
The present disclosure further provides a charging control device 30 for charging a battery of an electronic device, and please refer to the above charging control method for an embodiment of the charging control device 30. Referring to fig. 6, the charging control apparatus 30 includes:
a port type obtaining module 31, configured to obtain a port type of an adapter that charges an electronic device;
a charging circuit parameter adjusting module 32, configured to set a circuit parameter of a charging circuit in the electronic device according to a port type of the adapter;
a PD adapter judging module 34, configured to detect whether the adapter is a PD adapter;
a voltage obtaining module 35, configured to obtain a current battery voltage of the electronic device 10 when the adapter is a PD adapter;
the PD charging control script processing module 36 is configured to obtain and run a PD charging control script according to the current battery voltage;
a charging power determining module 33, configured to obtain charging power from the PD adapter according to the PD charging script;
the PD charging parameter setting module 37 is configured to set a first PD charging parameter according to the charging parameter supported by the PD adapter and the charging parameter supported by the electronic device, and charge the electronic device with the first PD charging parameter.
In one embodiment, the charging control device 30 further includes:
the monitoring module is used for monitoring the output voltage of the PD adapter;
and the charging circuit parameter adjusting module 32 is configured to adjust a circuit parameter of the charging circuit to match the charging current configured according to the first PD charging parameter when the output voltage output by the PD adapter is adjusted to a voltage value matching the first PD charging parameter.
In one embodiment, the apparatus includes a monitoring module for monitoring for an occurrence of a first interrupt signal;
and a charging circuit parameter adjusting module 32, configured to adjust a circuit parameter of the charging circuit when the first interrupt signal is monitored, so as to match a charging current configured according to the first PD charging parameter.
In one embodiment, the charging control device 30 further includes:
in one embodiment, the charging control device 30 further includes:
the parameter adjusting instruction monitoring module is used for monitoring the receiving condition of the parameter adjusting instruction of the charging circuit at intervals of preset time;
the charging circuit parameter adjusting module 32 is configured to, when receiving a charging circuit parameter adjusting instruction, adjust a circuit parameter of the charging circuit according to the charging parameter adjusting instruction;
in an embodiment, the PD charging parameter setting module 37 is configured to set a second PD charging parameter according to the charging parameter supported by the PD adapter and the charging parameter supported by the electronic device, and charge the electronic device with the second PD charging parameter;
wherein the charging power configured with the second PD charging parameter is less than the charging power configured with the first PD charging parameter.
In one embodiment, the monitoring module is used for monitoring the output voltage of the PD adapter;
and the charging circuit parameter adjusting module 32 is configured to adjust a circuit parameter of the charging circuit when the output voltage output by the PD adapter is adjusted to a voltage value matched with the second PD charging parameter, so as to match the charging current configured according to the second PD charging parameter.
In one embodiment, the monitoring module is configured to monitor for an occurrence of a second interrupt signal;
and a charging circuit parameter adjusting module 32, configured to adjust a circuit parameter of the charging circuit when the second interrupt signal is monitored, so as to match the charging current configured according to the second PD charging parameter.
In an embodiment, the parameter adjustment instruction monitoring module is configured to monitor a receiving condition of a parameter adjustment instruction of the charging circuit every preset time interval when the adapter is not a PD adapter;
and the charging circuit parameter adjusting module 32 is configured to adjust a circuit parameter of the charging circuit according to the charging parameter adjusting instruction when receiving the charging circuit parameter adjusting instruction.
The embodiment also provides an electronic device 10, which includes a battery, a charging circuit, a storage unit, and a processing unit; a storage unit storing a charging control program; the processing unit is used for executing the steps of the charging control method when the charging control program is run.
Referring to FIG. 8, the electronic device 10 is embodied as a general purpose computing device. The components of the electronic device 10 may include, but are not limited to: the at least one processing unit 42, the at least one memory unit 41, and the bus 43 connecting the different system components (including the memory unit 420 and the processing unit 410), wherein the memory unit 41 stores program codes, which can be executed by the processing unit 42, so that the processing unit 42 performs the steps according to the various exemplary embodiments of the present disclosure described in the above embodiment section of this specification.
The storage unit 41 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM)411 and/or a cache memory unit 412, and may further include a read only memory unit (ROM) 413.
The storage unit 41 may also include a program/utility 414 having a set (at least one) of program modules 415, such program modules 415 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 43 may be one or more of any of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 10 may also communicate with one or more external devices 50 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 10, and/or with any devices (e.g., router, modem, display unit 44, etc.) that enable the robotic electronic device 10 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 45. Also, the robotic electronic device 10 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 46. As shown in fig. 7, the network adapter 46 communicates with the other modules of the robot's electronic device 10 via the bus 43. It should be understood that although not shown in fig. 8, other hardware and/or software modules may be used in conjunction with the robotic electronic device 10, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned example section of this specification, when the program product is run on the terminal device.
While the present disclosure has been described with reference to several exemplary embodiments, it is understood that the terminology used is intended to be in the nature of words of description and illustration, rather than of limitation. As the present disclosure may be embodied in several forms without departing from the spirit or essential characteristics thereof, it should also be understood that the above-described embodiments are not limited by any of the details of the foregoing description, but rather should be construed broadly within its spirit and scope as defined in the appended claims, and therefore all changes and modifications that fall within the meets and bounds of the claims, or equivalences of such meets and bounds are therefore intended to be embraced by the appended claims.