[go: up one dir, main page]

CN115576877A - Charging method, terminal device and storage medium - Google Patents

Charging method, terminal device and storage medium Download PDF

Info

Publication number
CN115576877A
CN115576877A CN202110684978.4A CN202110684978A CN115576877A CN 115576877 A CN115576877 A CN 115576877A CN 202110684978 A CN202110684978 A CN 202110684978A CN 115576877 A CN115576877 A CN 115576877A
Authority
CN
China
Prior art keywords
type
external device
connection line
charging
adapter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110684978.4A
Other languages
Chinese (zh)
Inventor
李志杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202110684978.4A priority Critical patent/CN115576877A/en
Publication of CN115576877A publication Critical patent/CN115576877A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

本申请实施例公开了一种充电方法、终端设备及存储介质,所述方法包括:在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型;若连接线类型为调试线,且外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对USB接口的引脚的控制;同时启动第一定时器;在超出第一定时器的运行时间之后,禁止PMIC对USB接口的引脚的控制;激活适配器,以建立快充通信。

Figure 202110684978

The embodiment of the present application discloses a charging method, a terminal device, and a storage medium. The method includes: when establishing a connection with an external device, determining the connection type of the connection line with the external device; if the connection line type is debugging line, and the device type of the external device is an adapter, then the pins of the USB interface are set to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; start the first timer at the same time; After the running time, disable the PMIC's control of the pins of the USB interface; activate the adapter to establish fast charge communication.

Figure 202110684978

Description

充电方法、终端设备及存储介质Charging method, terminal device and storage medium

技术领域technical field

本发明涉及充电技术领域,尤其涉及一种充电方法、终端设备及存储介质。The present invention relates to the technical field of charging, in particular to a charging method, terminal equipment and a storage medium.

背景技术Background technique

基于微控制单元(Microcontroller Unit,MCU)实现快充的方式,印制电路板(Printed Circuit Board,PCB)布置一颗外置快充控制芯片,简称快充MCU,该MCU用于控制快充的逻辑实现。在高通的8350平台,充电控制模块移植到模拟数字信号处理芯片(AnalogDigital Singal Processor,ADSP)子系统中,为节省成本,需将MCU的芯片给去除掉,快充通信数据的硬件收发逻辑由集成到PM8350B的VOOCPHY物理层来实现。Based on the method of fast charging by the Microcontroller Unit (MCU), an external fast charging control chip is arranged on the printed circuit board (PCB), referred to as the fast charging MCU, which is used to control the fast charging. logic implementation. On Qualcomm's 8350 platform, the charging control module is transplanted into the analog digital signal processing chip (AnalogDigital Signal Processor, ADSP) subsystem. In order to save costs, the MCU chip needs to be removed. To achieve the VOOCPHY physical layer of PM8350B.

然而,基于ADSP与VOOCPHY结合的快充方式虽然能够节省成本,但是由于硬件方案的改动,存在DEBUG线干扰快充通信的问题,使得DEBUG线无法支持快充功能,降低了充电性能和充电效率。However, although the fast charging method based on the combination of ADSP and VOOPPHY can save costs, due to the change of the hardware solution, there is a problem that the DEBUG line interferes with the fast charging communication, making the DEBUG line unable to support the fast charging function, which reduces the charging performance and charging efficiency.

发明内容Contents of the invention

本申请实施例提供了一种充电方法、终端设备及存储介质,能够保证语音业务的成功建立,提高了语音业务的可靠性。The embodiment of the present application provides a charging method, a terminal device and a storage medium, which can ensure the successful establishment of a voice service and improve the reliability of the voice service.

本申请实施例的技术方案是这样实现的:The technical scheme of the embodiment of the application is realized in this way:

第一方面,本申请实施例提供了一种充电方法,所述方法包括:In a first aspect, an embodiment of the present application provides a charging method, the method comprising:

在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型;When establishing a connection with an external device, determine the connection line type of the connection line with the external device;

若所述连接线类型为调试线,且所述外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动第一定时器;If the connection line type is a debugging line, and the device type of the external device is an adapter, then the pins of the USB interface are set to a high-impedance state, to prohibit USBPHY from controlling the pins of the USB interface; simultaneously start first timer;

在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制;After exceeding the running time of the first timer, prohibiting the PMIC from controlling the pins of the USB interface;

激活所述适配器,以建立快充通信。Activate the adapter to establish fast charge communication.

第二方面,本申请实施例提供了一种终端设备,所述终端设备包括:确定单元,设置单元,禁止单元,激活单元,In the second aspect, the embodiment of the present application provides a terminal device, the terminal device includes: a determining unit, a setting unit, a prohibiting unit, an activating unit,

所述确定单元,用于在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型;The determination unit is configured to determine the connection line type of the connection line with the external device when establishing a connection with the external device;

所述设置单元,用于若所述连接线类型为调试线,且所述外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动第一定时器;The setting unit is configured to set the pins of the USB interface to a high-impedance state if the connection line type is a debugging line, and the device type of the external device is an adapter, so as to prohibit the USBPHY from controlling the USB interface. Pin control; start the first timer at the same time;

所述禁止单元,用于在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制;The prohibition unit is configured to prohibit the PMIC from controlling the pins of the USB interface after exceeding the running time of the first timer;

所述激活单元,用于激活所述适配器,以建立快充通信。The activation unit is configured to activate the adapter to establish fast charging communication.

第三方面,本申请实施例提供了一种终端设备,所述终端设备包括处理器、存储有所述处理器可执行指令的存储器,当所述指令被所述处理器执行时,实现如第一方面所述的充电方法。In a third aspect, an embodiment of the present application provides a terminal device, the terminal device includes a processor and a memory storing instructions executable by the processor, and when the instructions are executed by the processor, the following is implemented: In one aspect, the charging method.

第四方面,本申请实施例提供了一种计算机可读存储介质,其上存储有程序,所述程序被处理器执行时,实现如第一方面所述的充电方法。In a fourth aspect, the embodiment of the present application provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the charging method as described in the first aspect is implemented.

本申请实施例提供了一种充电方法、终端设备及存储介质,在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型;若连接线类型为调试线,且外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对USB接口的引脚的控制;同时启动第一定时器;在超出第一定时器的运行时间之后,禁止PMIC对USB接口的引脚的控制;激活适配器,以建立快充通信。由此可见,在本申请的实施例中,终端可以对外接设备对应的设备类型、连接线类型进行确定,从而可以根据设备类型和连接线类型进一步确定是否禁止USBPHY和PMIC对D+、D-的控制。具体地,在确定外接设备为适配器,外接设备与终端通过DEBUG线连接,且不为无线充电之后,终端可以选择禁止USBPHY和PMIC控制D+、D-,保证仅VOOCPHY能够控制D+、D-,从而可以避免DEBUG线干扰快充通信,能够满足支持使用DEBUG线进行快充的需求,大大提高了充电性能和充电效率。The embodiment of the present application provides a charging method, a terminal device, and a storage medium. When establishing a connection with an external device, determine the type of the connection line connected to the external device; if the type of the connection line is a debugging line, and the external device If the device type is an adapter, set the pins of the USB interface to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; start the first timer at the same time; after exceeding the running time of the first timer, prohibit PMIC controls the pins of the USB interface; activates the adapter to establish fast charging communication. It can be seen that, in the embodiment of the present application, the terminal can determine the device type and connection line type corresponding to the external device, so that it can further determine whether to prohibit USBPHY and PMIC from connecting D+ and D- according to the device type and connection line type. control. Specifically, after determining that the external device is an adapter, the external device is connected to the terminal through a DEBUG line, and does not perform wireless charging, the terminal can choose to prohibit USBPHY and PMIC from controlling D+ and D-, so that only VOOPPHY can control D+ and D-, thereby It can avoid the DEBUG line from interfering with the fast charging communication, and can meet the demand of supporting the use of the DEBUG line for fast charging, greatly improving the charging performance and charging efficiency.

附图说明Description of drawings

图1为本申请实施例中快充通信流程示意图;Figure 1 is a schematic diagram of the fast charging communication process in the embodiment of the present application;

图2为MCU方式实现快充的原理示意图;Figure 2 is a schematic diagram of the principle of fast charging in the MCU mode;

图3为ADSP与VOOCPHY结合的方式实现快充的原理示意图;Figure 3 is a schematic diagram of the principle of fast charging realized by combining ADSP and VOOPPHY;

图4为本申请实施例提出的充电方法的实现流程示意图一;FIG. 4 is a schematic diagram of the implementation flow of the charging method proposed in the embodiment of the present application;

图5为TYPE-C的引脚接口的示意图;Figure 5 is a schematic diagram of the pin interface of TYPE-C;

图6为电阻连接情况的示意图;Fig. 6 is the schematic diagram of resistance connection situation;

图7为本申请实施例提出的充电方法的实现流程示意图二;FIG. 7 is a second schematic diagram of the implementation flow of the charging method proposed in the embodiment of the present application;

图8为本申请实施例提出的充电方法的实现流程示意图三;FIG. 8 is a schematic diagram of the third implementation flow of the charging method proposed in the embodiment of the present application;

图9为本申请实施例提出的充电方法的实现流程示意图四;FIG. 9 is a schematic diagram 4 of the implementation flow of the charging method proposed in the embodiment of the present application;

图10为本申请实施例提出的充电方法的实现流程示意图五;FIG. 10 is a schematic diagram of the fifth implementation flow of the charging method proposed in the embodiment of the present application;

图11为本申请实施例提出的充电方法的实现流程示意图六;FIG. 11 is a schematic diagram of the implementation flow of the charging method proposed in the embodiment of the present application VI;

图12为本申请实施例提出的终端设备的组成结构示意图一;FIG. 12 is a first schematic diagram of the composition and structure of the terminal device proposed in the embodiment of the present application;

图13为本申请实施例提出的终端设备的组成结构示意图二。FIG. 13 is a second schematic diagram of the composition and structure of the terminal device proposed in the embodiment of the present application.

具体实施方式detailed description

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。可以理解的是,此处所描述的具体实施例仅用于解释相关申请,而非对该申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关申请相关的部分。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific embodiments described here are only used to explain the related application, not to limit the application. It should also be noted that, for the convenience of description, only the parts related to the relevant application are shown in the drawings.

除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application, and are not intended to limit the present application.

在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。还需要指出,本申请实施例所涉及的术语“第一\第二\第三”仅是用于区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。In the following description, references to "some embodiments" describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or a different subset of all possible embodiments, and Can be combined with each other without conflict. It should also be pointed out that the term "first\second\third" involved in the embodiment of the present application is only used to distinguish similar objects, and does not represent a specific ordering of objects. Understandably, "first\second\ The specific order or sequence of "third" can be interchanged where allowed, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein.

目前,常见的快充技术主要包括5V/6A的VOOC3.0闪充技术,65W的SUPERVOOC2.0快充技术,125W的基于快速充电技术规范(Programmable Power Supply,PPS)的快充技术。Currently, common fast charging technologies mainly include 5V/6A VOOC3.0 flash charging technology, 65W SUPERVOOC2.0 fast charging technology, and 125W fast charging technology based on Programmable Power Supply (PPS).

终端在进行快速充电时,需要通过定制的适配器和电池来实现闪充的功能,一般情况下,用于闪充的适配器中配置有微控制单元(Microcontroller Unit,MCU)智能芯片,因此该适配器为可以升级的智能充电器。When the terminal is performing fast charging, it needs to use a customized adapter and battery to realize the flash charging function. Generally, the adapter used for flash charging is equipped with a Microcontroller Unit (MCU) smart chip, so the adapter is A smart charger that can be upgraded.

进一步地,在本申请的实施例中,图1为本申请实施例中快充通信流程示意图,如图1所示。适配器在对终端进行快速充电的过程主要可以包括以下五个阶段:Further, in the embodiment of the present application, FIG. 1 is a schematic diagram of the fast charging communication flow in the embodiment of the present application, as shown in FIG. 1 . The process of fast charging the terminal by the adapter can mainly include the following five stages:

阶段1:终端检测适配器类型,适配器开启适配器与终端之间的握手通信,适配器发送一指令询问终端是否开启快速充电模式,当终端同意开启快充后,快充通信流程进入阶段2。Phase 1: The terminal detects the adapter type, the adapter starts the handshake communication between the adapter and the terminal, the adapter sends a command to ask the terminal whether to enable the fast charging mode, and when the terminal agrees to enable fast charging, the fast charging communication process enters phase 2.

其中,终端可以通过D+、D-检测适配器类型,当检测到适配器为非通过通用串行总线(Universal Serial Bus,USB)类型的充电装置时,则终端吸收的电流可以大于一个预设电流值I2。当适配器检测到预设时长内适配器输出电流大于或等于I2时,则适配器认为终端对于适配器类型识别已经完成,适配器开启适配器与终端之间的握手通信,适配器发送指令询问终端是否开启快速充电模式。当适配器收到终端的回复指令指示终端不同意开启快速充电模式时,则再次检测适配器的输出电流,当适配器的输出电流仍然大于或等于I2时,再次发起请求,询问终端是否开启快速充电模式,重复阶段1的上述步骤,直到终端答复同意开启快速充电模式,或适配器的输出电流不再满足大于或等于I2的条件。Wherein, the terminal can detect the adapter type through D+ and D-, and when it is detected that the adapter is a charging device that does not pass through the Universal Serial Bus (USB) type, the current absorbed by the terminal can be greater than a preset current value I2 . When the adapter detects that the adapter output current is greater than or equal to I2 within the preset time period, the adapter considers that the terminal has completed the identification of the adapter type, the adapter starts the handshake communication between the adapter and the terminal, and the adapter sends an instruction to ask the terminal whether to enable the fast charging mode. When the adapter receives a reply command from the terminal indicating that the terminal does not agree to enable the fast charging mode, it detects the output current of the adapter again, and when the output current of the adapter is still greater than or equal to I2, it initiates a request again to ask the terminal whether to enable the fast charging mode. Repeat the above steps in phase 1 until the terminal replies and agrees to turn on the fast charging mode, or the output current of the adapter no longer satisfies the condition of being greater than or equal to I2.

