A charging detection method, electronic device and power adapter

By isolating the control of PMIC and SC, and combining the charger reset and HVDCP handshake conditions, the problem of high-power fast charging recognition failure in mobile phone charging detection was solved, and accurate recognition and normal charging of high-power fast charging were achieved.

CN119275957BActive Publication Date: 2025-12-30HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410009509.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-02
Publication Date
2025-12-30
Estimated Expiration
2044-01-02

AI Technical Summary

Technical Problem

In existing technologies, during the charging detection process, mobile phones are prone to failure to identify high-power fast charging due to conflicts between multiple signal sources, and abnormal anti-counterfeiting detection can prevent the charger from being ejected, making it impossible to accurately identify high-power fast charging.

Method used

By isolating the control of PMIC and SC during the charging detection process, it is ensured that only one signal source controls the voltage of D+ and D- ports at the same time. Combined with charger reset and setting HVDCP handshake conditions, the accuracy of charging detection is improved.

Benefits of technology

It improves the accuracy of high-power fast charging identification, ensuring that the phone can normally enter high-power fast charging, avoiding charger type identification errors and HVDCP handshake failures, and improving charging efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119275957B_ABST
    Figure CN119275957B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of charging, and discloses a charging detection method, an electronic device and a power adapter. In order to accurately identify high-power fast charging, the electronic device isolates the control of PMIC and SC, so that one device in PMIC and SC controls the level of the D+ port and the D- port at the same time, that is, only one signal source can control the D+ port and the D- port at the same time, so as to avoid the conflict caused by the fact that PMIC and SC simultaneously control the voltage of the D+ port. In this way, it can be ensured that the signals of the D+ port and the D- port meet the expectation in BC1.2 detection and high-voltage charging handshake detection, the conflict of two voltage controls is avoided, the accuracy of processes such as BC1.2 detection of the charger as a DCP type and successful high-voltage charging handshake is improved, and the electronic device can accurately enter high-power fast charging.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of charging technology, and in particular to a charging detection method, electronic device, and power adapter. Background Technology

[0002] As the functions of mobile phones and other electronic devices become increasingly rich and sophisticated, people are using these devices for longer periods of time, thus placing higher demands on battery life. Consequently, the battery capacity of electronic devices is constantly increasing, and the demand for fast charging is also growing.

[0003] Currently, when users charge mobile phones and other electronic devices with a charger, a charging test is required first. This test determines whether the charger can perform high-power fast charging, such as a charging capacity of 9 volts (V) and 2 amps (A). Before the phone can perform high-power fast charging, it needs to identify the charger as a dedicated charging port (DCP) type to confirm that the charger supports fast charging. After the phone identifies the charger as a DCP type, it needs to successfully complete subsequent charging testing procedures, such as high-voltage charging (high-voltage detector and controller protocol, HVDCP) handshake and anti-counterfeiting checks, to ensure that the charger has high-power fast charging capability and is a standard charger with safety features before proceeding with high-power fast charging.

[0004] Specifically, on the one hand, during the charging detection process of a mobile phone and charger, such as charger type identification and HVDCP handshake, the voltage of the charging protocol communication pins in the phone, such as the D+ and D- ports, is usually controlled and detected. However, in practical applications, the voltage of the D+ and D- ports may not meet the requirements due to conflicts from multiple signal sources, resulting in the inability to properly identify high-power fast charging. On the other hand, if the phone restarts during the anti-counterfeiting detection process, the charger will be unable to exit the anti-counterfeiting detection, thus failing to accurately identify high-power fast charging.

[0005] Therefore, in practical applications, high-power fast charging may be misidentified as low-power charging such as Buck charging. For example, Buck charging supports 5V 500mAh (mA) or 5V 2A charging, which is slower. Thus, to ensure that the charger can properly perform high-power fast charging on electronic devices, it is necessary to ensure accurate identification of high-power fast charging. Summary of the Invention

[0006] This application provides a charging detection method, electronic device, and power adapter, which can improve the accuracy of identifying high-power fast charging and help mobile phones accurately enter high-power fast charging.

[0007] In a first aspect, embodiments of this application provide a charging detection method applied to an electronic device. The method includes: detecting that a power adapter is inserted into a first charging interface of the electronic device, the first charging interface including a first charging protocol communication pin; performing a first charging detection on the power adapter to identify whether the power adapter is of a first type (e.g., DCP type), wherein the voltage of the first charging protocol communication pin is controlled by a first voltage control module during the first charging detection; and performing a second charging detection on the power adapter corresponding to the detection that the power adapter is of the first type, wherein the voltage of the first charging protocol communication pin is controlled by a second voltage control module during the second charging detection. For example, the electronic device can be a mobile phone, and the power adapter can be a mobile phone charger, such as a standard charger. Thus, the electronic device isolates the control of the PMIC and SC, so that at the same time, one device in the PMIC and SC controls the levels of the D+ and D- ports, i.e., only one signal source can control the D+ and D- ports at any given time. For example, during the BC1.2 detection process, the electronic device controls the voltage of the D+ port only through the PMIC to avoid conflicts caused by the PMIC and SC simultaneously controlling the voltage of the D+ port. This can improve the success rate of charging detection steps such as BC1.2 detection, thereby improving the accuracy of identifying high-power fast charging and making it easier for the phone to accurately enter high-power fast charging.

[0008] In one possible implementation of the first aspect described above, the method further includes: the first charging protocol communication pin includes a first D+ port and a first D- port. That is, the first D+ port and the first D- port are the D+ port and D- port in the charging port on the mobile phone side.

[0009] In one possible implementation of the first aspect described above, the second charging detection includes at least one of the following: performing a high-voltage charging handshake on the power adapter, performing a ping detection on the power adapter, acquiring information about the power adapter, controlling the power adapter to enter an anti-counterfeiting detection state, performing anti-counterfeiting detection on the power adapter, and controlling the power adapter to exit the anti-counterfeiting detection state. For example, the high-voltage charging handshake described above can be a high-voltage charging (high voltage detector and controller protocol, HVDCP) handshake.

[0010] In one possible implementation of the first aspect described above, the first voltage control module and the second voltage control module may be the same or different; and the first voltage control module is a power management integrated circuit (PMIC) or SC (a control module, such as a chip) in an electronic device, and the second voltage control module is a PMIC or SC. That is, this application can use different voltage control modules to control the D+ port and D- port at different time periods throughout the entire charging detection process. For example, the mobile phone uses a PMIC in BC1.2 detection, while the SC is used in high-power fast charging identification processes such as HVDCP handshake detection.

[0011] In one possible implementation of the first aspect described above, the method further includes: corresponding to the difference between the first voltage control module and the second voltage control module, upon detecting that a switching condition is met, switching the voltage control module controlling the first charging protocol communication pin from the second voltage control module to the first voltage control module; wherein the switching condition includes at least one of the following: failure to perform high-voltage charging handshake with the power adapter, success to perform high-voltage charging handshake with the power adapter and failure of ping detection, success to perform high-voltage charging handshake with the power adapter, success of ping detection and failure of anti-counterfeiting detection. This allows the mobile phone (i.e., the electronic device) to use the PMIC to control the voltage of the D+ port and the D- port during subsequent low-power charging.

[0012] In one possible implementation of the first aspect described above, the method further includes: corresponding to the detection that the power adapter is of the first type, using a second voltage control module to control the voltage of the first D+ port to a first voltage and maintaining it for a first duration, thereby resetting the power adapter, wherein the first voltage is less than or equal to a first preset voltage. Resetting the power adapter can cause it to exit an abnormal state, thus improving the success rate of the mobile phone's charging detection of the power adapter.

[0013] In one possible implementation of the first aspect described above, the power adapter includes a second charging port, which includes a second charging protocol communication pin. This second charging protocol communication pin includes a second D+ port and a second D- port. After the power adapter is reset, the second D+ port and the second D- port are shorted. Corresponding to the second charging port being inserted into the first charging port, the first D+ port is connected to the second D+ port, and the first D- port is connected to the second D- port. It can be understood that when the charger (i.e., the power adapter) is reset, the D+ and D- ports in the charger will be shorted, and both the D+ and D- ports on the charger side will be at a low level. Thus, the charger can be reset before the phone performs the HVDCP handshake, preventing HVDCP handshake failure due to the D+ and D- ports not being shorted, thereby improving the success rate of the HVDCP handshake.

[0014] In one possible implementation of the first aspect described above, the method further includes: corresponding to performing a high-voltage charging handshake with the power adapter, using a second voltage control module to control the voltage of the first D+ port to a second voltage and maintaining it for a second duration, detecting whether the high-voltage charging handshake conditions are met, wherein the high-voltage charging handshake conditions include: the voltage of the first D+ port is greater than or equal to a second preset voltage and the voltage of the first D- port is less than or equal to a first preset voltage (e.g., the first preset voltage can be 0.32V, i.e., low level). For example, in the high-voltage charging handshake process, after the electronic device (e.g., a mobile phone) pulls the D+ port high for a period of time, under normal circumstances, the power adapter (e.g., a charger) will disconnect the short circuit between the D+ port and the D- port on the power adapter side. Therefore, in the handshake process, after the mobile phone pulls the D+ port high and maintains it for a period of time, the mobile phone detects that the D+ port is at a high level and the D- port is at a low level, indicating that the charger has correctly disconnected the short circuit between the D+ port and the D- port. Therefore, the mobile phone detects that the above-mentioned high-voltage charging handshake conditions (e.g., HVDCP handshake conditions) are met, indicating that the handshake between the mobile phone and the charger is successful. Thus, by determining the above-mentioned high-voltage charging handshake conditions, the accuracy of the high-voltage charging handshake can be further improved.

[0015] In one possible implementation of the first aspect described above, obtaining the power adapter information includes: sending a first instruction to the power adapter, wherein the first instruction is used to obtain the charging capability of the power adapter, and the first instruction is used to instruct the power adapter to exit the anti-counterfeiting detection state, and the power adapter information includes the power adapter's charging capability. For example, the first instruction is used to read the charging capability in the 0x7E register of the charger.

[0016] In one possible implementation of the first aspect described above, the control of the power adapter to enter the anti-counterfeiting detection state includes: sending a second instruction to the power adapter, wherein the second instruction is used to instruct the power adapter to enter the anti-counterfeiting detection state, and further used to instruct the power adapter to exit the anti-counterfeiting detection state when a first exit condition is met; the first exit condition includes: the power adapter does not receive a third instruction sent by the electronic device within the timing duration of a preset timer, and the third instruction is used to instruct the power adapter to exit the anti-counterfeiting detection state. For example, the second instruction is used to write the anti-counterfeiting key index into the 0xCE register in the charger to trigger the charger to forcibly exit the anti-counterfeiting detection state. The timing duration of the preset timer may be 10 seconds.

[0017] In one possible implementation of the first aspect described above, the method further includes: sending a third instruction to the power adapter, the third instruction being used to instruct the power adapter to shut down the preset timer that has not stopped timing and exit the anti-counterfeiting detection state. For example, the third instruction is used to write an exit parameter, such as 0xFF, into the 0xCE register in the charger to trigger the charger to normally exit the anti-counterfeiting detection state.

[0018] In one possible implementation of the first aspect described above, the method further includes: corresponding to successful anti-counterfeiting detection of the power adapter and the power adapter exiting the anti-counterfeiting detection state, charging is performed via the power adapter at a first power; wherein the power adapter is a standard power adapter for the electronic device. For example, the first power corresponds to high-power fast charging, such as the first power supporting 66W charging.

[0019] In one possible implementation of the first aspect described above, the method further includes: corresponding to the failure of anti-counterfeiting detection of the power adapter and the power adapter exiting the anti-counterfeiting detection state, or the detection that the switching conditions are met, charging the power adapter at a second power, wherein the second power is less than the first power. For example, the first power may correspond to 5V2A charging, such as a first power of 10W.

[0020] In one possible implementation of the first aspect described above, the method further includes: corresponding to the difference between the first voltage control module and the second voltage control module, upon detecting that the electronic device has finished charging at the first power, switching the voltage control module controlling the first charging protocol communication pin from the second voltage control module back to the first voltage control module. This allows the electronic device to default to using the first voltage control module, such as the PMIC, to control the voltages of the D+ and D- ports during the next charging detection process.

[0021] Secondly, embodiments of this application provide a charging detection method applied to a power adapter. The power adapter includes a second charging port, which includes a second charging protocol communication pin, and the second charging protocol communication pin includes a second D+ port. The method includes: detecting that the second charging port is inserted into a first charging port of an electronic device, wherein the first charging port includes a first charging protocol communication pin, and the first charging protocol communication pin includes a first D+ port; corresponding to a first type of power adapter, detecting that the voltage of the second D+ port is a first voltage, and maintaining this voltage for a first duration (e.g., 10ms), and resetting the power adapter, wherein the first voltage is applied by the voltage of the first D+ port, and the first voltage is less than or equal to a first preset voltage. That is, the power adapter detects that the D+ port is at the first voltage and maintains this voltage for a first duration, and then resets the power adapter. It can be understood that when the charger (i.e., the power adapter) is reset, the D+ port and D- port in the charger will be short-circuited, and both the D+ port and D- port on the charger side will be at a low level. In this way, the charger can be reset before the mobile phone (i.e., electronic device) performs the high-voltage charging handshake, and the high-voltage charging handshake will not fail due to the D+ port and D- port in the charger not being shorted, which helps to improve the success rate of the high-voltage charging handshake.

[0022] In one possible implementation of the second aspect described above, the second charging port further includes a second D- port; corresponding to a power adapter reset, the second D+ port is shorted to the second D- port. At this time, both the second D+ port and the second D- port are at a low level.

[0023] In one possible implementation of the second aspect above, the method further includes: receiving a first instruction sent by an electronic device; in response to the first instruction, reading the charging capability of the power adapter and exiting the anti-counterfeiting detection state, wherein the information of the power adapter includes the charging capability of the power adapter.

[0024] In one possible implementation of the second aspect above, the method includes: receiving a second instruction sent by an electronic device; in response to the second instruction, entering an anti-counterfeiting detection state and controlling a preset timer to start timing; detecting whether a first exit condition is met; and exiting the anti-counterfeiting detection state corresponding to the satisfaction of the first exit condition; wherein the first exit condition includes: not receiving a third instruction sent by the electronic device within the timing duration of the preset timer, the third instruction being used to instruct the power adapter to exit the anti-counterfeiting detection state.

[0025] In one possible implementation of the second aspect above, the method further includes: exiting the anti-counterfeiting detection state and turning off the preset timer that has not stopped counting, corresponding to the failure to meet the first exit condition.

[0026] In one possible implementation of the second aspect above, the first instruction is used to instruct the electronic device to read the charging capability of the power adapter from the first register (such as the 0x7E register) of the power adapter; the second instruction is used to instruct the electronic device to write the anti-counterfeiting key index into the second register (such as the 0xCE register) of the power adapter; and the third instruction is used to instruct the electronic device to write an exit parameter into the second register, the exit parameter being used to instruct the power adapter to exit the anti-counterfeiting detection state.

[0027] In one possible implementation of the second aspect above, entering the anti-counterfeiting detection state is achieved by setting the anti-counterfeiting detection flag in the power adapter to a first state, which corresponds to the power adapter entering the anti-counterfeiting detection state; exiting the anti-counterfeiting detection state is achieved by setting the anti-counterfeiting detection flag in the power adapter to a second state, which corresponds to the power adapter exiting the anti-counterfeiting detection state. The charger (i.e., the power adapter) can set the value of the anti-counterfeiting flag when entering or exiting the anti-counterfeiting detection process, so as to indicate whether the appliance has entered or exited the anti-counterfeiting detection process through this anti-counterfeiting flag.

[0028] Thirdly, embodiments of this application provide an electronic device, including: a memory for storing instructions executed by one or more processors of the electronic device, and a processor, one of the processors of the electronic device, for executing the charging detection method in the first aspect and its various possible implementations.

[0029] Fourthly, embodiments of this application provide a power adapter, including: a memory for storing instructions executed by one or more processors of the power adapter, and a processor, one of the processors of the power adapter, for executing the charging detection method in the second aspect and its various possible implementations.

[0030] Fifthly, embodiments of this application provide a charging system, which includes the electronic device described in the third aspect and the power adapter described in the fourth aspect, the power adapter being used to charge the electronic device.

[0031] The beneficial effects of aspects two through five can be referred to the relevant descriptions of aspects one and two, and will not be repeated here. Attached Figure Description

[0032] Figure 1A According to some embodiments of this application, a schematic diagram of a charging scenario is shown;

[0033] Figure 1B According to some embodiments of this application, it is shown that Figure 1A The diagram shown illustrates the charging port connection in a charging scenario.

[0034] Figure 2 According to some embodiments of this application, a schematic flowchart of a charger identification method is shown;

[0035] Figure 3 According to some embodiments of this application, a schematic flowchart of a charging detection method is shown;

[0036] Figure 4 According to some embodiments of this application, a schematic flowchart of a charging detection method is shown;

[0037] Figure 5 According to some embodiments of this application, a schematic flowchart of a charging detection method is shown;

[0038] Figure 6 According to some embodiments of this application, a schematic flowchart of a charging detection method is shown;

[0039] Figure 7 According to some embodiments of this application, a structural schematic diagram of a mobile phone is shown;

[0040] Figure 8According to some embodiments of this application, a schematic diagram of a charger structure is shown. Detailed Implementation

[0041] The illustrative embodiments of this application include, but are not limited to, charging detection methods, electronic devices, and power adapters.

[0042] This application provides a charging detection method that can be applied to scenarios where a power adapter charges an electronic device. For example, the electronic device can be a charging device such as a mobile phone, tablet, personal business assistant, or laptop, while the power adapter can be a charger (such as a standard charger) or other charging device capable of reverse charging.

[0043] To ensure charging safety and stability, standard chargers for electronic devices typically support high-power fast charging for mobile phones, while other chargers generally cannot.

[0044] Reference Figure 1A The diagram illustrates a charging scenario. Taking a mobile phone 100 as an example, the charger 200 (such as the standard charger) can quickly charge the phone 100, such as with high-power fast charging (also known as direct charging or super-fast charging). Specifically, the charger 200 charges the phone 100 when it is plugged in, with its charging port 210 inserted into the phone 100's charging port 110. Both charging ports 210 and 110 can be Universal Serial Bus (USB) interfaces, such as Type-C. Type-C, also known as USB Type-C, is a universal connection standard. The Type-C interface supports USB standard functions such as charging, data transfer, and display output.

[0045] In some embodiments, when the mobile phone 100 detects that the charger 200 is inserted, it can first perform charger identification. If high-power fast charging is correctly identified, the charger 200 will perform high-power fast charging for the mobile phone 100. The charger identification process depends on the state of some ports in the charging port 110 of the mobile phone 100.

[0046] To make it easier to understand, the following is a structural diagram of the charging port 110.

[0047] In some embodiments, refer to Figure 1B As shown, Figure 1A The diagram shows the charging port connection in a charging scenario. Figure 1BAs shown, the charging port 110 of the mobile phone 100 may include four ports: voltage bus (VBUS), D+, D-, and GND (ground). Correspondingly, the charging port 210 of the charger 200 also has four ports: VBUS, D+, D-, and GND, for connection with the corresponding ports in the charging port 110 of the mobile phone 100.

[0048] The VBUS and GND ports represent the positive and negative terminals of the voltage, respectively, and are used as power lines for the external charger 200 to supply power to the mobile phone 100. The D+ and D- ports represent the charging protocol communication pins. It can be understood that the high-power fast charging identification process described above requires detecting the status of the D+ and D- ports, and identifying the charger type of the charger 200 based on the status of the D+ and D- ports, such as their voltage. Furthermore, the mobile phone 100 also includes a power management integrated circuit (PMIC) and an SC (a control circuit), and both the PMIC and SC can control the signal level of the D+ port.