阶段2:适配器向终端发送又一指令,询问适配器的输出电压是否匹配,终端答复适配器其输出电压偏高、偏低或匹配后,适配器调整输出电压,直到输出电压合适。Stage 2: The adapter sends another instruction to the terminal, asking whether the output voltage of the adapter matches, and the terminal replies that the output voltage of the adapter is high, low or matched, and the adapter adjusts the output voltage until the output voltage is suitable.

其中,适配器输出的电压可以包括多个档位,适配器可以向终端发送指令询问终端述适配器的输出电压是否适合作为快速充电模式下的充电电压,如果适配器接收到终端关于适配器的输出电压偏高或偏低的反馈时,则适配器将其输出电压调整一格档位,并再次向终端发送指令,重新询问终端适配器的输出电压是否匹配。Wherein, the voltage output by the adapter can include multiple gears, and the adapter can send an instruction to the terminal to ask the terminal whether the output voltage of the adapter is suitable as the charging voltage in the fast charging mode. When the feedback is low, the adapter adjusts its output voltage by one gear, and sends an instruction to the terminal again, asking whether the output voltage of the terminal adapter matches.

阶段3:适配器向终端发送再一指令,询问终端当前支持的最大充电电流,终端答复适配器最大充电电流,并进入阶段4。Stage 3: The adapter sends another instruction to the terminal, asking the terminal for the maximum charging current currently supported by the terminal, and the terminal replies with the maximum charging current of the adapter, and enters stage 4.

阶段4:适配器可以设置输出电流为终端当前支持的最大充电电流,进入恒流阶段,即阶段5。Stage 4: The adapter can set the output current to the maximum charging current currently supported by the terminal, and enter the constant current stage, that is, stage 5.

阶段5:当进入恒流阶段时,适配器可以每间隔一段时间发送一次另一指令,询问终端电池的当前电压,终端可以向适配器反馈终端电池的当前电压,适配器可以根据终端关于终端电池的当前电压的反馈,判断接触是否良好以及是否需要降低终端当前的充电电流值。Stage 5: When entering the constant current stage, the adapter can send another command at intervals to inquire about the current voltage of the terminal battery, and the terminal can feed back the current voltage of the terminal battery to the adapter, and the adapter can use the current voltage of the terminal battery according to the current voltage of the terminal battery. Feedback to judge whether the contact is good and whether it is necessary to reduce the current charging current value of the terminal.

需要说明的是,恒流阶段并非指适配器的输出电流在阶段5一直保持不变,所谓恒流是分段恒流,即在一段时间内保持不变。It should be noted that the constant current stage does not mean that the output current of the adapter remains constant in stage 5. The so-called constant current refers to segmental constant current, that is, it remains constant for a period of time.

基于MCU实现快充方案其因为有两级开关,其硬件上切断了USBPHY控制D+、D-的通路,因此当其接的是DEBUG线时,不用做特殊处理而能快充,其中,图2为MCU方式实现快充的原理示意图,如图2所示,中央处理器(Central Processing Unit,CPU)直接控制平台电源管理IC(Power Management IC,PMIC)进行充电:CPU直接通过系统电源管理接口(SystemPower Management Interface,SPMI)总线来操作平台PMIC的寄存器控制普充充电,模拟数字信号处理芯片(Analog Digital Singal Processor,ADSP)中只有音频模块,通过应用处理器(Application Processor,AP)跟ADSP通信链路GLINK总线和CPU交换数据。The fast charging solution based on MCU has a two-stage switch, and its hardware cuts off the access of USBPHY to control D+ and D-. Therefore, when it is connected to the DEBUG line, it can be fast charged without special processing. Among them, Figure 2 It is a schematic diagram of the principle of fast charging in the MCU mode, as shown in Figure 2, the central processing unit (Central Processing Unit, CPU) directly controls the platform power management IC (Power Management IC, PMIC) to charge: the CPU directly through the system power management interface ( SystemPower Management Interface, SPMI) bus to operate platform PMIC registers to control general charging, analog digital signal processing chip (Analog Digital Signal Processor, ADSP) only audio module, through the application processor (Application Processor, AP) and ADSP communication link The GLINK bus exchanges data with the CPU.

在通过MCU方式实现快充时,当未接适配器,也即VBUS=0时,开关1控制SW1,其默认接到SW2,软件初始化时会将开关2控制SW2打到串口控制器上,这样当终端直接连接串口线时就能默认从D+、D-上输出串口log;当接适配器上电时,会将快关1控制SW1打到平台PMIC上,待ASPD识别到充电器类型为BC1.2(Battery Charging v1.2)的专用充电端口(Dedicated Charging Port,DCP)时,软件上设置开关1控制SW1打到SW2上,同时设置开关2控制SW2打到MCU上,从而使得MCU<---->SW2<---->SW1<---->适配器直接通过D+、D-直连通信了,由于快充开关1控制SW1切到SW2,因此PMIC和USBPHY都干扰不了快充通信,同时开关2控制SW2切到MCU上因此,串口输出也干扰不了快充通信。When implementing fast charging through MCU, when the adapter is not connected, that is, when VBUS=0, switch 1 controls SW1, which is connected to SW2 by default. When the software is initialized, switch 2 controls SW2 to the serial port controller. When the terminal is directly connected to the serial port line, the serial port log can be output from D+ and D- by default; when the adapter is connected to power, the quick switch 1 control SW1 will be switched to the platform PMIC, and the charger type is BC1.2 after the ASPD recognizes it. (Battery Charging v1.2) dedicated charging port (Dedicated Charging Port, DCP), set switch 1 on the software to control SW1 to switch to SW2, and set switch 2 to control SW2 to switch to MCU, so that MCU<--- ->SW2<---->SW1<---->The adapter directly communicates through D+ and D-. Since the fast charging switch 1 controls SW1 to switch to SW2, neither PMIC nor USBPHY can interfere with the fast charging communication. At the same time, switch 2 controls SW2 to switch to the MCU. Therefore, the serial port output will not interfere with the fast charging communication.

基于MCU式的快充方案,PCB布置一颗外置快充控制芯片,简称快充MCU,该MCU用于控制快充的逻辑实现。在高通的8350平台,充电控制模块移植到ADSP子系统中,为节省成本,需将MCU的芯片给去除掉,快充通信数据的硬件收发逻辑由集成到PM8350B的VOOCPHY物理层来实现。Based on the MCU-style fast charging solution, an external fast charging control chip is arranged on the PCB, referred to as the fast charging MCU, which is used to control the logic implementation of fast charging. On Qualcomm's 8350 platform, the charging control module is transplanted into the ADSP subsystem. In order to save costs, the MCU chip needs to be removed, and the hardware sending and receiving logic of fast charging communication data is realized by the VOOPPHY physical layer integrated into PM8350B.

图3为ADSP与VOOCPHY结合的方式实现快充的原理示意图,如图3所示,ADSP子系统直接控制充电模块,具体地,ADSP子系统控制PM8350B相关的充电逻辑,PM8350、VOOCPHY、USBPHY均集成在ADSP上,ADSP通过GLINK总线来交互充电状态信息和USB相关状态信息。与MCU式的快充方案相比,ADSP与VOOCPHY结合的快充方案硬件开关只有开关1,也即当VBUS没电时打到串口模块,当VBUS有电时打到PM8350、VOOCPHY、USBPHY共有的端口上。这样的逻辑架构导致,即使在快充时,PMIC和USBPHY也能控制D+、D-数据通信,如果是接的是DEBUG线,因为硬件上未断开,DEBUG线干扰快充通信,适配器通过D+、D-发过来的信息会干扰成半高电平,导致VOOCPHY收到的数据不对而无法进行快充。Figure 3 is a schematic diagram of the principle of fast charging realized by combining ADSP and VOOPPHY. As shown in Figure 3, the ADSP subsystem directly controls the charging module. Specifically, the ADSP subsystem controls the charging logic related to PM8350B. PM8350, VOOPPHY, and USBPHY are all integrated On the ADSP, the ADSP exchanges charging status information and USB related status information through the GLINK bus. Compared with the MCU-style fast charging solution, the hardware switch of the fast charging solution combined with ADSP and VOOPPHY only has switch 1, that is, when the VBUS is out of power, it will switch to the serial port module, and when the VBUS is powered, it will switch to the common one of PM8350, VOOCPHY, and USBPHY. port. Such a logical architecture leads to the fact that PMIC and USBPHY can control D+ and D- data communication even during fast charging. If the DEBUG line is connected, because the hardware is not disconnected, the DEBUG line interferes with fast charging communication, and the adapter passes through D+ , The information sent by D- will interfere with the half-high level, causing the data received by VOOCPHY to be incorrect and unable to perform fast charging.

可见,ADSP与VOOCPHY结合的快充方式虽然能够减少硬件开关的设置,节省成本,但是由于硬件方案的改动,存在DEBUG线干扰快充通信的问题,使得DEBUG线无法支持快充功能,降低了充电性能和充电效率。It can be seen that although the fast charging method combined with ADSP and VOOCPHY can reduce the setting of hardware switches and save costs, due to the change of the hardware solution, there is a problem that the DEBUG line interferes with the fast charging communication, so that the DEBUG line cannot support the fast charging function, which reduces the charging time. performance and charging efficiency.

为了解决上述问题,在本申请的实施例中,终端可以对外接设备对应的设备类型、连接线类型进行确定,从而可以根据设备类型和连接线类型进一步确定是否禁止USBPHY和PMIC对D+、D-的控制。具体地,在确定外接设备为适配器,外接设备与终端通过DEBUG线连接,且不为无线充电之后,终端可以选择禁止USBPHY和PMIC控制D+、D-,保证仅VOOCPHY能够控制D+、D-,从而可以避免DEBUG线干扰快充通信,能够满足支持使用DEBUG线进行快充的需求,大大提高了充电性能和充电效率。In order to solve the above problems, in the embodiment of this application, the terminal can determine the device type and connection line type corresponding to the external device, so that it can further determine whether to prohibit USBPHY and PMIC from connecting D+ and D- control. Specifically, after determining that the external device is an adapter, the external device is connected to the terminal through a DEBUG line, and does not perform wireless charging, the terminal can choose to prohibit USBPHY and PMIC from controlling D+ and D-, so that only VOOPPHY can control D+ and D-, thereby It can avoid the DEBUG line from interfering with the fast charging communication, and can meet the demand of supporting the use of the DEBUG line for fast charging, greatly improving the charging performance and charging efficiency.

也就是说,因快充硬件方案改动显著,针对DEBUG线,终端可以通过在软件上进行适配,使得在识别到DEBUG线时能够支持快充功能,进而能够基于接收发送VOOC快充信息的物理逻辑模块VOOCPHY实现快充方案。That is to say, due to the significant changes in the fast charging hardware solution, for the DEBUG line, the terminal can be adapted on the software so that it can support the fast charging function when the DEBUG line is recognized, and then it can be based on the physics of receiving and sending VOOC fast charging information. The logic module VOOPPHY realizes the fast charging solution.

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

本申请一实施例提供了一种充电方法,图4为本申请实施例提出的充电方法的实现流程示意图一,如图4所示,在本申请的实施例中,终端进行充电的方法可以包括以下步骤:An embodiment of the present application provides a charging method. FIG. 4 is a schematic diagram of the implementation flow of the charging method proposed in the embodiment of the present application. As shown in FIG. 4, in the embodiment of the present application, the method for charging the terminal may include The following steps:

步骤101、在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型。Step 101. When establishing a connection with an external device, determine a connection line type of a connection line with the external device.

在本申请的实施例中,终端在与外接设备建立连接时,可以先确定与外接设备之间的连接线的连接线类型。其中,连接线的连接线类型可以为调试线(DEBUG线),也可以为TYPE-C线。In the embodiment of the present application, when the terminal establishes a connection with the external device, it may first determine the connection line type of the connection line with the external device. Wherein, the connection line type of the connection line may be a debugging line (DEBUG line) or a TYPE-C line.

需要说明的是,在本申请的实施例中,终端可以为任何具备通信和存储功能的终端设备,例如:平板电脑、手机、电子阅读器、遥控器、个人计算机(Personal Computer,PC)、笔记本电脑、车载设备、网络电视、可穿戴设备、个人数字助理(Personal DigitalAssistant,PDA)、便捷式媒体播放器(Portable Media Player,PMP)、导航装置等终端设备。It should be noted that, in the embodiments of this application, the terminal can be any terminal device with communication and storage functions, such as: tablet computer, mobile phone, e-reader, remote control, personal computer (Personal Computer, PC), notebook Terminal equipment such as computers, vehicle-mounted equipment, Internet TV, wearable equipment, personal digital assistants (Personal Digital Assistant, PDA), portable media players (Portable Media Player, PMP), navigation devices, etc.