[0049] The PMIC and SC can be implemented through chips; for example, both the PMIC and SC can be integrated into the power management chip of the mobile phone 100. In the following text, the PMIC and SC can also be referred to as voltage control modules. Furthermore, although... Figure 1B As not shown in the diagram, in practical applications, PMIC and SC can also be connected to the D+ port and D- port in charging port 110, respectively.

[0050] In some embodiments, refer to Figure 2 The diagram shown is a flowchart of a charger identification method. When the mobile phone 100 detects that the charger 200 is inserted into the charging port 110, the mobile phone 100 needs to identify the charger 200 as a high-power fast charger.

[0051] Specifically, Figure 2 The charging detection process shown typically includes the following steps 201 to 212:

[0052] 201: BC1.2 Detection. For example, mobile phone 100 performs BC1.2 detection on charger 200.

[0053] 202: Determine if the charger type is a dedicated charging port (DCP).

[0054] Among them, BC1.2 detection is used to determine whether the charger type is DCP.

[0055] BC1.2 (Battery Charging v1.2) is a charging interface standard for electronic devices. The main purpose of BC1.2 detection is to determine the USB port type (i.e., charger type). Specifically, it detects the voltage and current information obtained by the phone from the USB port and determines the USB port type based on this information. For example, the charger type can be DCP or a standard downstream port (SDP). DCP does not support data protocols but supports fast charging and can provide high current; the corresponding charging method is power adapter or power bank charging. The SDP port supports the USB protocol, is a standard USB interface, has a maximum current of 500mA, and the corresponding charging method is host charging.

[0056] It's understandable that a charger labeled DCP (e.g., Type 1) indicates that it supports fast charging, such as high-power fast charging or low-power charging. A charger labeled non-DCP, such as SDP, indicates that it does not support fast charging and can only perform slower, normal charging.

[0057] The BC1.2 detection can identify the charger type based on the status of the D+ and D- ports. If both D+ and D- ports are shorted, the phone is charged using DCP charging (power adapter or power bank charging), meaning the charger type is DCP. If neither D+ nor D- ports are shorted, the device is charged using SDP charging (host charging), meaning the charger type is SDP.

[0058] Specifically, the mobile phone 100 can apply a high level, such as 0.6V, to the D+ port for a period of time (1 to 100ms, such as 50 milliseconds), and detect whether the D- port is high. If the D- port is detected as high, it indicates that the D+ and D- ports are short-circuited, and the charger type is DCP; if the D- port is detected as low, it indicates that the D+ and D- ports are not short-circuited, and the charger type is not DCP. Furthermore, the mobile phone 100 can apply a low level, such as 0V, to the D- port for a period of time (1 to 100ms, such as 50 milliseconds), and detect whether the D+ port is low. If the D+ port is detected as low, it indicates that the D+ and D- ports are short-circuited, and the charger type is DCP; if the D- port is detected as high, it indicates that the D+ and D- ports are not short-circuited, and the charger type is not DCP.

[0059] In some implementations, the high level in the embodiments of this application can be a level greater than or equal to a preset voltage 1 (denoted as the first preset voltage), for example, the value of preset voltage 1 can be 0.6V, but is not limited thereto. The low level can be a level less than or equal to a preset voltage 2, for example, the value of preset voltage 2 can be 0.32V, but is not limited thereto.

[0060] It's understandable that if the phone detects that the charger is not a DCP type during BC1.2, it will proceed to S210 to enter buck charging mode, without further identifying high-power fast charging. Subsequent tests can be performed after BC1.2 to complete the identification of high-power fast charging.

[0061] 203: Determine if the high voltage charging (high voltage detector and controller protocol, HVDCP) handshake was successful. This means that the mobile phone 100 performs an HVDCP handshake with the charger 200 and determines whether the HVDCP handshake was successful.

[0062] For example, the high-voltage charging handshake in this application can be an HVDCP handshake, but it is not limited to this and can also be other handshake processes.

[0063] Specifically, the HVDCP handshake process can involve pulling the D+ port high and then checking if the D- port is low after a certain period (e.g., 1 second). If the D- port is detected as low, the HVDCP handshake is successful; otherwise, it fails. For example, the HVDCP handshake can involve pulling D+ high by 0.6V for a period (e.g., 0.5 to 2 seconds, or 1 second), and then detecting that the D- port is 0V (i.e., low), indicating a successful HVDCP handshake. In practical applications, a D- port is considered low when the detected D- level is less than 0.32V.

[0064] HVDCP is a handshake protocol used for fast charging. It allows the charger to detect information such as the phone's current output capability and voltage without using any external circuitry. During the charging process, the charger needs to detect these parameters, requiring a successful HVDCP handshake to allow the charger to begin charging the phone.

[0065] In the HVDCP handshake process described above, a successful handshake is determined once the D- port is found to be low. However, under normal circumstances, during the HVDCP handshake, after the phone pulls the D+ port high for a period of time, the charger disconnects the short circuit between the D+ and D- ports. The voltage on the D- port in the charger drops, which the phone detects. For example, the D- port may go low, while the D+ port in the phone remains high (e.g., 0.6V). Therefore, in the above HVDCP handshake process, if the charger's D+ and D- ports are shorted after the phone pulls the D+ port high for a period, both ports will be low, meaning the D+ port in the phone will also be low. This leads to a misjudgment of the HVDCP handshake result, causing subsequent charging detection steps to fail. Similarly, if the charger is in a state of other logical abnormality before the HVDCP handshake detection, it will also cause the HVDCP handshake to fail.

[0066] It's understandable that BC1.2 detection and HVDCP handshake rely on the phone controlling the signals (i.e., voltage levels) of the D+ and D- ports. While both the phone's PMIC and SC can control the D+ port, the control boundaries are unclear, easily leading to conflicts. Specifically, in BC1.2 detection, the PMIC typically controls both the D+ and D- ports. However, during HVDCP handshake detection, the PMIC and SC might simultaneously control both ports. For example, if the HVDCP handshake requires pulling the D+ port high by 0.6V, the PMIC might output 0.6V to the D+ port, while the SC outputs 0V, resulting in an actual voltage level of only 0.3V and causing a conflict. This will prevent the D+ port signal from outputting as expected, leading to HVDCP handshake failure. Similarly, if the D+ port is simultaneously controlled by both the PMIC and SC during BC1.2 detection, it will result in incorrect charger type identification.

[0067] If the HVDCP handshake fails, phone 100 executes S210 to enter low-power charging, such as buck charging. If the HVDCP handshake succeeds, it proceeds to the charging detection step in 204.

[0068] 204: Check if the ping was successful. This means that phone 100 performs a ping (a network diagnostic tool) test on charger 200 to determine if the ping was successful.

[0069] For example, during a ping test, the phone checks whether it receives a ping response within a certain period (e.g., 50ms) after sending a ping request to the charger. If the phone receives a ping response, the ping is successful; otherwise, it fails.

[0070] It's understandable that if the HVDCP handshake fails and is misidentified, it will inevitably lead to subsequent ping failures. If the ping fails, phone 100 executes step 209 to enter low-power charging, such as buck charging. If the ping succeeds, phone 100 proceeds to the subsequent charging detection steps in step 205.

[0071] 205: Obtain information about the charger. For example, phone 100 obtains information about charger 200.

[0072] The charger's information includes charging capacity, voltage, and current. For example, a mobile phone reads the charger's 0x7E register to identify its charging capacity.

[0073] 206: Write the anti-counterfeiting key index. For example, mobile phone 100 writes the anti-counterfeiting key index to charger 200.

[0074] For example, the phone writes a key index to the charger's register 0xCE, causing the charger to enter an anti-counterfeiting state.

[0075] In some embodiments, when a charger enters anti-counterfeiting detection, the value of an anti-counterfeiting flag can be set to indicate that the appliance has entered the anti-counterfeiting detection process. For example, the value of the anti-counterfeiting flag can be set to 1 when the charger enters anti-counterfeiting detection. Similarly, the value of the anti-counterfeiting flag can be set to 0 when the charger exits anti-counterfeiting detection. Of course, the value of the anti-counterfeiting flag can be set to other values ​​for entering and exiting anti-counterfeiting detection, which is not specifically limited here. In addition, an anti-counterfeiting flag can be added when the charger enters anti-counterfeiting detection; and the anti-counterfeiting flag can be cleared when the charger exits anti-counterfeiting detection.

[0076] 207: Anti-counterfeiting detection. For example, mobile phone 100 performs anti-counterfeiting detection on charger 200.

[0077] It's understandable that mobile phones perform anti-counterfeiting checks on chargers to verify whether the charger is genuine. If the anti-counterfeiting check is successful, it means the charger is a genuine charger and is allowed to perform high-power fast charging on the phone. Conversely, if the anti-counterfeiting check fails, it means the charger is not a genuine charger and is generally not allowed to perform high-power fast charging on the phone.

[0078] 208: Exit anti-counterfeiting detection mode. For example, phone 100 triggers charger 200 to exit anti-counterfeiting detection mode.

[0079] Specifically, the phone writes 0xFF to the charger's 0xCE register, causing the charger to exit the anti-counterfeiting detection state. This means that after writing 0xFF to the charger's 0xCE register, the charger can set the anti-counterfeiting flag to 0 or clear it, thus exiting the anti-counterfeiting detection state.

[0080] 209: Determine whether the anti-counterfeiting detection was successful.

[0081] If the anti-counterfeiting detection is successful when the charger 200 is out of anti-counterfeiting detection mode, the phone 100 will correctly identify the charger 200 as high-power fast charging, causing the phone 100 to execute step 210 to enter high-power fast charging. Conversely, if the anti-counterfeiting detection fails, the phone 100 will identify the charger 200 as non-high-power fast charging, i.e., low-power charging such as buck charging, causing the phone 100 to execute step 211.