需要说明的是,在本申请的实施例中,终端可以配置有模拟数字信号处理芯片ADSP和应用处理器AP,其中,ADSP与AP之间的通信链路为GLINK。It should be noted that, in the embodiment of the present application, the terminal may be configured with an analog and digital signal processing chip ADSP and an application processor AP, wherein the communication link between the ADSP and the AP is GLINK.

可以理解的是,在本申请的实施例中,终端可以支持普通充电模式和快速充电模式,其中,快速充电模式的充电流大于普通充电模式的充电流,即快速充电模式的充电速度大于所述普通充电模式的充电速度。It can be understood that, in the embodiment of the present application, the terminal can support the normal charging mode and the fast charging mode, wherein the charging current of the fast charging mode is greater than the charging current of the normal charging mode, that is, the charging speed of the fast charging mode is greater than the above-mentioned The charging speed of normal charging mode.

可选地,在本申请的实施例中,外接设备可以为用于对终端进行充电的设备,具体地,外接设备可以通过与终端建立无线连接来向终端进行无线充电,也可以通过与终端建立物理连接来向终端进行有线充电。例如,外接设备可以为适配器、电源等设备,外接设备也可以为充电底座等设备。Optionally, in this embodiment of the application, the external device may be a device for charging the terminal. Specifically, the external device may wirelessly charge the terminal by establishing a wireless connection with the terminal, or may establish a wireless connection with the terminal. Physical connection for wired charging to the terminal. For example, the external device may be an adapter, a power supply, or the like, and the external device may also be a charging base or the like.

可选地,在本申请的实施例中,外接设备也可以为与终端进行通信的设备。Optionally, in the embodiment of the present application, the external device may also be a device for communicating with the terminal.

进一步地,在本申请的实施例中,终端与外接设备可以通过通用串行总线(Universal Serial Bus,USB)接口相连,该USB接口可以是普通的USB接口,也可以是microUSB接口或USB接口等。USB接口中的电源线用于外接设备为终端进行充电,其中,USB接口中的电源线可以是USB接口中的VBus线和/或地线。USB接口中的数据线用于外接设备和终端进行双向通信,该数据线可以是USB接口中的D+线和/或D-线,所谓双向通信可以指外接设备和终端双方进行信息的交互。Further, in the embodiment of the present application, the terminal and the external device may be connected through a Universal Serial Bus (Universal Serial Bus, USB) interface, and the USB interface may be a common USB interface, or may be a microUSB interface or a USB interface, etc. . The power cord in the USB interface is used for external devices to charge the terminal, where the power cord in the USB interface may be a VBus line and/or a ground line in the USB interface. The data line in the USB interface is used for two-way communication between the external device and the terminal. The data line can be the D+ line and/or D- line in the USB interface. The so-called two-way communication can refer to the information exchange between the external device and the terminal.

需要说明的是,在本申请的实施例中,USB接口有三种不同外观的接口,即Type-A、Type-B、Type-C,Type-C拥有比Type-A及Type-B均小得多的体积,是最新的USB接口外形标准。另外,Type-C是一种既可以应用于PC(主设备)又可以应用于外接设备(从设备,如手机)的接口类型。其中,Type-C口有4对发送(transport,TX)/接收(receive,RX)分线,2对USB D+/D-,一对SBU,2个CC(CC1,CC2),另外还有4个VBUS和4个地线。It should be noted that, in the embodiment of this application, the USB interface has three interfaces with different appearances, namely Type-A, Type-B, and Type-C, and Type-C has a size smaller than Type-A and Type-B. It is the latest USB interface form factor standard. In addition, Type-C is an interface type that can be applied to both a PC (master device) and an external device (slave device, such as a mobile phone). Among them, the Type-C port has 4 pairs of sending (transport, TX)/receiving (receive, RX) branch lines, 2 pairs of USB D+/D-, a pair of SBUs, 2 CCs (CC1, CC2), and 4 VBUS and 4 ground wires.

示例性的,在本申请中,图5为TYPE-C的引脚接口的示意图,如图5所示,在TYPE-C的引脚接口图,其pin是对称的,因此其支持正反插。TYPE-C支持USB、DP等协议,其对称的CC1和CC2引脚用于识别所连接的设备。CC引脚在下行端口(Downstream Facing Port,DPF)DPF和UFP(Upstream Facing Port,UFP)内部分别需要有上拉/下拉电阻,用来识别各自的功能。根据不同的上下拉电阻检测,可以确认负载信息。在DFP内部CC通过不同上拉电阻Rp上拉到电源,在UFP内部CC通过5.1K电阻下拉到地线(Ground,GND)。DFP直的是下行端口,可以认为是HOST设备、电源适配器这类;UFP可以认为是从设备DEVICE,U盘、受电设备等。Exemplarily, in this application, Figure 5 is a schematic diagram of the pin interface of TYPE-C, as shown in Figure 5, in the pin interface diagram of TYPE-C, its pins are symmetrical, so it supports positive and negative insertion . TYPE-C supports USB, DP and other protocols, and its symmetrical CC1 and CC2 pins are used to identify the connected device. The CC pin needs to have a pull-up/pull-down resistor inside the DPF (Downstream Facing Port, DPF) and UFP (Upstream Facing Port, UFP), respectively, to identify their respective functions. According to the detection of different pull-up and pull-down resistors, the load information can be confirmed. The internal CC of the DFP is pulled up to the power supply through different pull-up resistors Rp, and the internal CC of the UFP is pulled down to the ground wire (Ground, GND) through a 5.1K resistor. DFP directly refers to the downstream port, which can be considered as HOST equipment, power adapter, etc.; UFP can be considered as slave device DEVICE, U disk, powered equipment, etc.

其中,不同的TYPE-C线或者OTG(On-The-Go)线中CC1和CC2的接电阻情况不同,图6为电阻连接情况的示意图,示例性的,假设手机作为DFP,通过OTG线连接U盘的情况如图6所示。Among them, the connection resistance of CC1 and CC2 in different TYPE-C lines or OTG (On-The-Go) lines is different. Figure 6 is a schematic diagram of the resistance connection situation. For example, assume that the mobile phone is used as a DFP and connected through an OTG line The situation of the U disk is shown in Figure 6.

当终端通过标准的TYPE-C线连接适配器时,标准的TYPE-C线CC上只有一个上拉电阻,另一个CC是开路,从作为HOST的适配器端看,CC1和CC2分别是OPEN和RD的状态,终端作为SINK设备,连接标准的TYPE-C线,在充电器类型经BC1.2识别成标准下行端口(StandardDownstream Port,SDP)/充电下行端口(Charging Downstream Port,CDP)时,ADSP才会通知AP去拉高D+到3.3V来枚举设备;当终端连接的是非标的TYPE-C线时,其两CC上都有上拉电阻,从作为HOST的适配器端看,CC1和CC2都是RD的状态,其会被识别成DEBUG AccessoryMode attached,一旦识别成DEBUG线,ADSP会立马通知AP去拉高D+去枚举,也就是AP端会控制USBPHY作用于D+3.3V的高电平。When the terminal is connected to the adapter through a standard TYPE-C line, there is only one pull-up resistor on the standard TYPE-C line CC, and the other CC is open. From the perspective of the adapter as HOST, CC1 and CC2 are OPEN and RD respectively. state, the terminal is used as a SINK device, connected to a standard TYPE-C line, and the ADSP will only work when the charger type is recognized as a Standard Downstream Port (SDP)/Charging Downstream Port (CDP) by BC1.2. Notify the AP to pull up D+ to 3.3V to enumerate the device; when the terminal is connected to a non-standard TYPE-C line, there are pull-up resistors on both CCs, and from the adapter side of the HOST, both CC1 and CC2 are RD status, it will be recognized as DEBUG AccessoryMode attached, once it is recognized as a DEBUG line, ADSP will immediately notify the AP to pull up D+ to enumerate, that is, the AP will control the USBPHY to act on the high level of D+3.3V.

可以理解的是,在本申请的实施例中,终端在通过连接线与外接设备建立连接之后,可以先对该连接线的具体连接线类型进行确定,从而可以基于该连接线类型进一步确定是否进行快充通信的建立。It can be understood that, in the embodiment of the present application, after the terminal establishes a connection with the external device through the connection line, it can first determine the specific connection line type of the connection line, so that it can be further determined based on the connection line type whether to perform Establishment of fast charging communication.

可选地,在本申请中,终端在与外接设备建立连接时,可以通过触发Type-C中断确定所述连接线的所述连接线类型。其中,连接线类型可以为调试线(DEBUG线)或者TYPE-C线。Optionally, in this application, when establishing a connection with an external device, the terminal may determine the connection line type of the connection line by triggering a Type-C interrupt. Wherein, the connection line type may be a debugging line (DEBUG line) or a TYPE-C line.

示例性的,在本申请的实施例中,当有外接设备插入时,终端可以先进行TYPE-C中断的触发。具体地,触发Type-C中断之后,在中断处理函数中,可以通过读相应的TYPE-C寄存器来判断插入的外接设备对应的连接线是标准的TYPE-C线还是DEBUG线,如果是DEBUG线,ADSP便可以通过GLINK总线向AP发送notify消息,以告知AP此次插入的外接设备对应的连接线为DEBUG线。Exemplarily, in the embodiment of the present application, when an external device is plugged in, the terminal may first trigger a TYPE-C interrupt. Specifically, after the Type-C interrupt is triggered, in the interrupt processing function, it can be judged by reading the corresponding TYPE-C register whether the connection line corresponding to the inserted external device is a standard TYPE-C line or a DEBUG line, if it is a DEBUG line , the ADSP can send a notify message to the AP through the GLINK bus to inform the AP that the connection line corresponding to the external device inserted this time is the DEBUG line.

步骤102、若连接线类型为调试线,且外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对USB接口的引脚的控制;同时启动第一定时器。Step 102, if the connection line type is a debugging line, and the device type of the external device is an adapter, then set the pins of the USB interface to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; simultaneously start the first timer device.

在本申请的实施例中,终端在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,如果外接设备对应的连接线类型为调试线,且如果外接设备的设备类型为适配器,那么终端可以选择将USB接口的引脚设置为高阻状态,从而可以禁止USBPHY对所述USB接口的引脚的控制;同时,终端还可以选择启动第一定时器,从而可以通过第一定时器的运行时间确定禁止PMIC对所述USB接口的引脚的控制的。In an embodiment of the present application, when the terminal establishes a connection with an external device, after determining the type of the connection line with the external device, if the type of the connection line corresponding to the external device is a debugging line, and if the external device If the device type is an adapter, the terminal can choose to set the pins of the USB interface to a high-impedance state, thereby prohibiting USBPHY from controlling the pins of the USB interface; at the same time, the terminal can also choose to start the first timer, so that It may be determined by the running time of the first timer that the PMIC is prohibited from controlling the pins of the USB interface.

需要说明的是,在本申请的实施例中,如果终端与外接设备之间的连接线的连接线类型为调试线,同时外接设备的设备类型为适配器,那么,为了防止ADSP通知AP去拉高D+来枚举设备,即防止AP端会控制USBPHY作用于D+3.3V的高电平,终端需要将USB接口的引脚设置为高阻状态,从而禁止USBPHY对所述USB接口的引脚的控制,进而解决了目前在基于ADSP+VOOCPHY的情况下DEBUG线不支持快充的问题。It should be noted that, in the embodiment of this application, if the connection line type between the terminal and the external device is a debugging line, and the device type of the external device is an adapter, then, in order to prevent the ADSP from notifying the AP to pull the D+ to enumerate devices, that is, to prevent the AP side from controlling the USBPHY to act on the high level of D+3.3V, the terminal needs to set the pins of the USB interface to a high-impedance state, thereby prohibiting the USBPHY from controlling the pins of the USB interface. Control, and then solve the problem that the DEBUG line does not support fast charging in the case of ADSP+VOOCPHY.

可以理解的是,在本申请的实施例中,USB接口的引脚即为USB接口的D+、D-。相应地,在终端与适配器之间的连接线被识别为DEBUG线时,由于AP端会控制USBPHY作用于D+3.3V的高电平,因此适配器通过D+、D-发过来的信息会干扰成半高电平,进而无法进行快充。相应地,为了避免DEBUG线干扰快充通信,终端在确定与适配器通过DEBUG线连接时,可以选择直接选择忽略USBPHY的通信,以禁止USBPHY对D+、D-的控制。It can be understood that, in the embodiment of the present application, the pins of the USB interface are D+ and D− of the USB interface. Correspondingly, when the connection line between the terminal and the adapter is identified as a DEBUG line, since the AP side will control the USBPHY to act on the high level of D+3.3V, the information sent by the adapter through D+ and D- will interfere with the process. Half-high level, so fast charging cannot be performed. Correspondingly, in order to prevent the DEBUG line from interfering with the fast charging communication, when the terminal determines that it is connected to the adapter through the DEBUG line, it can choose to directly ignore the USBPHY communication to prohibit the USBPHY from controlling D+ and D-.

需要说明的是,在本申请的实施例中,高阻状态可以为能够与其他状态进行线与的一种状态,其中,线与逻辑,即两个输出端(包括两个以上)直接互连就可以实现“AND”的逻辑功能。上述其他状态可以表征其他控制D+、D-的状态,具体可以包括VOOCPHY和适配器在D+、D-上加载的01的低高电平状态。It should be noted that, in the embodiment of the present application, the high-impedance state can be a state capable of performing wired AND with other states, wherein the wired-AND logic, that is, two output terminals (including more than two) are directly interconnected The logical function of "AND" can be realized. The above other states may represent other states that control D+ and D-, specifically may include the low-high state of 01 loaded on D+ and D- by VOOPPHY and the adapter.

可选地,在本申请的实施例中,在确定外接设备为适配器,且终端与外接设备之间的连接线为DEBUG线之后,终端中的AP可以通过GLINK作用到ADSP的USBPHY,从而将D+、D-的状态设置成高阻状态,从而实现禁止USBPHY对D+、D-的控制。Optionally, in this embodiment of the application, after determining that the external device is an adapter, and the connection line between the terminal and the external device is a DEBUG line, the AP in the terminal can act on the USBPHY of ADSP through GLINK, so that the D+ The state of D- and D- is set to a high-impedance state, so as to realize the prohibition of the control of D+ and D- by USBPHY.

进一步地,在本申请的实施例中,图7为本申请实施例提出的充电方法的实现流程示意图二,如图7所示,在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,即步骤101之后,且在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制之前,即步骤103之前,终端进行充电的方法还可以包括以下步骤:Further, in the embodiment of the present application, FIG. 7 is a schematic diagram of the second implementation flow of the charging method proposed in the embodiment of the present application. As shown in FIG. 7, when establishing a connection with the external device, determine the After the connection line type of the connection line, that is, after step 101, and after the running time of the first timer is exceeded, before the PMIC is prohibited from controlling the pins of the USB interface, that is, before step 103, the terminal is charged The method may also include the following steps:

步骤105、若所述连接线类型为调试线,所述设备类型为所述适配器,且所述充电模式为有线充电,则将所述USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动所述第一定时器。Step 105. If the connection line type is a debugging line, the device type is the adapter, and the charging mode is wired charging, then set the pins of the USB interface to a high-impedance state to prohibit USBPHY from Controlling the pins of the USB interface; starting the first timer at the same time.

在本申请的实施例中,终端还可以先确定出充电模式,然后结合充电模式、连接线类型以及设备类型进一步确定是否需要禁止USBPHY对所述USB接口的引脚的控制。In the embodiment of the present application, the terminal may also first determine the charging mode, and then further determine whether it is necessary to prohibit the USBPHY from controlling the pins of the USB interface in combination with the charging mode, the type of the connecting line, and the type of the device.

可以理解的是,在本申请中,充电模式可以包括无线充电和有线充电。It can be understood that, in this application, the charging mode may include wireless charging and wired charging.

相应地,在本申请的实施例中,终端在确定与外接设备之间的连接线的连接线类型为调试线、外接设备的设备类型为适配器、充电模式为有线充电时,可以选择忽略USBPHY的通信。具体地,终端可以将USB接口的引脚设置为高阻状态,从而禁止USBPHY对D+、D-的控制,进而避免调试线(DEBUG线)干扰快充通信。Correspondingly, in the embodiment of the present application, when the terminal determines that the connection line type of the connection line with the external device is a debugging line, the device type of the external device is an adapter, and the charging mode is wired charging, the terminal can choose to ignore the USBPHY. communication. Specifically, the terminal can set the pins of the USB interface to a high-impedance state, thereby prohibiting the control of D+ and D- by the USBPHY, thereby preventing the debugging line (DEBUG line) from interfering with the fast charging communication.

可以理解的是,在本申请中,由于无线充电通过无线线圈耦合到VBUS上,也会产生类似有线充电的充电器类型识别的动作,因此,终端还可以通过充电模式的确认来剔除无线充电下的误识别。It can be understood that in this application, since wireless charging is coupled to VBUS through a wireless coil, an action similar to wired charging charger type identification will also occur. Therefore, the terminal can also eliminate wireless charging by confirming the charging mode. misidentification.

步骤103、在超出第一定时器的运行时间之后,禁止PMIC对USB接口的引脚的控制。Step 103, after the running time of the first timer is exceeded, prohibit the PMIC from controlling the pins of the USB interface.

在本申请的实施例中,如果外接设备对应的连接线类型为调试线,且如果外接设备的设备类型为适配器,那么终端在启动第一定时器之后,可以在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制。In the embodiment of the present application, if the type of connection line corresponding to the external device is a debugging line, and if the device type of the external device is an adapter, then after starting the first timer, the terminal may After runtime, the PMIC is disabled from controlling the pins of the USB interface.

需要说明的是,在本申请的实施例中,终端可以预先对第一定时器的运行时间进行设置,例如,可以将第一定时器运行的时间设置为800ms。其中,第一定时器的运行时间可以为无线充电与有线充电之间转换的转换时间,相应地,第一定时器的运行时间可以用于确定启动VOOCPHY进行快充通信的时机。It should be noted that, in the embodiment of the present application, the terminal may set the running time of the first timer in advance, for example, the running time of the first timer may be set to 800ms. Wherein, the running time of the first timer may be the transition time between wireless charging and wired charging, and correspondingly, the running time of the first timer may be used to determine the timing of starting VOOCPHY for fast charging communication.

可选地,在本申请的实施例中,由于在无线反向充电后再连接有线快充时,无线反向充电工作的OTG模式准换到普充模式,即无线充电向有线充电转换过程,PMIC需要有一定的转换时间,因此,终端在确定外接设备为适配器,且终端与外接设备之间的连接线为调试线之后,并不会立即启动VOOCPHY进行快充通信,也不会立即禁止PMIC对所述USB接口的引脚的控制,而是需要通过第一定时器的开启和运行,在确保已经完成了无线充电和有线充电之间的转换以后,再禁止PMIC对所述USB接口的引脚的控制。Optionally, in the embodiment of the present application, since the OTG mode of the wireless reverse charging operation can be switched to the general charging mode when the wired fast charging is connected after the wireless reverse charging, that is, the conversion process from wireless charging to wired charging, PMIC needs a certain conversion time. Therefore, after the terminal determines that the external device is an adapter, and the connection line between the terminal and the external device is a debugging line, it will not immediately start VOOPPHY for fast charging communication, nor will it immediately disable PMIC. To control the pins of the USB interface, it is necessary to turn on and run the first timer. After ensuring that the conversion between wireless charging and wired charging has been completed, the PMIC is prohibited from booting the USB interface. foot control.

也就是说,在本申请的实施例中,当超出第一定时器的运行时间之后,可以认为无线充电向有线充电转换过程已经完成,此时,终端便可以选择禁止PMIC对所述USB接口的引脚的控制。That is to say, in the embodiment of the present application, when the running time of the first timer is exceeded, it can be considered that the conversion process from wireless charging to wired charging has been completed. At this time, the terminal can choose to prohibit the PMIC from pin control.

可选地,在本申请的实施例中,终端可以通过禁止高压专用充电接口(highvoltage dedicated charging port,HVDCP)和BC1.2的识别功能,来实现禁止PMIC对D+、D-的控制的需求。Optionally, in the embodiment of the present application, the terminal can realize the requirement of prohibiting the PMIC from controlling D+ and D- by prohibiting the identification function of the high voltage dedicated charging port (HVDCP) and BC1.2.

示例性的,在本申请中,在终端与适配器之间的连接线被识别为DEBUG线之后,终端中的ADSP可以启动运行时间为800ms的第一定时器,当超过第一定时器的800ms的运行时间之后,同样为避免PMIC对D+、D-的控制,终端可以直接禁止掉HVDCP和BC1.2的识别,进而可以使PMIC无法控制D+、D-。Exemplarily, in this application, after the connection line between the terminal and the adapter is identified as a DEBUG line, the ADSP in the terminal can start a first timer with a running time of 800ms, and when the 800ms time of the first timer exceeds After the running time, in order to avoid the control of D+ and D- by the PMIC, the terminal can directly disable the identification of HVDCP and BC1.2, so that the PMIC cannot control D+ and D-.

进一步地,在本申请的实施例中,终端还可以结合充电模式、连接线类型以及设备类型进一步确定是否需要禁止PMIC对所述USB接口的引脚的控制。Further, in the embodiment of the present application, the terminal may further determine whether it is necessary to prohibit the PMIC from controlling the pins of the USB interface in combination with the charging mode, the type of the connecting wire, and the type of the device.

具体地,在本申请中,终端在确定与外接设备之间的连接线的连接线类型为调试线、外接设备的设备类型为适配器、充电模式为有线充电(即为有线充电)时,可以选择禁止HVDCP和BC1.2的识别功能,从而禁止PMIC对D+、D-的控制。Specifically, in this application, when the terminal determines that the connection line type of the connection line with the external device is a debugging line, the device type of the external device is an adapter, and the charging mode is wired charging (that is, wired charging), the terminal can select Disable the identification function of HVDCP and BC1.2, thus prohibiting the control of D+ and D- by PMIC.

由此可见,在本申请的实施例中,在确定外接设备为适配器,且外接设备与终端通过调试线连接之后,终端既可以选择禁止USBPHY控制D+、D-,也可以选择同时禁止PMIC控制D+、D-,此时便只有VOOCPHY能够控制D+、D-,从而可以避免调试线(DEBUG线)干扰快充通信。It can be seen that in the embodiment of the present application, after the external device is determined to be an adapter, and the external device is connected to the terminal through a debugging cable, the terminal can either choose to prohibit the USBPHY from controlling D+ and D-, or choose to prohibit the PMIC from controlling D+ at the same time. , D-, at this time, only VOOCPHY can control D+, D-, so as to avoid the debugging line (DEBUG line) from interfering with the fast charging communication.

步骤104、激活适配器,以建立快充通信。Step 104, activate the adapter to establish fast charging communication.

在本申请的实施例中,终端在完成禁止USBPHY和PMIC控制D+、D-的处理之后,便可以激活适配器,从而可以与适配器建立快充通信。In the embodiment of the present application, after the terminal completes the process of prohibiting USBPHY and PMIC from controlling D+ and D-, it can activate the adapter, so as to establish fast charging communication with the adapter.

可选地,在本申请的实施例中,终端可以选择通过enable level shift功能,发脉冲串来激活适配器,并在激活适配器之后,通过与适配器之间的调试线建立正常快充通信。Optionally, in this embodiment of the application, the terminal can choose to activate the adapter by sending bursts through the enable level shift function, and after activating the adapter, establish normal fast charging communication with the adapter through the debugging line.

综上所述,通过上述步骤101至步骤104所提出的充电方法,终端在确定外接设备为适配器,外接设备与终端通过DEBUG线连接,且不为无线充电之后,可以通过将D+、D-设置为高阻状态来禁止USBPHY对D+、D-的控制,还可以通过禁止HVDCP和BC1.2的识别功能来禁止PMIC对D+、D-的控制,从而保证了快充通信的建立。也就是说,对于ADSP与VOOCPHY结合的快充方式,当识别到DEBUG线时,终端可以选择禁止USBPHY和PMIC控制D+、D-,保证仅VOOCPHY能够控制D+、D-,从而可以避免DEBUG线干扰快充通信,能够满足支持使用DEBUG线进行快充的需求。To sum up, through the charging method proposed in step 101 to step 104 above, after the terminal determines that the external device is an adapter, the external device is connected to the terminal through the DEBUG line, and it is not for wireless charging, it can set D+ and D- to For the high-impedance state, USBPHY is prohibited from controlling D+ and D-. It is also possible to prohibit the PMIC from controlling D+ and D- by disabling the identification functions of HVDCP and BC1.2, thereby ensuring the establishment of fast charging communication. That is to say, for the fast charging method combining ADSP and VOOPPHY, when the DEBUG line is recognized, the terminal can choose to prohibit USBPHY and PMIC from controlling D+ and D-, so that only VOOPPHY can control D+ and D-, so as to avoid DEBUG line interference Fast charging communication can meet the needs of supporting fast charging using the DEBUG line.

可见,本申请提出的充电方法,能够基于ADSP与VOOCPHY结合的方式,实现了DEBUG线能够支持快充的需求。与基于MCU式的快充方案相比,能够在保证DEBUG线支持快充功能的同时,去掉了一个硬件开关,节省了成本。It can be seen that the charging method proposed in this application can realize the requirement that the DEBUG line can support fast charging based on the combination of ADSP and VOOPPHY. Compared with the MCU-based fast charging solution, while ensuring that the DEBUG line supports the fast charging function, a hardware switch is removed, which saves costs.

需要说明的是,本申请提出的充电方法,也适用于后续的MCU方案,MCU方式实现快充方案借鉴本申请,同样能通过节省硬件开关来节省成本。It should be noted that the charging method proposed in this application is also applicable to the subsequent MCU solution. The fast charging solution implemented by MCU can be used for reference in this application, which can also save costs by saving hardware switches.