[0082] However, when performing anti-counterfeiting detection, if the phone restarts but the charger is not unplugged, the charger will remain in the anti-counterfeiting detection state and will not be able to exit normally. This will cause subsequent interaction errors between the phone and the charger, preventing the phone from correctly entering high-power fast charging.

[0083] 210: Entering high-power fast charging. For example, the phone enters high-power fast charging at 100.

[0084] For example, high-power fast charging can enable the charger to support 66W charging.

[0085] 211: Entering low-power charging. For example, phone 100 enters low-power charging.

[0086] For example, low-power charging could refer to a charger charging a phone at 5V2A for 100W. In this case, the charger's charging power is 10W. Clearly, the charging power of a charger under high-power fast charging is greater than that under low-power charging. For example, the aforementioned low-power charging could be used to charge a Bucky.

[0087] 212: Charging complete. For example, phone 100 performs high-power fast charging and then finishes charging, or phone 100 enters low-power charging and then finishes charging.

[0088] It is understandable that correctly identifying high-power fast charging requires the following conditions to be met simultaneously: BC1.2 detects the charger type as DCP; HVDCP handshake detection is successful; ping is successful; and anti-counterfeiting detection is successful. However, the following problems may occur during the charger identification process: First, BC1.2 detection and HVDCP handshake rely on the phone controlling the D+ and D- port signals. Both the phone's PMIC and SC can control D+, and the control boundaries between the two are unclear, easily causing conflicts. This can lead to the D+ port signal not being output as expected, resulting in incorrect charger type identification or HVDCP handshake failure, preventing entry into high-power fast charging. Second, if the charger is in an abnormal state before HVDCP handshake detection, such as not shorting the D+ and D- ports or not exiting anti-counterfeiting detection, HVDCP handshake will fail. Third, the anti-counterfeiting detection process may be interrupted by a phone restart, preventing the completion of the closed-loop logic of the charger entering and exiting anti-counterfeiting detection. This can cause the charger to be unable to exit anti-counterfeiting mode after entering it, and subsequently unable to respond normally to phone commands, thus preventing entry into high-power fast charging.

[0089] In summary, after the phone is plugged into the standard charger, issues such as BC1.2 detection misidentification, HVDCP handshake detection failure, ping detection failure, and inability to exit anti-counterfeiting detection may occur, thus failing to accurately identify high-power fast charging and therefore failing to perform high-power charging normally.

[0090] To accurately identify high-power fast charging, this application provides a charging detection method. The electronic device isolates the control of the PMIC and SC, ensuring that only one device in the PMIC and SC controls the voltage levels of the D+ and D- ports simultaneously. Specifically, during BC1.2 detection and HVDCP handshake, the electronic device controls the voltage of the D+ port through one device in the PMIC and SC at the same time to avoid conflicts caused by simultaneous control of the D+ port voltage by both the PMIC and SC. For example, when the electronic device detects a charger inserted into the charging port and performs BC1.2 detection, it applies a high level (e.g., 0.6V) to the D+ port via the PMIC for a period of time and applies a low level (e.g., 0V) to the D- port via the PMIC for a period of time. After DC1.2 detects that the charger is of DCP type, during HVDCP handshake detection, the electronic device stops outputting signals to the D+ port via the PMIC and instead inputs a high level (e.g., 0.6V) to the D+ port via the SC to pull the D+ port's voltage high for one second. This ensures that the signals from the D+ and D- ports meet expectations during BC1.2 detection and HVDCP handshake detection, avoiding conflicts between the two voltage control paths. This improves the accuracy of BC1.2's detection of the charger as a DCP type and the success of the HVDCP handshake. Furthermore, after a successful HVDCP handshake, the phone can normally perform ping and anti-counterfeiting checks on the charger, thus improving the accuracy of identifying high-power fast charging and facilitating the phone's accurate entry into high-power fast charging.

[0091] In some embodiments, this application can use different voltage control modules to control the D+ and D- ports at different times during the entire charging detection process. For example, as mentioned above, the mobile phone uses the PMIC in the BC1.2 detection, while using the SC in the high-power fast charging identification process such as HVDCP handshake detection. In this case, if the anti-counterfeiting detection fails and low-power charging is identified, the mobile phone can switch to the PMIC to control the D+ and D- ports. In addition, in some embodiments, this application can use the SC to control the D+ and D- ports in the BC1.2 detection, and use the PMIC to control the D+ and D- ports in the subsequent high-power fast charging identification process. Of course, the PMIC and SC can also be switched in other ways during the charging detection process in this application, so that one of the devices in the PMIC and SC controls the D+ and D- ports at the same time. This application does not make specific limitations on this.

[0092] In some other embodiments, the present application controls the D+ port and D- port through a voltage control module in the PMIC or SC throughout the entire charging detection process, such as by continuously controlling the D+ port and D- port through the PMIC, in order to avoid conflicts in the control of the D+ port and D- port.

[0093] To further improve the success rate of HVDCP handshake, in this application, before the electronic device enters the HVDCP handshake detection, the mobile phone can trigger a charger reset. For example, the mobile phone can pull the level of the D+ port low for a period of time (e.g., 10ms) on the mobile phone side, thereby making the D+ port on the charger side also low. Then, after detecting that the D+ port on the charger side has been pulled low for this period of time, the charger can reset, shorting the D+ and D- ports of the charger. In this way, the mobile phone can perform HVDCP handshake detection when the charger's D+ and D- ports are shorted, which helps to improve the success rate of HVDCP handshake.

[0094] Furthermore, to further improve the success rate of HVDCP handshake, in some embodiments, this application can set HVDCP handshake conditions, such as: the D+ port of the mobile phone is at a high level (e.g., 0.6V) and the D- port is at a low level (0V). Specifically, during the HVDCP handshake detection process, after the mobile phone pulls the D+ port high and holds it for a period of time (e.g., 10ms), it can detect the levels of the D+ and D- ports respectively. If the HVDCP handshake conditions are met, it indicates that the HVDCP handshake is successful; otherwise, it indicates that the HVDCP handshake has failed. It can be understood that in the HVDCP handshake process, after the mobile phone pulls the D+ port high and holds it for a period of time, the mobile phone detects that the D+ port on the mobile phone side is at a high level and the D- port is at a low level, indicating that the charger has correctly disconnected the short circuit between the D+ and D- ports. Therefore, if the mobile phone detects that the above-mentioned HVDCP handshake conditions are met, it indicates that the HVDCP handshake between the mobile phone and the charger is successful. Thus, by determining the above-mentioned HVDCP handshake conditions, the accuracy of HVDCP handshake can be further improved.

[0095] Furthermore, to improve the success rate of exiting anti-counterfeiting detection, this application adds an anti-counterfeiting exit mechanism in some embodiments. Specifically, this application can set one or more anti-counterfeiting exit conditions. If the anti-counterfeiting detection fails to exit normally, and one or more anti-counterfeiting exit conditions are met, the charger can be forced to exit the anti-counterfeiting detection. This ensures that the charger can correctly exit the anti-counterfeiting detection, thereby improving the accuracy of high-power fast charging identification.

[0096] For example, this application can set an anti-counterfeiting exit condition 1, including: when the charger detects that the mobile phone has acquired the charger's charging capability, the charger exits the anti-counterfeiting process. For example, the charger can automatically exit the anti-counterfeiting detection state when it detects that the mobile phone has read the charging capability information in the charger's 0x7E register.

[0097] For example, this application can set an anti-counterfeiting exit condition 2, including: after the mobile phone sets an anti-counterfeiting encryption index for the charger, if the charger still does not exit the anti-counterfeiting detection after a preset time (e.g., 5 to 60 seconds, or 10 seconds), the charger will automatically force exit the anti-counterfeiting detection. Specifically, the charger can be pre-set with a preset anti-counterfeiting timeout timer. Then, when the mobile phone sets the anti-counterfeiting encryption index for the charger, such as when the mobile phone writes the anti-counterfeiting encryption index into the charger's register 0xCE, the charger can start the anti-counterfeiting timeout timer. During the anti-counterfeiting timeout timer's timing period, if the mobile phone writes 0xFF into the charger's register 0xCE, indicating that the mobile phone instructs the charger to exit the anti-counterfeiting detection, the charger will stop the timer and exit the anti-counterfeiting detection state. Conversely, if the anti-counterfeiting timeout timer expires, the charger can automatically force exit the anti-counterfeiting state.

[0098] Therefore, when at least one of the above exit anti-counterfeiting conditions 1 or 2 is met, the charger can set the value of the anti-counterfeiting flag to 0 or clear the anti-counterfeiting flag to trigger the charger to automatically exit the anti-counterfeiting detection.

[0099] Thus, this application improves the success rate of the mobile phone in correctly recognizing the charger, especially the standard charger, for high-power fast charging by increasing the success rate of BC1.2 detection, HVDCP handshake, and exiting anti-counterfeiting detection. This ensures that the mobile phone can correctly enter high-power fast charging after being plugged into the standard charger, thus guaranteeing charging efficiency.

[0100] It should be understood that in other embodiments, the exit conditions for anti-counterfeiting are not limited to the above-mentioned exit conditions 1 and 2, and can also be set to other conditions according to actual needs. This application embodiment does not specifically limit this.

[0101] The charging detection method provided in this application embodiment will now be described in detail with reference to the accompanying drawings. The following mainly uses a mobile phone 100 as the electronic device and a charger 200 as the power adapter as an example to illustrate the charging detection and charging process between the charger 200 and the mobile phone 100. Example 1

[0102] Reference Figure 3 The diagram shown is a flowchart illustrating a charging detection method provided in an embodiment of this application. The method includes the following steps:

[0103] 301: Phone 100 has detected that charger 200 is connected to phone 100.