本申请实施例提供了一种充电方法,在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型;若连接线类型为调试线,且外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对USB接口的引脚的控制;同时启动第一定时器;在超出第一定时器的运行时间之后,禁止PMIC对USB接口的引脚的控制;激活适配器,以建立快充通信。由此可见,在本申请的实施例中,终端可以对外接设备对应的设备类型、连接线类型进行确定,从而可以根据设备类型和连接线类型进一步确定是否禁止USBPHY和PMIC对D+、D-的控制。具体地,在确定外接设备为适配器,外接设备与终端通过DEBUG线连接,且不为无线充电之后,终端可以选择禁止USBPHY和PMIC控制D+、D-,保证仅VOOCPHY能够控制D+、D-,从而可以避免DEBUG线干扰快充通信,能够满足支持使用DEBUG线进行快充的需求,大大提高了充电性能和充电效率。An embodiment of the present application provides a charging method. When establishing a connection with an external device, determine the type of the connection line with the external device; if the type of the connection line is a debugging line, and the device type of the external device is an adapter, Then the pins of the USB interface are set to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; at the same time, the first timer is started; foot control; activate the adapter to establish fast charge communication. It can be seen that, in the embodiment of the present application, the terminal can determine the device type and connection line type corresponding to the external device, so that it can further determine whether to prohibit USBPHY and PMIC from connecting D+ and D- according to the device type and connection line type. control. Specifically, after determining that the external device is an adapter, the external device is connected to the terminal through a DEBUG line, and wireless charging is not performed, the terminal can choose to prohibit USBPHY and PMIC from controlling D+ and D-, so that only VOOPPHY can control D+ and D-, so that It can avoid the DEBUG line from interfering with the fast charging communication, and can meet the demand of supporting the use of the DEBUG line for fast charging, greatly improving the charging performance and charging efficiency.

基于上述实施例,本申请的再一实施例提出了一种充电方法,图8为本申请实施例提出的充电方法的实现流程示意图三,如图8所示,在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,即步骤101之后,终端进行充电的方法还可以包括以下步骤:Based on the above-mentioned embodiments, another embodiment of the present application proposes a charging method. FIG. 8 is a schematic diagram of the third implementation flow of the charging method proposed in the embodiment of the present application. As shown in FIG. 8, when establishing a connection with an external device, After determining the connection line type of the connection line with the external device, that is, after step 101, the method for charging the terminal may further include the following steps:

步骤106、确定外接设备的设备类型。Step 106, determine the device type of the external device.

在本申请的实施例中,终端在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,终端还可以对外接设备的设备类型进行确定,即确定外接设备是否为适配器。In the embodiment of the present application, when the terminal establishes a connection with the external device, after determining the connection line type of the connection line with the external device, the terminal can also determine the device type of the external device, that is, determine the type of the external device Is it an adapter.

需要说明的是,在本申请的实施例中,在确定是否建立快充通信之前,终端需要先确定外接设备的设备类型。其中,外接设备的设备类型可以为适配器,还可以为非适配器。It should be noted that, in the embodiment of the present application, before determining whether to establish fast charging communication, the terminal needs to first determine the device type of the external device. Wherein, the device type of the external device may be an adapter, or may be a non-adapter.

具体地,在本申请的实施例中,终端确定外接设备的设备类型的方法可以包括以下步骤:Specifically, in the embodiment of the present application, the method for the terminal to determine the device type of the external device may include the following steps:

步骤106a、在触发Type-C中断之后,启动第二定时器。Step 106a, after the Type-C interrupt is triggered, start a second timer.

在本申请的实施例中,终端在通过触发Type-C中断确定连接线的连接线类型之后,可以先启动第二定时器。In the embodiment of the present application, after determining the type of the connection line by triggering the Type-C interrupt, the terminal may first start the second timer.

需要说明的是,在本申请的实施例中,终端可以预先对第二定时器的运行时间进行设置,例如,可以将第二定时器运行的时间设置为200ms。其中,第二定时器的运行时间可以用于确定APSD中断的触发时机。It should be noted that, in the embodiment of the present application, the terminal may set the running time of the second timer in advance, for example, the running time of the second timer may be set to 200ms. Wherein, the running time of the second timer can be used to determine the triggering timing of the APSD interrupt.

步骤106b、在超出第二定时器的运行时间之后,通过触发APSD中断确定外接设备对应的端口信息。Step 106b, after the running time of the second timer is exceeded, determine the port information corresponding to the external device by triggering an APSD interrupt.

在本申请的实施例中,终端在开启二定时器之后,在超出第二定时器的运行时间之后,终端可以通过触发APSD中断来进一步确定外接设备对应的端口信息。In the embodiment of the present application, after the terminal starts the second timer, after the running time of the second timer exceeds, the terminal can further determine the port information corresponding to the external device by triggering an APSD interrupt.

需要说明的是,在本申请的实施例中,在触发Type-C中断之后到达第二定时器的运行时间,终端可以选择触发APSD中断,其中,APSD中断可以通过BC1.2(Battery Chargingv1.2)充电器类型识别协议进行外接设备对应的端口信息的获取。It should be noted that, in the embodiment of the present application, after triggering the Type-C interrupt and reaching the running time of the second timer, the terminal can choose to trigger the APSD interrupt, wherein the APSD interrupt can be passed through BC1.2 (Battery Chargingv1.2 ) The charger type identification protocol acquires the port information corresponding to the external device.

其中,BC1.2是USB-IF下属的BC(Battery Charging)小组制定的协议,主要用于规范电池充电的需求,该协议最早基于USB2.0协议来实现。Among them, BC1.2 is a protocol formulated by the BC (Battery Charging) group under the USB-IF, which is mainly used to standardize battery charging requirements. This protocol was first implemented based on the USB2.0 protocol.

具体地,BC1.2的三种端口主要包括标准下行端口SDP、DCP、充电下行端口CDP。其中,SDP这种端口的D+和D-线上具有15kΩ下拉电阻。限流值如上讨论:挂起时为2.5mA,连接时为100mA,连接并配置为较高功率时为500mA。DCP这种端口不支持任何数据传输,但能够提供1.5A以上的电流。端口的D+和D-线之间短路。这种类型的端口支持较高充电能力的墙上充电器和车载充电器,无需枚举。CDP这种端口既支持大电流充电,也支持完全兼容USB2.0的数据传输。端口具有D+和D-通信所必需的15kΩ下拉电阻,也具有充电器检测阶段切换的内部电路。内部电路允许便携设备将CDP与其它类型端口区分开来。Specifically, the three ports of BC1.2 mainly include the standard downlink port SDP, DCP, and charging downlink port CDP. Among them, the D+ and D- lines of the SDP port have 15kΩ pull-down resistors. The current limit values are as discussed above: 2.5mA when suspended, 100mA when connected, and 500mA when connected and configured for higher power. The port of DCP does not support any data transmission, but it can provide more than 1.5A of current. There is a short circuit between the D+ and D- lines of the port. This type of port supports higher-capacity wall chargers and car chargers without enumeration. This port of CDP not only supports high-current charging, but also supports data transmission that is fully compatible with USB2.0. The ports have 15kΩ pull-down resistors necessary for D+ and D- communication, and also internal circuitry for charger detection phase switching. Internal circuitry allows portable devices to distinguish the CDP from other types of ports.

步骤106c、根据端口信息确定设备类型。Step 106c, determine the device type according to the port information.

在本申请的实施例中,终端在超出所述第二定时器的运行时间之后,通过触发APSD中断确定所述外接设备对应的端口信息之后,便可以根据该端口信息进一步确定出外接设备的设备类型。In the embodiment of the present application, after the terminal exceeds the running time of the second timer, after determining the port information corresponding to the external device by triggering the APSD interrupt, it can further determine the device of the external device according to the port information Types of.

示例性的,在本申请中,如果外接设备对应的端口信息为DCP,那么终端便可以确定所述设备类型为适配器。Exemplarily, in this application, if the port information corresponding to the external device is DCP, then the terminal can determine that the type of the device is an adapter.

进一步地,在本申请的实施例中,图9为本申请实施例提出的充电方法的实现流程示意图四,如图9所示,在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,即步骤101之后,终端进行充电的方法还可以包括以下步骤:Further, in the embodiment of the present application, FIG. 9 is a schematic diagram of the fourth implementation flow of the charging method proposed in the embodiment of the present application. As shown in FIG. 9, when establishing a connection with the external device, determine the After the connection line type of the connection line, that is, after step 101, the method for charging the terminal may also include the following steps:

步骤107、若连接线类型为Type-C线,且外接设备的设备类型为适配器,则激活适配器,以建立快充通信。Step 107. If the connection line type is Type-C line and the device type of the external device is an adapter, activate the adapter to establish fast charging communication.

在本申请的实施例中,终端在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,如果外接设备对应的连接线类型为标准的Type-C线,同时,如果外接设备的设备类型为适配器,那么终端可以选择直接激活所述适配器,从而可以通过Type-C线建立快充通信。In the embodiment of the present application, when the terminal establishes a connection with the external device, after determining the type of the connection line with the external device, if the type of the connection line corresponding to the external device is a standard Type-C line, At the same time, if the device type of the external device is an adapter, the terminal can choose to directly activate the adapter, so that fast charging communication can be established through the Type-C cable.

可选地,在本申请的实施例中,在确定外接设备为适配器,且终端与外接设备之间的连接线为标准的Type-C线之后,可以确定VOOCPHY控制D+、D-,此时,终端可以通过enablelevel shift功能,发送脉冲串来激活适配器,从而可以在激活配器之后与适配器建立正常快充通信。Optionally, in this embodiment of the application, after determining that the external device is an adapter, and the connection line between the terminal and the external device is a standard Type-C line, it can be determined that VOOPPHY controls D+ and D-, at this time, The terminal can use the enablelevel shift function to send pulse trains to activate the adapter, so that normal fast charging communication can be established with the adapter after the adapter is activated.

进一步地,在本申请的实施例中,在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型之后,即步骤101之后,终端进行充电的方法还可以包括以下步骤:Further, in the embodiment of the present application, after establishing the connection with the external device, after determining the connection line type of the connection line with the external device, that is, after step 101, the method for charging the terminal may further include the following steps:

步骤108、在与外接设备断开连接时,关闭第一定时器和第二定时器,初始化连接线标识、第一控制标识、第二控制标识。Step 108, when disconnecting from the external device, turn off the first timer and the second timer, and initialize the connection line identifier, the first control identifier, and the second control identifier.

在本申请的实施例中,终端在与外接设备建立连接之后,在与外接设备断开连接时,可以选择关闭第一定时器和第二定时器,同时,终端还可以初始化连接线标识、第一控制标识以及第二控制标识。In the embodiment of this application, after the terminal establishes a connection with the external device, when disconnecting from the external device, it can choose to close the first timer and the second timer. At the same time, the terminal can also initialize the connection line identifier, the second A control identifier and a second control identifier.

需要说明的是,在本申请的实施例中,如果终端与外接设备断开连接,那么终端便不需要禁止PMIC对所述USB接口的引脚的控制,因此不需要再对无线充电与有线充电之间转换的转换时间进行监控,进而可以选择关闭第一定时器。It should be noted that, in the embodiment of this application, if the terminal is disconnected from the external device, then the terminal does not need to prohibit the PMIC from controlling the pins of the USB interface, so there is no need for wireless charging and wired charging. The transition time between transitions is monitored and the first timer can optionally be turned off.

相应地,在本申请的实施例中,如果终端与外接设备断开连接,那么终端便不需要通过触发APSD中断来进行外接设备的设备类型的确定,因此不需要再确定APSD中断的触发时机,进而可以选择关闭第二定时器。Correspondingly, in the embodiment of the present application, if the terminal is disconnected from the external device, the terminal does not need to trigger the APSD interrupt to determine the device type of the external device, so there is no need to determine the triggering timing of the APSD interrupt. Furthermore, the second timer can be selected to be turned off.

进一步地,在本申请的实施例中,连接线标识可以用于对数据线类型进行确定。具体地,连接线标识可以用于确定是否为DEBUG线。Further, in the embodiment of the present application, the connection line identifier may be used to determine the type of the data line. Specifically, the connection line identifier can be used to determine whether it is a DEBUG line.

示例性的,在本申请中,可以使用变量DEBUG_flag来表示连接线标识。当DEBUG_flag的取值为1或true时,表示数据线为DEBUG线;当DEBUG_flag的取值为0或false时,表示数据线不为DEBUG线。Exemplarily, in this application, the variable DEBUG_flag may be used to represent the connection line identifier. When the value of DEBUG_flag is 1 or true, it means that the data line is a DEBUG line; when the value of DEBUG_flag is 0 or false, it means that the data line is not a DEBUG line.

相应地,在本申请的实施例中,终端在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,如果外接设备对应的连接线类型为调试线,那么终端可以将所述连接线标识的取值设置为第一值。其中,第一值可以为1或true。Correspondingly, in the embodiment of the present application, when the terminal establishes a connection with the external device, after determining the connection line type of the connection line with the external device, if the connection line type corresponding to the external device is a debugging line, then The terminal may set the value of the connection line identifier as the first value. Wherein, the first value may be 1 or true.

进一步地,在本申请的实施例中,第一控制标识可以用于确定是否在充电前禁止USBPHY控制D+、D-。Further, in the embodiment of the present application, the first control flag may be used to determine whether to prohibit the USBPHY from controlling D+ and D− before charging.

示例性的,在本申请中,可以使用变量USB_ROLE来表示第一控制标识。当USB_ROLE的取值为NONE时,表示需要忽略USBPHY的通信,即禁止USBPHY控制D+、D-。Exemplarily, in this application, the variable USB_ROLE may be used to represent the first control identifier. When the value of USB_ROLE is NONE, it means that the communication of USBPHY needs to be ignored, that is, USBPHY is prohibited from controlling D+ and D-.

进一步地,在本申请的实施例中,第二控制标识可以用于确定是否在充电前和充电过程中禁止USBPHY控制D+、D-。Further, in the embodiment of the present application, the second control flag can be used to determine whether to prohibit the USBPHY from controlling D+ and D− before and during charging.

示例性的,在本申请中,可以使用变量ignore_usb_flag来表示第二控制标识。当ignore_usb_flag的取值为1或true时,表示忽略设置USB为HOST或者DEVICE的状态,在进行快充前,释放USBPHY对D+、D-的控制权,同时表示本次连接的后续充电过程中也禁止USBPHY控制D+、D-;当ignore_usb_flag的取值为0或false时,表示在充电前和充电过程中允许USBPHY控制D+、D-。Exemplarily, in this application, the variable ignore_usb_flag may be used to represent the second control flag. When the value of ignore_usb_flag is 1 or true, it means ignoring the state of setting the USB as HOST or DEVICE, releasing the control right of USBPHY to D+ and D- before fast charging, and indicating that the subsequent charging process of this connection is also USBPHY is prohibited from controlling D+ and D-; when the value of ignore_usb_flag is 0 or false, it means that USBPHY is allowed to control D+ and D- before and during charging.

相应地,在本申请的实施例中,终端可以选择将所述第一控制标识的取值设置为第二值,和/或,将所述第二控制标识的取值设置为第三值,从而可以禁止USBPHY对所述USB接口的引脚的控制。其中,第二值可以为NONE,第三值可以为1或true。Correspondingly, in this embodiment of the present application, the terminal may choose to set the value of the first control identifier to a second value, and/or set the value of the second control identifier to a third value, Therefore, the USBPHY can be prohibited from controlling the pins of the USB interface. Wherein, the second value may be NONE, and the third value may be 1 or true.

本申请实施例提供了一种充电方法,在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型;若连接线类型为调试线,且外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对USB接口的引脚的控制;同时启动第一定时器;在超出第一定时器的运行时间之后,禁止PMIC对USB接口的引脚的控制;激活适配器,以建立快充通信。由此可见,在本申请的实施例中,终端可以对外接设备对应的设备类型、连接线类型进行确定,从而可以根据设备类型和连接线类型进一步确定是否禁止USBPHY和PMIC对D+、D-的控制。具体地,在确定外接设备为适配器,外接设备与终端通过DEBUG线连接,且不为无线充电之后,终端可以选择禁止USBPHY和PMIC控制D+、D-,保证仅VOOCPHY能够控制D+、D-,从而可以避免DEBUG线干扰快充通信,能够满足支持使用DEBUG线进行快充的需求,大大提高了充电性能和充电效率。An embodiment of the present application provides a charging method. When establishing a connection with an external device, determine the type of the connection line with the external device; if the type of the connection line is a debugging line, and the device type of the external device is an adapter, Then the pins of the USB interface are set to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; at the same time, the first timer is started; foot control; activate the adapter to establish fast charge communication. It can be seen that, in the embodiment of the present application, the terminal can determine the device type and connection line type corresponding to the external device, so that it can further determine whether to prohibit USBPHY and PMIC from connecting D+ and D- according to the device type and connection line type. control. Specifically, after determining that the external device is an adapter, the external device is connected to the terminal through a DEBUG line, and does not perform wireless charging, the terminal can choose to prohibit USBPHY and PMIC from controlling D+ and D-, so that only VOOPPHY can control D+ and D-, thereby It can avoid the DEBUG line from interfering with the fast charging communication, and can meet the demand of supporting the use of the DEBUG line for fast charging, greatly improving the charging performance and charging efficiency.

基于上述实施例,本申请的另一实施例提出一种充电方法,该充电方法应用于终端,其中,终端可以配置模拟数字信号处理芯片ADSP和应用处理器AP,其中,ADSP与AP之间的通信链路为GLINK。图10为本申请实施例提出的充电方法的实现流程示意图五,如图10所示,终端进行充电的方法还可以包括以下步骤:Based on the above-mentioned embodiments, another embodiment of the present application proposes a charging method, which is applied to a terminal, wherein the terminal can be configured with an analog digital signal processing chip ADSP and an application processor AP, wherein the communication between the ADSP and the AP The communication link is GLINK. FIG. 10 is a schematic diagram of the fifth implementation process of the charging method proposed in the embodiment of the present application. As shown in FIG. 10, the method for charging the terminal may further include the following steps:

步骤201、与外接设备建立连接。Step 201, establish a connection with an external device.

步骤202、触发TYPE-C中断,确定连接线类型。Step 202, triggering a TYPE-C interrupt to determine the connection line type.

步骤203、判断连接线类型是否为DEBUG线,若是,则执行步骤204和步骤205,否则执行步骤215。Step 203 , judging whether the connection line type is a DEBUG line, if yes, execute step 204 and step 205 , otherwise execute step 215 .

在本申请的实施例中,终端在通过连接线与外接设备建立连接之后,可以先对该连接线的具体连接线类型进行确定,从而可以基于该连接线类型进一步确定是否进行快充通信的建立。具体地,终端可以通过触发Type-C中断确定所述连接线的所述连接线类型。其中,连接线类型可以为调试线(DEBUG线)或者TYPE-C线。In the embodiment of the present application, after the terminal establishes a connection with the external device through the connection line, it can first determine the specific connection line type of the connection line, so that it can further determine whether to establish fast charging communication based on the connection line type . Specifically, the terminal may determine the connection line type of the connection line by triggering a Type-C interrupt. Wherein, the connection line type may be a debugging line (DEBUG line) or a TYPE-C line.

示例性的,在本申请中,当插入外接设备时,终端首先会有TYPE-C中断触发,其中,在中断处理函数中,会读相应的TYPE-C寄存器判断插入是标准的TYPE-C线还是DEBUG线。Exemplarily, in this application, when an external device is inserted, the terminal will first trigger a TYPE-C interrupt, wherein, in the interrupt processing function, it will read the corresponding TYPE-C register to determine whether the insertion is a standard TYPE-C line Or the DEBUG line.

步骤204、开启定时器1。Step 204, start timer 1.

步骤205、将连接线标识的取值设置为true。Step 205, set the value of the connection line identifier to true.

在本申请的实施例中,终端在确定连接线类型为DEBUG线之后,可以先开启定时器1,同时可以将连接线标识的取值设置为true。In the embodiment of the present application, after determining that the type of the connection line is a DEBUG line, the terminal may first start timer 1, and at the same time set the value of the connection line identifier to true.

示例性的,在本申请中,如果终端与外接设备通过DEBUG线连接,那么ADSP可以通过GLINK总线发送notify消息给AP,告知AP当前插入的连接线为DEBUG线,相应地,AP可以将连接线标识DEBUG_flag的取值设置为true,即设置DEBUG_flag=true。Exemplarily, in this application, if the terminal is connected to the external device through the DEBUG line, then the ADSP can send a notify message to the AP through the GLINK bus, informing the AP that the currently inserted connection line is the DEBUG line, and accordingly, the AP can connect the connection line The value of the flag DEBUG_flag is set to true, that is, DEBUG_flag=true is set.

步骤206、当到达定时器1的运行时间时,触发APSD中断,确定设备类型。Step 206, when the running time of timer 1 is reached, an APSD interrupt is triggered to determine the device type.

步骤207、判断设备类型是否为适配器,若是,则执行步骤208,否则执行步骤215。Step 207 , judging whether the device type is an adapter, if yes, execute step 208 , otherwise execute step 215 .

步骤208、开启定时器2。Step 208, start timer 2.

在本申请的实施例中,在到达定时器1的运行时间以后,终端可以通过触发APSD中断来确定外接设备的设备类型。如果确定设备类型为适配器,那么终端选择开启定时器2。其中,定时器1的运行时间用于确定APSD中断的触发时机。In the embodiment of the present application, after the running time of timer 1 is reached, the terminal can determine the device type of the external device by triggering an APSD interrupt. If it is determined that the device type is an adapter, then the terminal chooses to start timer 2. Among them, the running time of timer 1 is used to determine the triggering opportunity of APSD interrupt.

可选地,在本申请中,在TYPE-C中断过后一段时间(到达定时器1的运行时间,如几百ms),终端可以选择触发APSD中断,其中,该APSD中断是经过BC1.2充电器类型识别协议得到的结果。当识别到DCP时,表示此时外接设备的设备类型是适配器,因此APSD需要再次通过GLINK总线发送notify消息给AP,告知AP当前插入的外接设备为适配器。Optionally, in this application, after a period of time after the TYPE-C interrupt (reaching the running time of timer 1, such as several hundred ms), the terminal can choose to trigger the APSD interrupt, wherein the APSD interrupt is charged by BC1.2 The result obtained by the device type identification protocol. When the DCP is recognized, it means that the device type of the external device at this time is an adapter, so APSD needs to send a notify message to the AP again through the GLINK bus to inform the AP that the currently inserted external device is an adapter.

进一步地,在本申请中,ADSP可以启动运行时间为800ms的定时器2,从而可以保证从无线充电到有线充电的转换过程的完成。Further, in this application, the ADSP can start the timer 2 with a running time of 800ms, so as to ensure the completion of the conversion process from wireless charging to wired charging.

步骤209、判断是否满足禁止控制D+、D-的条件,若满足,则执行步骤210、步骤211、步骤2012以及步骤2013,否则执行步骤215。Step 209 , judging whether the condition for prohibiting the control of D+ and D− is satisfied, if so, execute step 210 , step 211 , step 2012 and step 2013 , otherwise execute step 215 .

步骤210、将D+、D-设置为高阻状态。Step 210, setting D+ and D- to a high-impedance state.

步骤211、将第一控制标识的取值设置为NONE。Step 211. Set the value of the first control flag to NONE.

步骤212、将第二控制标识的取值设置为true。Step 212. Set the value of the second control identifier to true.

步骤213、当到达定时器2的运行时间时,禁止PMIC和BC1.2的识别功能。Step 213, when the running time of timer 2 is reached, the identification function of PMIC and BC1.2 is disabled.

在本申请的实施例中,终端可以判断是否满足禁止控制D+、D-的条件,如果满足,那么终端可以选择将D+、D-设置为高阻状态,同时可以将第一控制标识的取值设置为NONE,将第二控制标识的取值设置为true,并在到达定时器2的运行时间之后,禁止PMIC和BC1.2的识别功能。其中,终端还可以选择结合充电模式、连接线类型以及设备类型进一步确定是否需要禁止对D+、D-的控制。In the embodiment of the present application, the terminal can judge whether the conditions for prohibiting the control of D+ and D- are satisfied, and if so, the terminal can choose to set D+ and D- to a high-impedance state, and at the same time, set the value of the first control flag to Set it to NONE, set the value of the second control flag to true, and disable the identification function of PMIC and BC1.2 after the running time of timer 2 is reached. Wherein, the terminal may also choose to combine the charging mode, connection line type and device type to further determine whether to prohibit the control of D+ and D-.

具体地,终端在确定与外接设备之间的连接线的连接线类型为调试线、外接设备的设备类型为适配器、充电模式为有线充电时,可以将D+、D-设置为高阻状态,从而禁止USBPHY对D+、D-的控制。然后在超出定时器2的运行时间之后,禁止PMIC对D+、D-的控制。Specifically, when the terminal determines that the connection line type of the connection line with the external device is a debugging line, the device type of the external device is an adapter, and the charging mode is wired charging, it can set D+ and D- to a high-impedance state, thereby Forbid USBPHY to control D+, D-. Then, after exceeding the running time of Timer 2, the PMIC is prohibited from controlling D+ and D-.

示例性的,在本申请中,终端中的AP可以结合已经获取的连接线类型、设备类型以及充电模式判断是否满足禁止控制D+、D-的条件,当DEBUG_flag=true,外接设备为适配器,且不是无线充电时,AP可以确定此时需要忽略USBPHY的通信,因此AP端可以直接设置第一控制标识USB_ROLE的取值为NONE,然后可以通过GLINK作用到ADSP的USBPHY,即将D+、D-的设置成高阻状态。Exemplarily, in this application, the AP in the terminal can combine the obtained connection line type, device type, and charging mode to determine whether the condition for prohibiting the control of D+ and D- is met. When DEBUG_flag=true, the external device is an adapter, and When it is not wireless charging, the AP can determine that the USBPHY communication needs to be ignored at this time, so the AP can directly set the value of the first control flag USB_ROLE to NONE, and then it can be applied to the USBPHY of the ADSP through GLINK, that is, the setting of D+ and D- into a high-impedance state.

需要说明的是,在本申请中,由于无线充电通过无线线圈耦合到vbus上,也会产生类似有线充电的充电器类型识别的动作,因此需要对无线充电的充电模式进行剔除。It should be noted that, in this application, since wireless charging is coupled to the vbus through a wireless coil, an action similar to the identification of the charger type of wired charging will also occur, so the charging mode of wireless charging needs to be eliminated.

可以理解的是,在本申请中,高阻状态表示该状态能和其他的控制D+、D-的状态进行线与,上述其他状态是VOOCPHY和适配器在D+、D-上加载的01的低高电平状态。It can be understood that, in this application, the high-impedance state means that this state can perform wired AND with other states that control D+ and D-. The above-mentioned other states are the low and high levels of 01 loaded on D+ and D- by VOOPPHY and the adapter level status.