[0104] 302: Mobile phone 100 performs BC1.2 detection based on PMIC and determines whether charger 200 is of type DCP.

[0105] Specifically, the BC1.2 detection performed by the mobile phone 100 based on the PMIC refers to the mobile phone 100 controlling and detecting the voltage of the D+ and D- ports on the mobile phone side through the PMIC. For example, if the mobile phone 100 applies a high level to the D+ port on the mobile phone side for a period of time and then detects that the D- port on the mobile phone side is high, and if the mobile phone 100 applies a low level to the D- port on the mobile phone side for a period of time and then detects that the D+ port on the mobile phone side is low, then the charger 200 is determined to be of the DCP type.

[0106] As is understandable, the control and detection process of the voltage of the D+ port of mobile phone 100 in step 302 is described above and will not be described in detail here.

[0107] In some implementations, when the mobile phone 100 performs BC1.2 testing, the voltage control module that controls the voltage of the D+ port and D- port in the charging port 110 is PMIC by default, but is not limited to this.

[0108] It is understood that in this application, the mobile phone 100 mainly controls the voltage of the D+ port on the mobile phone side during the charging detection process. In the following implementation, we will only explain the control of the D+ port by the PMIC or SC.

[0109] If charger 200 is detected as not being a DCP type, then step 317 is executed to enter low-power charging (such as buck charging), and during the subsequent low-power charging process, the voltages of the D+ and D- ports in phone 100 are still controlled by the PMIC. Conversely, if charger 200 is detected as being a DCP type, then step 303 is executed.

[0110] 303: Mobile phone 100 switches the voltage control module from PMIC to SC. That is, mobile phone 100 switches the voltage control module controlling the D+ and D- ports from PMIC to SC.

[0111] That is, the mobile phone 100 turns off the voltage output of the PMIC to the D+ and D- ports on the mobile phone side. For example, the port of the PMIC connected to the D+ port (denoted as port 1) is set to high configuration (hiz) or the connection between port 1 and the D+ port on the mobile phone side is disconnected, and the voltage of the D+ port is controlled by the SC.

[0112] 304: Mobile phone 100 performs HVDCP handshake with charger 200 based on SC and determines whether the HVDCP handshake is successful.

[0113] In some embodiments, the SC can control the D+ port to be high (denoted as the second level, such as 0.6V) for a second duration (such as 1s). For example, during HVDCP handshake, after the mobile phone 100 applies a high level to the D+ port on the mobile phone side for a period of time (such as 10ms), if the D- port on the mobile phone side is detected to be low, it indicates that the HVDCP handshake is successful; otherwise, if the D- port is not low, it indicates that the HVDCP handshake has failed.

[0114] If the HVDCP handshake fails, proceed to step 315 to enter low-power charging, such as buck charging. If the HVDCP handshake succeeds, proceed to step 305.

[0115] 305: Mobile phone 100 sends a ping request to charger 200.

[0116] 306: Mobile phone 100 determines whether it has received a ping response from charger 200 within the third time period.

[0117] If no ping response is received within the third time interval (i.e., the ping fails), then option 315 is executed. If a ping response is received within the third time interval (i.e., the ping succeeds), then option 307 is executed. For example, the third time interval can be 50ms. Furthermore, the specific value of the third time interval can be set according to actual needs and is not limited to the example above.

[0118] 307: Mobile phone 100 reads information from charger 200.

[0119] For example, the charger information may include charging capacity, voltage, current, etc.

[0120] In some embodiments, the mobile phone 100 sends a first instruction to the charger 200 to obtain information about the charger. For example, in response to the first instruction, the charger 200 can read the charging capability stored in the 0x7E register (i.e., the first register) and read other information such as the charger's current and voltage.

[0121] 308: Mobile phone 100 writes anti-counterfeiting key index to charger 200.

[0122] In some embodiments, the mobile phone 100 sends a second instruction to the charger 200 to write the anti-counterfeiting key index. For example, in response to the second instruction, the charger 200 may write the anti-counterfeiting key index into register 0xCE.

[0123] It is understandable that the anti-counterfeiting key index is written into register 0xCE to indicate that the charger 200 enters the anti-counterfeiting detection state.

[0124] 309: Charger 200 sets the anti-counterfeiting detection flag to the first state and enters the anti-counterfeiting detection state.

[0125] For example, the first state indicates that the charger 200 sets the value of the anti-counterfeiting detection flag to 1, or sets the anti-counterfeiting detection flag to trigger the charger 200 to enter the anti-counterfeiting detection state.

[0126] 310: Mobile phone 100 performs anti-counterfeiting detection on charger 200.

[0127] 311: Mobile phone 100 writes exit parameters to charger 200.

[0128] In some embodiments, the mobile phone 100 sends a third instruction to the charger 200 to write an exit parameter, such as 0xFF, into register 0xCE. This exit parameter is used to instruct the charger 200 to exit the anti-counterfeiting detection state.

[0129] 312: The charger 200 sets the anti-counterfeiting detection flag to the second state and exits the anti-counterfeiting detection state.

[0130] For example, the second state indicates that the charger 200 sets the value of the anti-counterfeiting detection flag to 0, or clears the anti-counterfeiting detection flag, so as to trigger the charger 200 to exit the anti-counterfeiting detection state.

[0131] 313: Mobile phone 100 determines whether the anti-counterfeiting detection is successful.

[0132] If the anti-counterfeiting detection is successful, it means the charger is a standard charger, and step 314 will be executed for high-power charging. Conversely, if the detection fails, it means the charger is a non-standard charger, and step 315 will be executed for low-power charging.

[0133] 314: The phone enters high-power fast charging mode at 100%.

[0134] 315: Mobile phone 100 switches the voltage control module from SC to PMIC and enters low-power charging. This allows mobile phone 100 to use PMIC to control the voltage of the D+ and D- ports during subsequent low-power charging, avoiding voltage control conflicts caused by using SC.

[0135] 316: The phone detected that the high-power fast charging had ended and switched the voltage control module from SC to PMIC.

[0136] This means that the phone 100 disables the voltage output of the SC to the D+ and D- ports. For example, the port connected to the D+ port (denoted as port 2) is set to a high configuration (hiz) or the connection between port 2 and the D+ port on the phone side is disconnected, allowing the PMIC to control the voltage of the D+ port. This ensures that during the next charging detection process, the phone 100 can default to using the PMIC to control the voltage of the D+ and D- ports, avoiding voltage control conflicts caused by using the SC.

[0137] 317: The phone has entered low-power charging mode at 100%.

[0138] At this time, mobile phone 100 can continuously use the PMIC to control the voltage of the D+ port and the D- port.

[0139] Therefore, in the charging detection method provided in this application, the D+ port and D- port are controlled by a voltage control module in the PMIC or SC throughout the charging detection process, thus avoiding conflicts in the control of the D+ port and D- port. This ensures the success rate of BC1.2 detection, HVDCP handshake, and other detections, and helps to improve the success rate of correctly identifying high-power fast charging. Example 2

[0140] In some embodiments, this application can further improve the success rate of HVDCP handshake, thereby increasing the success rate of correctly identifying high-power fast charging. Based on the foregoing embodiments, the following embodiments of this application further improve the HVDCP handshake-related processes of the above embodiments.

[0141] Figure 4 The diagram shown is a schematic representation of the implementation flow of the charging detection method according to an embodiment of this application. Figure 4 As shown, the process includes the following steps:

[0142] 401: Phone 100 has detected that charger 200 is connected to phone 100.

[0143] 402: Mobile phone 100 performs BC1.2 detection based on PMIC and determines whether charger 200 is of type DCP.

[0144] If it is determined that 418 is executed, then 403 is executed otherwise. For example, if the D- port on the mobile phone side is detected to be high after the mobile phone 100 applies a high level to the D+ port on the mobile phone side for a period of time, and the D+ port on the mobile phone side is detected to be low after the mobile phone 100 applies a low level to the D- port on the mobile phone side for a period of time, then the charger 200 is determined to be of type DCP.

[0145] 403: Mobile phone 100 switches the voltage control module from PMIC to SC. That is, mobile phone 100 switches the voltage control module controlling the D+ and D- ports from PMIC to SC.

[0146] Among them, 401-403 are the same as 301-303 in Embodiment 1, and will not be described again here.

[0147] 404: Mobile phone 100 applies a first voltage to the D+ port via SC and continues for a first duration.

[0148] It can be understood that when mobile phone 100 applies a first voltage to the D+ port, it means pulling the D+ port low, i.e., setting the D+ port to a low level. This first voltage is less than or equal to a first preset voltage. For example, the first preset voltage is less than or equal to 0.32V, such as 0V. Furthermore, the aforementioned first duration can be any value between 1 and 100ms, such as 10ms.

[0149] 405: Charger 200 detects that the D+ port is at the first voltage and remains at the first voltage for the first duration, and resets the charger.

[0150] Specifically, when the mobile phone 100 pulls the D+ port on the mobile phone side down to a first voltage, such as 0V, and maintains it for a first duration, since the D+ port of the charger 200 is connected to the D+ port of the mobile phone 100, as long as the pull-down function of the D+ port of the charger 200 is normal, the D+ port in the charger 200 will be pulled down to the first voltage and maintained for a first duration, thereby resetting the charger 200.

[0151] It is understood that when the D+ port of charger 200 is pulled low and held for a preset reset duration, charger 200 will automatically reset. For example, the preset reset duration can be any value between 10 and 100 ms, such as 10 ms.

[0152] In some other embodiments, in 405, the charger 200 detects that the D+ port is at a first voltage and maintains it for a period of time, which may be less than the first duration.

[0153] In some embodiments, when the charger 200 is reset, the D+ and D- ports in the charger 200 can be shorted, making both D+ and D- ports low. In this way, the charger 200 can be reset before the mobile phone 100 performs the HVDCP handshake, preventing HVDCP handshake failure due to the D+ and D- ports not being shorted, thus improving the success rate of the HVDCP handshake.

[0154] 406: Mobile phone 100 performs HVDCP handshake with charger 200 based on SC, and determines whether the HVDCP handshake is successful according to the HVDCP handshake conditions.

[0155] In some embodiments, when the mobile phone 100 performs an HVDCP handshake, it can set the D+ port to a second voltage via SC for a second duration and detect whether the HVDCP handshake conditions are met. For example, the second voltage is greater than or equal to a second preset voltage. For instance, the second preset voltage is a voltage greater than or equal to 0.6V. Furthermore, the second duration can be 0.5 to 2 seconds, such as 1 second. Specifically, the HVDCP handshake conditions include: the voltage of the D+ port of the mobile phone 100 is greater than or equal to the second preset voltage, and the voltage of the D+ port of the mobile phone 100 is less than or equal to a first preset voltage, i.e., the D+ port is at a high level and the D- port is at a low level.

[0156] In some embodiments, during the HVDCP handshake process, after the mobile phone 100 pulls the D+ port high for a period of time, the charger 200 will normally disconnect the short circuit between the D+ and D- ports. Therefore, during the HVDCP handshake process, after the mobile phone pulls the D+ port high and holds it for a period of time, the mobile phone detects that the D+ port is at a high level and the D- port is at a low level, indicating that the charger has correctly disconnected the short circuit between the D+ and D- ports. Therefore, the mobile phone detects that the above HVDCP handshake conditions are met, indicating that the HVDCP handshake between the mobile phone and the charger is successful. Thus, by determining the above HVDCP handshake conditions, the accuracy of the HVDCP handshake can be further improved.

[0157] If the HVDCP handshake fails, it will proceed to 417; otherwise, it will proceed to 407.

[0158] 407: Mobile phone 100 sends a ping request to charger 200.

[0159] 408: Mobile phone 100 checks whether it has received a ping response from charger 200 within the third time period.

[0160] If the ping fails, error 418 is executed; otherwise, error 409 is executed. If no ping response is received within the third time interval, the ping has failed. If a ping response is received within the third time interval, the ping has succeeded. For example, the third time interval can be 50ms.

[0161] 409: Mobile phone 100 reads information from charger 200.

[0162] 410: Mobile phone 100 writes anti-counterfeiting key index to charger 200.

[0163] 411: Charger 200 sets the anti-counterfeiting detection flag to the first state and enters the anti-counterfeiting detection state.

[0164] 412: Mobile phone 100 performs anti-counterfeiting detection on charger 200.

[0165] 413: Mobile phone 100 writes exit parameters to charger 200.

[0166] 414: The anti-counterfeiting detection flag of the charger 200 is in the second state, exiting the anti-counterfeiting detection state.

[0167] For example, the charger 200 sets the value of the anti-counterfeiting detection flag to 0 or clears the anti-counterfeiting detection flag to trigger the charger 200 to exit the anti-counterfeiting detection state.

[0168] 415: Did the mobile phone 100 successfully perform the anti-counterfeiting test?

[0169] If the anti-counterfeiting detection is successful, it means the charger is a standard charger, and step 416 will be executed for high-power charging. Otherwise, it means the charger is a non-standard charger, and step 417 will be executed for low-power charging.

[0170] 416: The phone enters high-power fast charging mode at 100%.

[0171] 417: Mobile phone 100 switches the voltage control module from SC to PMIC and enters low-power charging.

[0172] For example, low-power charging can charge a buck.

[0173] 418: The phone detected that the high-power fast charging had ended and switched the voltage control module from SC to PMIC.

[0174] 419: The phone has entered low-power charging mode.

[0175] The descriptions of 407-419 are the same as those of 305-317 in Example 1, and will not be repeated here.

[0176] Thus, the charging detection method provided in this application embodiment can improve the success rate of HVDCP handshake, thereby increasing the success rate of the mobile phone correctly entering high-power fast charging. Example 3

[0177] In some embodiments, this application can further improve the success rate of normal exit from anti-counterfeiting detection, thereby increasing the success rate of correctly identifying high-power fast charging. Based on the foregoing embodiments, the following embodiments of this application further improve the process related to exiting anti-counterfeiting detection in the above embodiments.

[0178] Figure 5 The diagram shown is a schematic representation of the implementation flow of the charging detection method according to an embodiment of this application. Figure 5 As shown, the process includes the following steps:

[0179] 501: Phone 100 detected that a charger was connected to the phone, or detected that Phone 100 restarted when the charger was connected to the phone but not charging.

[0180] The description of 501 above can be referred to the relevant description of 301 in Embodiment 1, and the similarities will not be repeated. The difference in 501 is that the phone 100 detects a restart when the charger 200 is plugged into the charger port 11 but not charging. For example, the phone 100 detects a restart before sending an exit parameter to the charger 200 after the charger 200 is plugged into the charger port 11. In this case, the phone 100 restarts, preventing it from sending the exit parameter to the charger 200, and the charger 200 usually cannot exit the anti-counterfeiting detection state normally. Furthermore, when the phone 100 restarts without starting to charge, it usually re-enters the charging detection process, such as entering 502.

[0181] 502: Mobile phone 100 performs BC1.2 detection based on PMIC and determines whether charger 200 is of type DCP.

[0182] If it is determined that S524 should be executed, then S503 should be executed otherwise. For example, if the D- port on the mobile phone side is detected to be high after the mobile phone 100 applies a high level to the D+ port on the mobile phone side for a period of time, and the D+ port on the mobile phone side is detected to be low after the mobile phone 100 applies a low level to the D- port on the mobile phone side for a period of time, then the charger 200 is determined to be of type DCP.

[0183] 503: Mobile phone 100 switches the voltage control module from PMIC to SC.

[0184] 504: Mobile phone 100 applies a first voltage to the D+ port via SC and continues for a first duration.

[0185] 505: Charger 200 detects that the D+ port is at the first voltage and remains at the first voltage for the first duration, and resets charger 200.

[0186] 506: Mobile phone 100 performs HVDCP handshake with charger 200 based on SC, and determines whether the HVDCP handshake is successful according to the HVDCP handshake conditions.

[0187] For example, in the HVDCP handshake process, after the mobile phone 100 pulls the D+ port high for a period of time, if the mobile phone detects that the D+ port on the mobile phone side is at a high level and the D- port is at a low level, it means that the HVDCP handshake is successful. Conversely, if the D+ port on the mobile phone side is not at a high level and the D- port is at a low level, the HVDCP handshake fails.

[0188] If the HVDCP handshake fails, S525 is executed; otherwise, 507 is entered.

[0189] 507: Mobile phone 100 sends a ping request to charger 200.

[0190] 508: Mobile phone 100 checks whether it has received a ping response from charger 200 within the third time period.

[0191] For example, the third duration is 50ms.

[0192] If the ping fails, execute S522; otherwise, execute 509.

[0193] In this embodiment, 502-508 are the same as 402-403 in Example 2, and will not be described again here. Based on 502-508, mobile phone 100 determines that charger 200 is of DCP type, HVDCP handshake is successful, and ping is successful.

[0194] 509: Mobile phone 100 sends the first instruction from charger 200 to charger 200.

[0195] The first instruction is used by the mobile phone 100 to obtain information about the charger from the charger 200, such as charging capacity, current and voltage.

[0196] 510: The charger 200 reads the charging capacity in the first register and sets the anti-counterfeiting detection flag to the second state.

[0197] For example, the first register is register 0x7E, and the second state corresponds to charger 200 exiting the anti-counterfeiting detection state. That is, in the 510, charger 100 reads register 0x7E and automatically exits the anti-counterfeiting detection state.

[0198] It is understandable that, assuming the charger 200 did not exit the anti-counterfeiting detection state during the previous charging test due to factors such as the phone 100 restarting, then under normal circumstances, the charger 200 might not be able to properly read the charger's voltage and current information during the current charging test. However, in this embodiment, when the charger 200 reads the 0x7E register, if the charger 200 is abnormally in the anti-counterfeiting detection state, the charger 200 sets the anti-counterfeiting detection flag to the second state, which triggers the charger 200 to exit the range detection state. This ensures that the charger 200 correctly returns charger information to the phone 100 and normally executes the subsequent charging test process.

[0199] In this way, even if the charger 200 cannot exit the anti-counterfeiting detection state due to a phone restart before the charging test is completed, it can be instructed to exit the anti-counterfeiting detection state after a successful ping during the subsequent re-entry of the charging test process, thus ensuring the success rate of subsequent anti-counterfeiting tests.

[0200] 511: Charger 200 reads information from the charger other than its charging capacity.

[0201] 512: Charger 200 sends charger information to mobile phone 100.

[0202] 513: Mobile phone 100 writes anti-counterfeiting key index to charger 200.

[0203] The description of 513 can be referred to the description of 308 in Embodiment 1 above. In some embodiments, the mobile phone 100 sends a second instruction to the charger 200 to enable the charger 200 to write the anti-counterfeiting key index.

[0204] 514: The charger 200 sets the anti-counterfeiting detection flag to the first state, enters the anti-counterfeiting detection state, and starts the preset timer.

[0205] The preset timer (i.e., the anti-counterfeiting timeout timer) can have a preset duration, such as 5 to 60 seconds, or 10 seconds.

[0206] 515: Mobile phone 100 and charger 200 are subject to anti-counterfeiting detection.

[0207] 516: Charger 200 checks whether the first exit condition is met.

[0208] The first exit condition includes: the charger 200 does not receive a third instruction from the mobile phone 100 within the preset timer duration, the third instruction being used to instruct the charger 200 to exit the anti-counterfeiting detection state. For example, the third instruction is used by the mobile phone 100 to write exit parameters into the charger 200, such as writing 0xFF into register 0xCE, to trigger the charger 200 to exit the anti-counterfeiting detection state.

[0209] If the first exit condition is not met, i.e., the charger receives a third instruction within the preset timer duration, then proceed to step 517 to allow the charger 200 to exit the anti-counterfeiting detection state normally. If the first exit condition is met, i.e., the charger 200 does not receive a third instruction from the mobile phone 100 within the preset timer duration, then proceed to step 518 to force the charger 200 to exit the anti-counterfeiting detection state.

[0210] 517: Charger 200 write exit parameters.

[0211] It is understandable that after the charger 200 writes the exit parameter such as 0xFF, the charger 200 can execute 519 to normally exit the detection state.

[0212] 518: Charger 200 reset the preset timer that did not stop timing.

[0213] It is understandable that if the charger 200 does not receive the third instruction from the mobile phone 100 when the preset timer reaches its preset duration, it indicates that the mobile phone 100 cannot properly instruct the charger 200 to exit the anti-counterfeiting detection state. At this time, the charger 200 can execute 519 to forcibly exit the anti-counterfeiting detection state under abnormal circumstances.

[0214] It is understandable that the charger 200 resets the preset timer so that the preset timer can be set normally when the charger 200 enters the charger identification process again.

[0215] Among them, 517 and 518 are parallel processes.

[0216] 519: The charger 200 sets the anti-counterfeiting detection flag to the second state and exits the anti-counterfeiting detection state.

[0217] For example, the charger 200 sets the value of the anti-counterfeiting detection flag to 0 or clears the anti-counterfeiting detection flag to trigger the charger 200 to exit the anti-counterfeiting detection state.

[0218] 520: Mobile phone 100 determines whether the anti-counterfeiting detection is successful.

[0219] If the anti-counterfeiting detection is successful, proceed to step 521 to enter high-power fast charging; otherwise, proceed to step 522 to enter low-power charging.

[0220] 521: The phone enters high-power fast charging mode at 100%.

[0221] 522: The phone switches the voltage control module from SC to PMIC, entering low-power charging mode.

[0222] 523: The phone has detected that the high-power fast charging has ended and will switch the voltage control module controlling the D+ and D- ports from SC to PMIC.

[0223] 524: The phone has entered low-power charging mode at 100%.

[0224] For example, low-power charging can charge a buck.

[0225] The descriptions of 509-524 are the same as those of 305-317 in Example 1, and will not be repeated here.

[0226] Thus, the charging detection method provided in this application embodiment can improve the success rate of the charger exiting the anti-counterfeiting detection state, thereby improving the success rate of the mobile phone correctly entering high-power fast charging. Example 4

[0227] In some embodiments, the overall process of the charging detection method in this application is described based on the above embodiments. Figure 6The diagram shown is a schematic representation of the implementation flow of the charging detection method according to an embodiment of this application. Figure 6 As shown, the process includes the following steps:

[0228] 601: BC1.2 test. That is, the mobile phone 100 performs a BC1.2 test on the charger 200.

[0229] 602: Determine if the charger is a DCP. That is, whether charger 200 is a DCP type.

[0230] If the charger is detected as a non-DCP type, proceed with step 617 to enter low-power charging mode, such as buck charging. If the charger is detected as a DCP type, proceed with step 602.

[0231] 603: Disable the PMIC's D+ port output and control the D+ port output via SC. That is, mobile phone 100 disables the PMIC's voltage output to the D+ and D- ports and uses the SC's voltage output from the D+ and D- ports.

[0232] 604: The D+ port is high for 10ms. That is, the D+ port on the mobile phone side is high for 10ms.

[0233] 605: Determine if the HVDCP handshake was successful. This means that the mobile phone 100 performs an HVDCP handshake with the charger 200 and determines whether the HVDCP handshake was successful.

[0234] If the HVDCP handshake fails, the phone will execute step 615 and then enter low-power charging, such as buck charging. If the HVDCP handshake succeeds, it will proceed to the charging detection step in step 605.

[0235] 606: Check if the ping was successful. This means that phone 100 performs a ping test on charger 200 to determine if the ping was successful.

[0236] If the ping fails, phone 100 executes step 615 and then enters low-power charging. If the ping succeeds, phone 100 proceeds to the subsequent charging detection steps in step 607.

[0237] 607: Get charger information. That is, phone 100 obtains information from charger 200.

[0238] In some embodiments, during the process of obtaining information about the charger 200, when the charger 200 reads the charging capacity in register 0X7E, it can exit the anti-counterfeiting detection state.

[0239] 608: Write anti-counterfeiting key index. That is, the mobile phone 100 writes the anti-counterfeiting key index for the charger 200.

[0240] In some embodiments, after the charger 200 writes the anti-counterfeiting key index into register 0xCE, it can enter the anti-counterfeiting detection state and start a preset timer.

[0241] 609: Anti-counterfeiting detection. This means that the mobile phone (100) performs an anti-counterfeiting detection on the charger (200).

[0242] 610: Exit anti-counterfeiting detection mode. That is, when the phone triggers (100), the charger (200) exits the anti-counterfeiting detection mode.

[0243] In some embodiments, the charger 200 can detect the exit parameter sent by the mobile phone 100 when the preset timer has not stopped, and exit the anti-counterfeiting detection state after writing the exit parameter into register 0xCE.

[0244] In other embodiments, the charger 200 may exit the anti-counterfeiting detection state if it does not detect the exit parameter sent by the mobile phone 100 within the time limit of a preset timer.

[0245] 611: Determine whether the anti-counterfeiting detection was successful.

[0246] After charger 200 exits the anti-counterfeiting detection state, if the anti-counterfeiting detection is successful, it will execute 612 to enter high-power fast charging; if the anti-counterfeiting detection fails, it will execute 615 to enter low-power charging.

[0247] 612: Entering high-power fast charging. This means the phone has entered high-power fast charging mode.

[0248] 613: Charging complete. This means the phone has detected the end of high-power fast charging.

[0249] 614: Disable the D+ port output of the SC and have the PMIC control the D+ port output. For example, phone 100 disables the voltage output of the SC to the D+ and D- ports and uses the voltage output of the PMIC to the D+ and D- ports. This allows phone 100 to default to using the PMIC to control the voltage of the D+ and D- ports during the next charging detection process.

[0250] 615: Disable the D+ port output of the SC and control the D+ port output via the PMIC. For example, phone 100 disables the voltage output of the SC to the D+ and D- ports and uses the voltage output of the PMIC to the D+ and D- ports. This allows phone 100 to use the PMIC to control the voltage of the D+ and D- ports during subsequent buck charging.

[0251] 616: Entering low-power charging. That is, mobile phone 100 enters low-power charging. At this time, mobile phone 100 enters low-power charging when the voltage control module switches from SC to PMIC.

[0252] 617: Entering low-power charging. That is, phone 100 enters low-power charging. At this time, phone 100 enters low-power charging while maintaining the voltage control module as PMIC.

[0253] The descriptions of 601-617 above can be referenced to the descriptions of 201-212 above; the similarities will not be repeated. The difference lies in the addition of steps 603, 604, 614, 615, and steps related to charger 200 exiting anti-counterfeiting detection. Based on these differentiated steps, the success rate of BC1.2 detection, HVDCP handshake, and exiting anti-counterfeiting detection can be improved.

[0254] Thus, this embodiment of the application can improve the success rate of correctly identifying the charger for high-power fast charging by increasing the success rate of BC1.2 detection, HVDCP handshake, ping detection, and anti-counterfeiting detection in charging detection, thereby ensuring that the mobile phone has high charging efficiency. This reduces the charger's false identification rate and improves charging speed and charging experience.

[0255] Next, taking a mobile phone as an example, we will describe the hardware structure of electronic devices.

[0256] like Figure 7 The diagram shown is a structural schematic of a mobile phone according to an embodiment of this application. The mobile phone 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0257] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the mobile phone 100. In other embodiments of this application, the mobile phone 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0258] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0259] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0260] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0261] USB interface 130 is an interface compliant with the USB standard specification, specifically a Mini USB interface, Micro USB interface, USB Type-C interface, etc. USB interface 130 can be used to connect a charger to charge mobile phone 100, and can also be used for data transfer between mobile phone 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices. Specifically, USB interface 130 may include D+ ports and D- ports, etc.

[0262] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the mobile phone 100. In other embodiments of this application, the mobile phone 100 may also adopt different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0263] The charging management module 140 receives charging input from a charger (or power adapter). The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via a USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the mobile phone 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.

[0264] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device. For example, the power management module 141 may include a PMIC and an SC for controlling the voltage of the D+ and D- ports in the USB interface 130. For example, this application can perform a charging detection process through the processor 110, specifically controlling the power management module 141 to charge the charger, such as identifying high-power fast charging.

[0265] The wireless communication function of mobile phone 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0266] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in mobile phone 100 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.

[0267] The mobile communication module 150 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the mobile phone 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0268] The wireless communication module 160 can provide solutions for wireless communication applications on the mobile phone 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0269] In some embodiments, antenna 1 of mobile phone 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling mobile phone 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0270] The mobile phone 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0271] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the mobile phone 100 may include one or N displays screens 194, where N is a positive integer greater than 1.

[0272] The mobile phone 100 can achieve shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0273] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, mobile phone 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0274] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0275] The internal memory 121 can be used to store computer executable program code, which includes instructions. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.). The data storage area may store data created during the use of the mobile phone 100 (such as audio data, phonebook, etc.). Furthermore, the internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the mobile phone 100 by running instructions stored in the internal memory 121 and / or instructions stored in memory located in the processor.

[0276] The audio module 170 may include a speaker, a receiver, a microphone, a headphone jack, and an application processor. The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.

[0277] Keypad 190 includes a power button, volume buttons, etc. Keypad 190 can be a mechanical keypad or a touch keypad. Mobile phone 100 can receive keypad input and generate key signal inputs related to user settings and function control of mobile phone 100.

[0278] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback.

[0279] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.

[0280] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with or separate from the mobile phone 100. The mobile phone 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1.

[0281] Next, taking a power adapter as an example, we will describe the structure of the charger.

[0282] like Figure 8 The diagram shown is a structural schematic of a charger provided in an embodiment of this application.

[0283] Processor 1101, memory 1102, and communication interface 1103. For example, processor 1101, memory 1102, and communication interface 1103 can be connected via line 1104.

[0284] The processor 1101 is used to read information from the charger, write the anti-counterfeiting key index, write exit parameters, and set anti-counterfeiting detection flags. The memory 1102 includes registers 0x7E and 0xCE, which are used to store the charger 200's charging capability, anti-counterfeiting key index, and exit parameters. The communication interface 1103 can be a USB interface, such as a USB Type-C interface. The communication interface 1103 can be used to connect to and charge the mobile phone 100, and can also transmit data with the mobile phone 100, such as transmitting charging capability, anti-counterfeiting key index, and exit parameters. For example, the communication interface 1103 may include a D+ port and a D- port. Of course, this structure may also include other discrete components, which are not specifically limited in this embodiment.

[0285] This application also provides a computer storage medium that includes computer instructions. When the computer instructions are executed on the electronic device, the electronic device causes the electronic device to perform various functions or steps performed by the mobile phone in the above method embodiment.

[0286] This application also provides a computer program product that, when run on a computer, causes the computer to perform the various functions or steps performed by the mobile phone in the above method embodiments.

[0287] Various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or combinations of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0288] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0289] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0290] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on or on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, optical discs, read-only memory, magneto-optical disks, random access memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other propagation signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0291] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0292] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0293] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0294] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.

Claims

1. A charge detection method characterized by, The method is applied to an electronic device, and the method comprises the following steps: detecting that a power adapter is inserted into a first charging port of the electronic device, the first charging port comprising first charging protocol communication pins, the first charging protocol communication pins comprising a first D+ port and a first D- port; the power adapter comprising a second charging port, the second charging port comprising second charging protocol communication pins, the second charging protocol communication pins comprising a second D+ port and a second D- port; in correspondence with the second charging port being inserted into the first charging port, the first D+ port is connected to the second D+ port and the first D- port is connected to the second D- port; performing first charging detection on the power adapter to identify whether the power adapter is of a first type, wherein, in the first charging detection, the voltage of the first charging protocol communication pins is controlled by a first voltage control module, and the first type is a dedicated charging port (DCP) type; in correspondence with detecting that the power adapter is of the first type, controlling the voltage of the first D+ port to be a first voltage by a second voltage control module for a first time duration, so that the power adapter is reset, wherein the first voltage is less than or equal to a first preset voltage; and after the power adapter is reset, the second D+ port and the second D- port are short-circuited; wherein the first voltage control module and the second voltage control module are different; and the first voltage control module is a power management integrated circuit (PMIC) or a control circuit (SC) in the electronic device, and the second voltage control module is the SC or the PMIC; in correspondence with detecting that the power adapter is of the first type, performing second charging detection on the power adapter, wherein, in the second charging detection, the voltage of the first charging protocol communication pins is controlled by the second voltage control module, and the second charging detection comprises performing high-voltage charging handshake on the power adapter.

2. The method of claim 1, wherein, The second charging detection further comprises at least one of the following: performing ping detection on the power adapter, obtaining information of the power adapter, controlling the power adapter to enter an anti-counterfeiting detection state, performing anti-counterfeiting detection on the power adapter, and controlling the power adapter to exit the anti-counterfeiting detection state.

3. The method of claim 2, wherein, The method further comprises: in correspondence with the first voltage control module being different from the second voltage control module, detecting that a switching condition is met, and switching the voltage control module for controlling the first charging protocol communication pins from the second voltage control module to the first voltage control module; wherein the switching condition comprises at least one of the following: failing to perform high-voltage charging handshake on the power adapter, successfully performing high-voltage charging handshake on the power adapter and failing in ping detection, successfully performing high-voltage charging handshake on the power adapter, successfully performing ping detection, and failing in anti-counterfeiting detection.

4. The method of claim 2, wherein, The method further comprises: corresponding to performing a high-voltage charging handshake on the power adapter, controlling, by the second voltage control module, the voltage of the first D+ port to be a second voltage for a second time duration, and detecting whether a high-voltage charging handshake condition is met, wherein the high-voltage charging handshake condition comprises: the voltage of the first D+ port is greater than or equal to a second preset voltage and the voltage of the first D- port is less than or equal to a first preset voltage.

5. The method of claim 2, wherein, The information of the power adapter comprises: sending a first instruction to the power adapter, wherein the first instruction is used to acquire the information of the power adapter, and the first instruction is used to instruct the power adapter to exit the anti-fake detection state, and the information of the power adapter comprises the charging capability of the power adapter.

6. The method of claim 2, wherein, The method further comprises: sending a second instruction to the power adapter, wherein the second instruction is used to instruct the power adapter to enter the anti-fake detection state, and the second instruction is also used to instruct the power adapter to exit the anti-fake detection state when a first exit condition is met; The first exit condition comprises: the power adapter does not receive a third instruction sent by the electronic device within a timing duration of a preset timer, and the third instruction is used to instruct the power adapter to exit the anti-fake detection state.

7. The method of claim 6, wherein, The method further comprises: sending the third instruction to the power adapter, the third instruction is used to instruct the power adapter to close the preset timer that has not stopped timing and exit the anti-fake detection state.

8. The method according to any one of claims 2 to 7, characterized in that, The method further comprises: corresponding to that the anti-fake detection on the power adapter is successful and the power adapter exits the anti-fake detection state, charging by the power adapter according to a first power; wherein the power adapter is a standard power adapter of the electronic device.

9. The method of claim 3, wherein, The method further comprises: corresponding to that the anti-fake detection on the power adapter fails and the power adapter exits the anti-fake detection state, or that the switching condition is met, charging by the power adapter according to a second power.

10. The method of claim 8, wherein, The method further comprises: corresponding to that the first voltage control module and the second voltage control module are different, detecting that the electronic device ends charging according to the first power, and switching the voltage control module of the first charging protocol communication pin from the second voltage control module to the first voltage control module.

11. A charge detection method characterized by, Applied to a power adapter, the power adapter comprises a second charging port, the second charging port comprises a second charging protocol communication pin, the second charging protocol communication pin comprises a second D+ port and a second D- port; The method comprises: detecting that the second charging port is inserted into a first charging port of an electronic device, wherein the first charging port comprises a first charging protocol communication pin, and the first charging protocol communication pin comprises a first D+ port and a first D- port; corresponding to that the second charging port is inserted into the first charging port, the first D+ port is connected to the second D+ port and the first D- port is connected to the second D- port; corresponding to the power adapter being a first type, detecting that a voltage of the second D+ port is a first voltage, and resetting the power adapter for a first duration, wherein the first voltage of the second D+ port is applied by the first voltage of the first D+ port, the first voltage is less than or equal to a first preset voltage, and the first type is a dedicated charging port (DCP) type; and corresponding to the power adapter being reset, the second D+ port being shorted with the second D- port; wherein the first voltage of the first D+ port is a voltage applied to the first D+ port by a second voltage control module in the electronic device after the electronic device performs a first charging detection and before the electronic device performs a second charging detection, the first charging detection is used to identify whether the power adapter is the first type, a voltage of the first charging protocol communication pin in the first charging detection is controlled by a first voltage control module in the electronic device, a voltage of the first charging protocol communication pin in the second charging detection is controlled by the second voltage control module, the second charging detection includes performing a high-voltage charging handshake on the power adapter, the first voltage control module and the second voltage control module are different, and the first voltage control module is a power management integrated circuit (PMIC) or a control circuit (SC) in the electronic device, and the second voltage control module is the SC or the PMIC.

12. The method of claim 11, wherein, The method further includes: receiving a first instruction sent by the electronic device; in response to the first instruction, reading information of the power adapter, and exiting the anti-fake detection state, the information of the power adapter including charging capability of the power adapter.

13. The method of claim 12, wherein, The method includes: receiving a second instruction sent by the electronic device; in response to the second instruction, entering the anti-fake detection state, and controlling a preset timer to start timing; detecting whether a first exit condition is met; corresponding to the first exit condition being met, exiting the anti-fake detection state; wherein the first exit condition includes that a third instruction sent by the electronic device is not received within a timing duration of the preset timer, the third instruction being used to instruct the power adapter to exit the anti-fake detection state.

14. The method of claim 13, wherein, The method further includes: corresponding to the first exit condition not being met, exiting the anti-fake detection state, and closing the preset timer that has not stopped timing.

15. The method of claim 14, wherein: the first instruction is used to instruct the electronic device to read charging capability of the power adapter from a first register of the power adapter; the second instruction is used to instruct the electronic device to write an anti-fake key index into a second register of the power adapter; the third instruction is used to instruct the electronic device to write an exit parameter into the second register, the exit parameter being used to instruct the power adapter to exit the anti-fake detection state.

16. The method according to any one of claims 13 to 15, characterized in that, The entering of the anti-fake detection state is achieved by: setting a forgery detection flag bit in the power adapter to a first state, the first state corresponding to the power adapter entering a forgery detection state; the exiting of the forgery detection state is achieved by: setting the forgery detection flag bit in the power adapter to a second state, the second state corresponding to the power adapter exiting the forgery detection state.

17. An electronic device, comprising: comprising: a memory for storing instructions executed by one or more processors of an electronic device, and a processor, one of the processors of the electronic device, for executing the charging detection method of any one of claims 1 to 10.

18. A power adapter, comprising: comprising: a memory for storing instructions executed by one or more processors of a power adapter, and a processor, one of the processors of the power adapter, for executing the charging detection method of any one of claims 11 to 16.

19. A charging system, characterized by the charging system comprises the electronic device of claim 17 and the power adapter of claim 18, the power adapter being configured to charge the electronic device.

Citation Information

Patent Citations

  • Mobile power bank leasing system

    CN110009820A

  • Charging control method and device, terminal equipment and storage medium

    CN115441528A