进一步地,在本申请的实施例中,为了在快充过程禁止USBPHY控制D+、D-,终端还可以对第二控制标识进行设置,其中,第二控制标识ignore_usb_flag为表示将忽略设置USB为HOST或者DEVICE的状态的标记。相应地,当连接线是DEBUG线时,在进行快充前,释放USBPHY控制D+、D-的权利,同时,通过第二控制标识ignore_usb_flag标记本次连接的后续USBPHY也被禁止控制D+、D-,从而能够实现了DEBUG线支持快充的需求。Further, in the embodiment of the present application, in order to prohibit the USBPHY from controlling D+ and D- during the fast charging process, the terminal can also set the second control flag, wherein the second control flag ignore_usb_flag means that it will ignore setting USB as HOST Or a flag of the status of DEVICE. Correspondingly, when the connection line is a DEBUG line, before fast charging, release the right of USBPHY to control D+, D-, and at the same time, the subsequent USBPHY marked by the second control flag ignore_usb_flag is also prohibited from controlling D+, D- , so that the DEBUG line can support fast charging requirements.

需要说明的是,在本申请的实施例中,由于在无线反向充电后再连接有线快充时,无线反向充电工作的OTG模式准换到普充模式,即无线充电向有线充电转换过程,PMIC需要有一定的转换时间,因此,终端在到达定时器2的运行时间之后,才会选择禁止PMIC和BC1.2的识别功能。It should be noted that, in the embodiment of the present application, when the wireless reverse charging is connected to the wired fast charging, the OTG mode of the wireless reverse charging operation must be switched to the normal charging mode, that is, the conversion process from wireless charging to wired charging , the PMIC needs a certain conversion time, therefore, the terminal will choose to disable the identification function of the PMIC and BC1.2 after reaching the running time of the timer 2.

可选地,在本申请中,ADSP在启动运行时间为800ms的定时器2之后,可以使能VOOCPHY用于快充通信。当到达定时器2的运行时间之后,可以直接将HVDCP和BC1.2的识别给禁止掉,从而可以避免PMIC对D+、D-的控制。Optionally, in this application, ADSP can enable VOOCPHY for fast charging communication after starting timer 2 with a running time of 800ms. When the running time of timer 2 is reached, the identification of HVDCP and BC1.2 can be directly disabled, so that the PMIC can avoid the control of D+ and D-.

也就是说,在本申请中,在确定外接设备为适配器,且外接设备与终端通过调试线连接之后,终端既可以选择禁止USBPHY控制D+、D-,也可以选择同时禁止PMIC控制D+、D-,此时便只有VOOCPHY能够控制D+、D-,从而可以避免调试线(DEBUG线)干扰快充通信。That is to say, in this application, after determining that the external device is an adapter, and the external device is connected to the terminal through a debugging cable, the terminal can either choose to prohibit the USBPHY from controlling D+, D-, or choose to prohibit the PMIC from controlling D+, D- at the same time. At this time, only VOOPPHY can control D+ and D-, so as to avoid the debugging line (DEBUG line) from interfering with the fast charging communication.

步骤214、激活适配器,建立快充通信。Step 214, activate the adapter, and establish fast charging communication.

在本申请的实施例中,终端在完成禁止USBPHY和PMIC控制D+、D-的处理之后,便可以激活适配器,从而可以与适配器建立快充通信。In the embodiment of the present application, after the terminal completes the process of prohibiting USBPHY and PMIC from controlling D+ and D-, it can activate the adapter, so as to establish fast charging communication with the adapter.

可选地,在本申请中,终端可以选择通过enable level shift功能,发脉冲串去激活适配器,激活快充适配器后就能正常快充通信。Optionally, in this application, the terminal can choose to use the enable level shift function to send bursts to deactivate the adapter, and after activating the fast charge adapter, the fast charge communication can be performed normally.

步骤215、不禁止USBPHY和PMIC控制D+、D-。Step 215, do not prohibit USBPHY and PMIC from controlling D+, D-.

进一步地,在本申请的实施例中,图11为本申请实施例提出的充电方法的实现流程示意图六,如图11所示,在与外接设备建立连接之后,即步骤201之后,终端进行充电的方法还可以包括以下步骤:Further, in the embodiment of the present application, FIG. 11 is a schematic diagram of the sixth implementation flow of the charging method proposed in the embodiment of the present application. As shown in FIG. 11 , after the connection with the external device is established, that is, after step 201, the terminal performs charging The method may also include the following steps:

步骤216、在断开与外接设备的连接之后,关闭定时器1和定时器2。Step 216, after the connection with the external device is disconnected, timer 1 and timer 2 are turned off.

步骤207、初始化连接线标识、第一控制标识、第二控制标识。Step 207, initialize the connection line ID, the first control ID, and the second control ID.

在本申请的实施例中,当外接设备与终端断开连接之后,终端可以选择关闭定时器1和定时器2,还可以选择初始化连接线标识、第一控制标识、第二控制标识,即在拔出中断中,可以选择清除掉USB_ROLE、DEBUG_flag、ignore_usb_flag以及timer,回到最初始的状态。In the embodiment of this application, when the external device is disconnected from the terminal, the terminal can choose to turn off timer 1 and timer 2, and can also choose to initialize the connection line identifier, the first control identifier, and the second control identifier, that is, in During the unplugging interrupt, you can choose to clear USB_ROLE, DEBUG_flag, ignore_usb_flag and timer, and return to the initial state.

本申请实施例提供了一种充电方法、终端设备及存储介质,在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型;若连接线类型为调试线,且外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对USB接口的引脚的控制;同时启动第一定时器;在超出第一定时器的运行时间之后,禁止PMIC对USB接口的引脚的控制;激活适配器,以建立快充通信。由此可见,在本申请的实施例中,终端可以对外接设备对应的设备类型、连接线类型进行确定,从而可以根据设备类型和连接线类型进一步确定是否禁止USBPHY和PMIC对D+、D-的控制。具体地,在确定外接设备为适配器,外接设备与终端通过DEBUG线连接,且不为无线充电之后,终端可以选择禁止USBPHY和PMIC控制D+、D-,保证仅VOOCPHY能够控制D+、D-,从而可以避免DEBUG线干扰快充通信,能够满足支持使用DEBUG线进行快充的需求,大大提高了充电性能和充电效率。The embodiment of the present application provides a charging method, a terminal device, and a storage medium. When establishing a connection with an external device, determine the type of the connection line connected to the external device; if the type of the connection line is a debugging line, and the external device If the device type is an adapter, set the pins of the USB interface to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; start the first timer at the same time; after exceeding the running time of the first timer, prohibit PMIC controls the pins of the USB interface; activates the adapter to establish fast charging communication. It can be seen that, in the embodiment of the present application, the terminal can determine the device type and connection line type corresponding to the external device, so that it can further determine whether to prohibit USBPHY and PMIC from connecting D+ and D- according to the device type and connection line type. control. Specifically, after determining that the external device is an adapter, the external device is connected to the terminal through a DEBUG line, and does not perform wireless charging, the terminal can choose to prohibit USBPHY and PMIC from controlling D+ and D-, so that only VOOPPHY can control D+ and D-, thereby It can avoid the DEBUG line from interfering with the fast charging communication, and can meet the demand of supporting the use of the DEBUG line for fast charging, greatly improving the charging performance and charging efficiency.

基于上述实施例,在本申请的另一实施例中,图12为本申请实施例提出的终端设备的组成结构示意图一,如图12所示,本申请实施例提出的终端设备10可以包括确定单元11,设置单元12,禁止单元13,激活单元14,Based on the above embodiments, in another embodiment of the present application, FIG. 12 is a schematic diagram of the composition and structure of the terminal device proposed in the embodiment of the present application. As shown in FIG. 12 , the terminal device 10 proposed in the embodiment of the present application may include a determination unit 11, setting unit 12, disabling unit 13, activating unit 14,

所述确定单元11,用于在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型;The determination unit 11 is configured to determine the connection line type of the connection line with the external device when establishing a connection with the external device;

所述设置单元12,用于若所述连接线类型为调试线,且所述外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动第一定时器;The setting unit 12 is configured to set the pins of the USB interface to a high-impedance state if the connection line type is a debugging line, and the device type of the external device is an adapter, so as to prohibit the USBPHY from controlling the USB interface. The control of the pin; start the first timer at the same time;

所述禁止单元13,用于在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制;The prohibition unit 13 is configured to prohibit the PMIC from controlling the pins of the USB interface after exceeding the running time of the first timer;

所述激活单元14,用于激活所述适配器,以建立快充通信。The activation unit 14 is configured to activate the adapter to establish fast charging communication.

在本申请的实施例中,进一步地,图13为本申请实施例提出的终端设备的组成结构示意图二,如图13所示,本申请实施例提出的终端设备10还可以包括处理器15、存储有处理器15可执行指令的存储器16,进一步地,终端设备10还可以包括通信接口17,和用于连接处理器15、存储器16以及通信接口17的总线18。In the embodiment of the present application, further, FIG. 13 is a second schematic diagram of the composition and structure of the terminal device proposed in the embodiment of the present application. As shown in FIG. 13 , the terminal device 10 proposed in the embodiment of the present application may also include a processor 15, The memory 16 stores instructions executable by the processor 15 . Further, the terminal device 10 may further include a communication interface 17 and a bus 18 for connecting the processor 15 , the memory 16 and the communication interface 17 .

在本申请的实施例中,上述处理器15可以为特定用途集成电路(ApplicationSpecific Integrated Circuit,ASIC)、数字信号处理器(Digital Signal Processor,DSP)、数字信号处理装置(Digital Signal Processing Device,DSPD)、可编程逻辑装置(ProgRAMmable Logic Device,PLD)、现场可编程门阵列(Field ProgRAMmable GateArray,FPGA)、中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本申请实施例不作具体限定。终端设备10还可以包括存储器16,该存储器16可以与处理器15连接,其中,存储器16用于存储可执行程序代码,该程序代码包括计算机操作指令,存储器16可能包含高速RAM存储器,也可能还包括非易失性存储器,例如,至少两个磁盘存储器。In the embodiment of the present application, the above-mentioned processor 15 may be an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD) , Programmable Logic Device (ProgRAMmable Logic Device, PLD), Field Programmable Gate Array (Field ProgRAMmable GateArray, FPGA), Central Processing Unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor at least A sort of. It can be understood that, for different devices, the electronic device used to implement the above processor function may also be other, which is not specifically limited in this embodiment of the present application. The terminal device 10 may also include a memory 16, which may be connected to the processor 15, wherein the memory 16 is used to store executable program codes, the program codes include computer operation instructions, and the memory 16 may include a high-speed RAM memory, and may also include Includes non-volatile memory, eg, at least two disk memories.

在本申请的实施例中,总线18用于连接通信接口17、处理器15以及存储器16以及这些器件之间的相互通信。In the embodiment of the present application, the bus 18 is used to connect the communication interface 17 , the processor 15 and the memory 16 and communicate with each other among these devices.

在本申请的实施例中,存储器16,用于存储指令和数据。In the embodiment of the present application, the memory 16 is used to store instructions and data.

进一步地,在本申请的实施例中,上述处理器15,用于在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型;若所述连接线类型为调试线,且所述外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动第一定时器;在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制;激活所述适配器,以建立快充通信。Further, in the embodiment of the present application, the above-mentioned processor 15 is configured to determine the connection line type of the connection line with the external device when establishing a connection with the external device; if the connection line type is debugging line, and the device type of the external device is an adapter, then the pins of the USB interface are set to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; simultaneously start the first timer; After the running time of the first timer, the PMIC is prohibited from controlling the pins of the USB interface; the adapter is activated to establish fast charging communication.

在实际应用中,上述存储器16可以是易失性存储器(volatile memory),例如随机存取存储器(Random-ACCess Memory,RAM);或者非易失性存储器(non-volatile memory),例如只读存储器(Read-Only Memory,ROM),快闪存储器(flash memory),硬盘(Hard DiskDrive,HDD)或固态硬盘(Solid-State Drive,SSD);或者上述种类的存储器的组合,并向处理器15提供指令和数据。In practical application, the above-mentioned memory 16 may be a volatile memory (volatile memory), such as a random access memory (Random-ACCess Memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (Read-Only Memory, ROM), flash memory (flash memory), hard disk (Hard DiskDrive, HDD) or solid state disk (Solid-State Drive, SSD); instructions and data.

另外,在本实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in this embodiment may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software function modules.

集成的单元如果以软件功能模块的形式实现并非作为独立的产品进行销售或使用时,可以存储在一个计算机可读取存储介质中,基于这样的理解,本实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或processor(处理器)执行本实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read OnlyMemory,ROM)、随机存取存储器(Random ACCess Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or The part contributed by the prior art or the whole or part of the technical solution can be embodied in the form of software products, the computer software products are stored in a storage medium, and include several instructions to make a computer device (which can be a personal A computer, a server, or a network device, etc.) or a processor (processor) executes all or part of the steps of the method of this embodiment. The above-mentioned storage medium includes: U disk, mobile hard disk, read only memory (Read Only Memory, ROM), random access memory (Random ACCess Memory, RAM), magnetic disk or optical disk and other various media that can store program codes.

本申请实施例提供了一种终端设备,在与外接设备建立连接时,确定与外接设备之间的连接线的连接线类型;若连接线类型为调试线,且外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对USB接口的引脚的控制;同时启动第一定时器;在超出第一定时器的运行时间之后,禁止PMIC对USB接口的引脚的控制;激活适配器,以建立快充通信。由此可见,在本申请的实施例中,终端可以对外接设备对应的设备类型、连接线类型进行确定,从而可以根据设备类型和连接线类型进一步确定是否禁止USBPHY和PMIC对D+、D-的控制。具体地,在确定外接设备为适配器,外接设备与终端通过DEBUG线连接,且不为无线充电之后,终端可以选择禁止USBPHY和PMIC控制D+、D-,保证仅VOOCPHY能够控制D+、D-,从而可以避免DEBUG线干扰快充通信,能够满足支持使用DEBUG线进行快充的需求,大大提高了充电性能和充电效率。An embodiment of the present application provides a terminal device that determines the connection line type of the connection line with the external device when establishing a connection with the external device; if the connection line type is a debugging line, and the device type of the external device is an adapter, Then the pins of the USB interface are set to a high-impedance state to prohibit the USBPHY from controlling the pins of the USB interface; at the same time, the first timer is started; foot control; activate the adapter to establish fast charge communication. It can be seen that, in the embodiment of the present application, the terminal can determine the device type and connection line type corresponding to the external device, so that it can further determine whether to prohibit USBPHY and PMIC from connecting D+ and D- according to the device type and connection line type. control. Specifically, after determining that the external device is an adapter, the external device is connected to the terminal through a DEBUG line, and does not perform wireless charging, the terminal can choose to prohibit USBPHY and PMIC from controlling D+ and D-, so that only VOOPPHY can control D+ and D-, thereby It can avoid the DEBUG line from interfering with the fast charging communication, and can meet the demand of supporting the use of the DEBUG line for fast charging, greatly improving the charging performance and charging efficiency.

本申请实施例提供一种计算机可读存储介质,其上存储有程序,该程序被处理器执行时实现如上所述的充电方法。An embodiment of the present application provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the above-mentioned charging method is implemented.

具体来讲,本实施例中的一种充电方法对应的程序指令可以被存储在光盘,硬盘,U盘等存储介质上,当存储介质中的与一种充电方法对应的程序指令被一电子设备读取或被执行时,包括如下步骤:Specifically, the program instructions corresponding to a charging method in this embodiment can be stored on a storage medium such as an optical disc, a hard disk, or a USB flash drive. When the program instructions corresponding to a charging method in the storage medium are stored in an electronic device When read or executed, it includes the following steps:

在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型;When establishing a connection with an external device, determine the connection line type of the connection line with the external device;

若所述连接线类型为调试线,且所述外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动第一定时器;If the connection line type is a debugging line, and the device type of the external device is an adapter, then the pins of the USB interface are set to a high-impedance state, to prohibit USBPHY from controlling the pins of the USB interface; simultaneously start first timer;

在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制;After exceeding the running time of the first timer, prohibiting the PMIC from controlling the pins of the USB interface;

激活所述适配器,以建立快充通信。Activate the adapter to establish fast charge communication.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的实现流程示意图和/或方框图来描述的。应理解可由计算机程序指令实现流程示意图和/或方框图中的每一流程和/或方框、以及实现流程示意图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to the implementation flow diagrams and/or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and/or block in the schematic flowchart and/or block diagram, and a combination of processes and/or blocks in the schematic flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a Means for realizing the functions specified in one or more steps of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in implementing one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在实现流程示意图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in implementing the process flow or processes of the flowchart diagrams and/or the block or blocks of the block diagrams.

以上所述,仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the protection scope of the present application.

Claims (13)

1.一种充电方法,其特征在于,所述方法包括:1. A charging method, characterized in that the method comprises: 在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型;When establishing a connection with an external device, determine the connection line type of the connection line with the external device; 若所述连接线类型为调试线,且所述外接设备的设备类型为适配器,则将通用串行总线USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动第一定时器;If the connection line type is a debugging line, and the device type of the external device is an adapter, then the pins of the Universal Serial Bus USB interface are set to a high-impedance state to prohibit the USBPHY from pinning the USB interface. control; start the first timer at the same time; 在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制;After exceeding the running time of the first timer, prohibiting the PMIC from controlling the pins of the USB interface; 激活所述适配器,以建立快充通信。Activate the adapter to establish fast charge communication. 2.根据权利要求1所述的方法,其特征在于,所述在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型,包括:2. The method according to claim 1, wherein, when establishing a connection with an external device, determining a connection type of the connection line with the external device comprises: 在与所述外接设备建立连接时,通过触发Type-C中断确定所述连接线的所述连接线类型。When establishing a connection with the external device, the type of the connection line of the connection line is determined by triggering a Type-C interrupt. 3.根据权利要求1或2所述的方法,其特征在于,所述在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,所述方法还包括:3. The method according to claim 1 or 2, characterized in that, after establishing the connection with the external device, after determining the connection line type of the connection line with the external device, the method further comprises: 若所述连接线类型为Type-C线,且所述外接设备的设备类型为适配器,则激活所述适配器,以建立快充通信。If the connection line type is a Type-C line and the device type of the external device is an adapter, activate the adapter to establish fast charging communication. 4.根据权利要求2所述的方法,其特征在于,所述在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,所述方法还包括:4. The method according to claim 2, characterized in that, after establishing the connection with the external device, after determining the connection line type of the connection line with the external device, the method further comprises: 确定所述外接设备的所述设备类型。The device type of the external device is determined. 5.根据权利要求4所述的方法,其特征在于,所述确定所述外接设备的所述设备类型,包括:5. The method according to claim 4, wherein the determining the device type of the external device comprises: 在触发Type-C中断之后,启动第二定时器;After triggering the Type-C interrupt, start the second timer; 在超出所述第二定时器的运行时间之后,通过触发APSD中断确定所述外接设备对应的端口信息;After the running time of the second timer is exceeded, determine the port information corresponding to the external device by triggering an APSD interrupt; 根据所述端口信息确定所述设备类型。Determine the device type according to the port information. 6.根据权利要求5所述的方法,其特征在于,所述根据所述端口信息确定所述设备类型,包括:6. The method according to claim 5, wherein the determining the device type according to the port information comprises: 若所述端口信息为专用充电端口DCP,则确定所述设备类型为所述适配器。If the port information is a dedicated charging port DCP, it is determined that the device type is the adapter. 7.根据权利要求5所述的方法,其特征在于,所述在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型之后,所述方法还包括:7. The method according to claim 5, characterized in that, after establishing the connection with the external device, after determining the connection line type of the connection line with the external device, the method further comprises: 在与所述外接设备断开连接时,关闭所述第一定时器和所述第二定时器,初始化连接线标识、第一控制标识、第二控制标识。When the connection with the external device is disconnected, the first timer and the second timer are turned off, and the connection line identifier, the first control identifier, and the second control identifier are initialized. 8.根据权利要求7所述的方法,其特征在于,所述方法还包括:8. The method according to claim 7, further comprising: 若所述连接线类型为调试线,则将所述连接线标识的取值设置为第一值。If the connection line type is a debugging line, then set the value of the connection line identifier as the first value. 9.根据权利要求7所述的方法,其特征在于,所述方法还包括:9. The method according to claim 7, further comprising: 将所述第一控制标识的取值设置为第二值,和/或,将所述第二控制标识的取值设置为第三值,以禁止USBPHY对所述USB接口的引脚的控制。Set the value of the first control flag to a second value, and/or set the value of the second control flag to a third value, so as to prohibit the USBPHY from controlling the pins of the USB interface. 10.根据权利要求1所述的方法,其特征在于,所述方法还包括:10. The method of claim 1, further comprising: 若所述连接线类型为调试线,所述设备类型为所述适配器,且所述充电模式为有线充电,则将所述USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动所述第一定时器。If the connection line type is a debugging line, the device type is the adapter, and the charging mode is wired charging, then set the pins of the USB interface to a high-impedance state to prohibit the USBPHY from charging the USB control of the pins of the interface; and simultaneously start the first timer. 11.一种终端设备,其特征在于,所述终端设备包括:确定单元,设置单元,禁止单元,激活单元,11. A terminal device, characterized in that the terminal device comprises: a determination unit, a setting unit, a prohibition unit, an activation unit, 所述确定单元,用于在与外接设备建立连接时,确定与所述外接设备之间的连接线的连接线类型;The determination unit is configured to determine the connection line type of the connection line with the external device when establishing a connection with the external device; 所述设置单元,用于若所述连接线类型为调试线,且所述外接设备的设备类型为适配器,则将USB接口的引脚设置为高阻状态,以禁止USBPHY对所述USB接口的引脚的控制;同时启动第一定时器;The setting unit is configured to set the pins of the USB interface to a high-impedance state if the connection line type is a debugging line, and the device type of the external device is an adapter, so as to prohibit the USBPHY from controlling the USB interface. Pin control; start the first timer at the same time; 所述禁止单元,用于在超出所述第一定时器的运行时间之后,禁止PMIC对所述USB接口的引脚的控制;The prohibition unit is configured to prohibit the PMIC from controlling the pins of the USB interface after exceeding the running time of the first timer; 所述激活单元,用于激活所述适配器,以建立快充通信。The activation unit is configured to activate the adapter to establish fast charging communication. 12.一种终端设备,其特征在于,所述终端设备包括处理器、存储有所述处理器可执行指令的存储器,当所述指令被所述处理器执行时,实现如权利要求1-10任一项所述的方法。12. A terminal device, characterized in that the terminal device includes a processor and a memory storing instructions executable by the processor, and when the instructions are executed by the processor, the implementation of claims 1-10 any one of the methods described. 13.一种计算机可读存储介质,其上存储有程序,其特征在于,所述程序被处理器执行时,实现如权利要求1-10任一项所述的方法。13. A computer-readable storage medium, on which a program is stored, wherein when the program is executed by a processor, the method according to any one of claims 1-10 is implemented.
CN202110684978.4A 2021-06-21 2021-06-21 Charging method, terminal device and storage medium Pending CN115576877A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110684978.4A CN115576877A (en) 2021-06-21 2021-06-21 Charging method, terminal device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110684978.4A CN115576877A (en) 2021-06-21 2021-06-21 Charging method, terminal device and storage medium

Publications (1)

Publication Number Publication Date
CN115576877A true CN115576877A (en) 2023-01-06

Family

ID=84578780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110684978.4A Pending CN115576877A (en) 2021-06-21 2021-06-21 Charging method, terminal device and storage medium

Country Status (1)

Country Link
CN (1) CN115576877A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080042616A1 (en) * 2006-08-17 2008-02-21 Monks Morgan H System and Method for Rapidly Charging a USB Device
CN102640130A (en) * 2009-11-23 2012-08-15 高通股份有限公司 Apparatus and methods for USB connection in a multi-processor device
US20190236037A1 (en) * 2019-03-27 2019-08-01 Suresh Sugumar Low pin-count architecture with prioritized message arbitration and delivery
CN111400220A (en) * 2020-03-16 2020-07-10 中科创达软件股份有限公司 Cable and method of use thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080042616A1 (en) * 2006-08-17 2008-02-21 Monks Morgan H System and Method for Rapidly Charging a USB Device
CN102640130A (en) * 2009-11-23 2012-08-15 高通股份有限公司 Apparatus and methods for USB connection in a multi-processor device
US20190236037A1 (en) * 2019-03-27 2019-08-01 Suresh Sugumar Low pin-count architecture with prioritized message arbitration and delivery
CN111400220A (en) * 2020-03-16 2020-07-10 中科创达软件股份有限公司 Cable and method of use thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
TEXAS INSTRUMENTS: "How to Design Flexible Processor Power Systems Using PMICs", APPLICATION REPORT, 31 January 2020 (2020-01-31) *

Similar Documents

Publication Publication Date Title
CN110829523B (en) Electronic equipment and reverse charging method
CN101663634B (en) Connection of USB devices
US8332545B1 (en) USB switch which allows primary USB connection in response to USB signaling
CN102591837B (en) USB (universal serial bus) (USB) is hung up and the enhancing of recovery operation
CN103744821B (en) Method and device for realizing USB OTG (Universal Serial Bus On-The-Go) function of mobile terminal
EP2498167B1 (en) Multiple connections to a single serial interface
CN106571657B (en) Terminal, converter, and connection conversion system and method
CN104081368A (en) Mobile device automatic detection apparatus and method
WO2008001153A1 (en) Device and method for detecting a usb charger
CN106356918B (en) A fast charging identification method and terminal equipment
US20140156884A1 (en) Adaptive accessory detection and mode negotiation
AU2008243700B2 (en) A docking station
CN101901201A (en) Method and device for realizing USB OTG function on electronic equipment
KR20130097198A (en) Charginig port
CN101498756B (en) Discrimination method and apparatus for external device connected with portable terminal set
US20110320837A1 (en) Power supply circuit, power supply method, and signal processing apparatus
CN101853970A (en) Method and device for charging through universal serial bus (USB) interface
CN112799985B (en) USB interface control method, USB control circuit and intelligent networking equipment mainboard
CN104953631A (en) Current control method and terminal device
CN115576877A (en) Charging method, terminal device and storage medium
CN114706801B (en) USB output path conversion circuit and device
WO2016141554A1 (en) Self-loop detection method and apparatus for charging device
CN111049202B (en) A method, device and computer-readable storage medium for identifying charging type
TWI640873B (en) Method for triggering fast charging mode of usb device and system and storage medium thereof
TW202221522A (en) Electronic device supporting type-c connection and method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination