CN107643998A - OTG and the difunctional system that charges are realized based on intelligent object - Google Patents
OTG and the difunctional system that charges are realized based on intelligent object Download PDFInfo
- Publication number
- CN107643998A CN107643998A CN201710801156.3A CN201710801156A CN107643998A CN 107643998 A CN107643998 A CN 107643998A CN 201710801156 A CN201710801156 A CN 201710801156A CN 107643998 A CN107643998 A CN 107643998A
- Authority
- CN
- China
- Prior art keywords
- usb
- pin
- power supply
- port
- otg
- 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.)
- Granted
Links
Landscapes
- Charge And Discharge Circuits For Batteries Or The Like (AREA)
Abstract
本发明公开了一种基于智能模块实现OTG和充电双功能的系统,包括智能模块、切换电路、适配器输入端和USB端口,智能模块包括USB功能单元、充电管理单元、GPIO管脚,智能模块根据USB规范获取连接的设备类型,即在检测到USB供电管脚由低电平变为高电平以及USB ID管脚由高电平变为低电平时表明适配器和OTG从设备共存,此时智能模块就将GPIO管脚设置为高电平来控制切换电路将适配器作为智能模块的电源并进行充电以及将智能模块的供电电源向OTG从设备供电,从而实现OTG和充电双功能。本发明通过切换电路将适配器与OTG从设备的供电硬件分离,并用软件流程控制切换电路实现完全分离来实现OTG和充电双功能。
The invention discloses a system for realizing dual functions of OTG and charging based on an intelligent module, which includes an intelligent module, a switching circuit, an adapter input terminal and a USB port, the intelligent module includes a USB function unit, a charging management unit, and GPIO pins, and the intelligent module is based on The USB specification obtains the connected device type, that is, when it detects that the USB power supply pin changes from low level to high level and the USB ID pin changes from high level to low level, it indicates that the adapter and the OTG slave device coexist. At this time, the smart The module sets the GPIO pin to a high level to control the switching circuit to use the adapter as the power supply of the smart module and to charge it, and to supply power to the OTG slave device from the power supply of the smart module, thereby realizing the dual functions of OTG and charging. The invention separates the adapter from the power supply hardware of the OTG slave equipment through the switching circuit, and uses the software process to control the switching circuit to realize the complete separation to realize the dual functions of OTG and charging.
Description
技术领域technical field
本发明涉及智能设备领域,特别涉及一种基于智能模块实现OTG和充电双功能的系统。The invention relates to the field of intelligent equipment, in particular to a system for realizing dual functions of OTG and charging based on an intelligent module.
背景技术Background technique
现有智能终端在使用OTG(On the Go,主要应用于各种不同的设备或移动设备间的联接,进行数据交换)从设备,智能终端就为host(主设备),而在充电时智能终端为device(从设备),造成智能终端在使用OTG从设备时不支持充电,或在充电时不支持OTG从设备,但是越来越多的客户需要在智能终端设备作为host时也能进行充电,以保证设备在连续使用过程中不至于电池耗尽而关机。The existing smart terminal is using OTG (On the Go, mainly used for connection between various devices or mobile devices for data exchange) slave device, the smart terminal is the host (master device), and when charging, the smart terminal As a device (slave device), the smart terminal does not support charging when using the OTG slave device, or does not support the OTG slave device when charging, but more and more customers need to be able to charge when the smart terminal device is used as a host. In order to ensure that the device will not be shut down due to battery depletion during continuous use.
发明内容Contents of the invention
本发明要解决的技术问题是为了克服现有技术中智能终端在使用OTG从设备时不支持充电,或在充电时不支持OTG从设备的缺陷,提供一种基于智能模块实现OTG和充电双功能的系统。The technical problem to be solved by the present invention is to overcome the defect that the intelligent terminal does not support charging when using the OTG slave device in the prior art, or does not support the defect of the OTG slave device when charging, and provides a dual function of OTG and charging based on an intelligent module. system.
本发明是通过下述技术方案来解决上述技术问题:The present invention solves the above technical problems through the following technical solutions:
一种基于智能模块实现OTG和充电双功能的系统,其特点是,包括智能模块、切换电路、适配器输入端和USB端口,所述智能模块包括USB功能单元、充电管理单元、GPIO管脚,所述USB功能单元包括USB供电管脚、USB数据正端管脚、USB数据负端管脚、USB ID管脚,所述充电管理单元包括供电管脚,所述切换电路包括第一端口、第二端口、第三端口和控制端口,所述USB端口用于连接OTG从设备,所述适配器输入端用于连接适配器,所述供电管脚连接所述智能模块的供电电源;A system that realizes OTG and charging dual functions based on an intelligent module is characterized in that it includes an intelligent module, a switching circuit, an adapter input terminal and a USB port, and the intelligent module includes a USB functional unit, a charging management unit, and a GPIO pin, and the The USB functional unit includes a USB power supply pin, a USB data positive terminal pin, a USB data negative terminal pin, and a USB ID pin, the charging management unit includes a power supply pin, and the switching circuit includes a first port, a second port, a third port and a control port, the USB port is used to connect the OTG slave device, the adapter input is used to connect the adapter, and the power supply pin is connected to the power supply of the smart module;
所述USB数据正端管脚、所述USB数据负端管脚、所述USB ID管脚与所述USB端口相应连接,所述适配器输入端分别与所述第一端口、所述USB供电管脚连接,所述GPIO管脚与所述控制端口连接,所述USB端口的电源端与所述第二端口连接,所述供电管脚与所述第三端口连接;The USB data positive terminal pin, the USB data negative terminal pin, and the USB ID pin are connected to the USB port correspondingly, and the adapter input terminal is connected to the first port and the USB power supply tube respectively. Pin connection, the GPIO pin is connected to the control port, the power supply end of the USB port is connected to the second port, and the power supply pin is connected to the third port;
在所述智能模块检测到所述USB供电管脚由低电平变为高电平以及所述智能模块检测到所述USB ID管脚由高电平变为低电平时,所述智能模块将所述GPIO管脚设置为高电平用于控制所述切换电路将所述第二端口与所述第一端口断开以及将所述第二端口与所述第三端口导通,所述智能模块通过所述USB供电管脚从所述适配器输入端获取电源,并且所述充电管理单元通过所述供电管脚向所述智能模块的供电电源充电以及所述智能模块的供电电源通过所述切换电路向所述OTG设备供电,所述智能模块通过所述USB数据正极管脚、所述USB数据负极管脚与所述OTG从设备完成数据交换。When the smart module detects that the USB power supply pin changes from low level to high level and when the smart module detects that the USB ID pin changes from high level to low level, the smart module will The GPIO pin is set to a high level to control the switching circuit to disconnect the second port from the first port and to connect the second port to the third port. The module obtains power from the adapter input terminal through the USB power supply pin, and the charging management unit charges the power supply of the smart module through the power supply pin, and the power supply of the smart module passes through the switching The circuit supplies power to the OTG device, and the intelligent module completes data exchange with the OTG slave device through the USB data positive pin and the USB data negative pin.
本方案中,所述USB功能单元用于所述智能模块实现USB功能,比如当接入到所述USB端口的设备为OTG从设备时,根据USB规范,这时OTG从设备就将所述USB ID管脚拉低,使得所述智能模块成为host,通过内置的软件就能实现OTG功能,而当接入到所述USB端口的设备为主设备如PC(个人电脑)时,根据USB规范,主设备将所述USB数据正端管脚与所述USB数据负端管脚短接在一起而使得这两个管脚不存在电平差,这时所述智能模块就作为device,通过内置的软件就能实现USB充电和/或数据通信,又比如当所述USB供电管脚接入外部的电源如适配器时管脚电平就由低电平变成高电平,根据USB规范,所述智能模块就能获知所述USB供电管脚接入了外部电源,这时所述智能模块就从该外部电源获取电源,并通过所述充电管理单元对所述智能模块的供电电源进行充电。因此,在所述智能模块检测到所述USB供电管脚由低电平变为高电平以及所述智能模块检测到所述USB ID管脚由高电平变为低电平时,即所述智能模块检测到既接入了外部电源又接入了OTG从设备,这时所述智能模块就将所述GPIO管脚设置为高电平,一方面使得所述切换电路将外部电源用于对所述智能模块进行供电并通过所述充电管理单元对所述智能模块的供电电源比如电池进行充电管理,另一方面使得所述切换电路将所述智能模块的供电电源向OTG从设备供电,这时所述智能模块通过所述USB数据正极管脚、所述USB数据负极管脚与OTG从设备完成数据交换,从而所述智能模块就实现了OTG功能和充电功能的共存。In this solution, the USB functional unit is used for the intelligent module to realize the USB function. For example, when the device connected to the USB port is an OTG slave device, according to the USB specification, the OTG slave device will transfer the USB The ID pin is pulled low, so that the intelligent module becomes a host, and the OTG function can be realized by the built-in software, and when the device connected to the USB port is the main device such as a PC (personal computer), according to the USB specification, The master device short-circuits the USB data positive terminal pin and the USB data negative terminal pin together so that there is no level difference between the two pins. Software can realize USB charging and/or data communication. For example, when the USB power supply pin is connected to an external power source such as an adapter, the pin level changes from low level to high level. According to the USB specification, the The smart module can know that the USB power supply pin is connected to an external power supply, and then the smart module obtains power from the external power supply, and charges the power supply of the smart module through the charging management unit. Therefore, when the smart module detects that the USB power supply pin changes from low level to high level and the smart module detects that the USB ID pin changes from high level to low level, the The smart module detects that both the external power supply and the OTG slave device are connected, and at this moment the smart module sets the GPIO pin to a high level, which on the one hand makes the switching circuit use the external power supply for The intelligent module supplies power and manages charging the power supply of the intelligent module such as a battery through the charging management unit, and on the other hand makes the switching circuit supply power to the OTG slave device from the power supply of the intelligent module. At this time, the intelligent module completes data exchange with the OTG slave device through the USB data positive pin and the USB data negative pin, so that the intelligent module realizes the coexistence of the OTG function and the charging function.
较佳地,在所述智能模块检测到所述USB供电管脚、所述USB数据负端管脚均为低电平状态且所述USB数据正端管脚、所述USB ID管脚均为高电平时,所述智能模块将所述GPIO管脚默认设置为低电平,所述切换电路包括第一电阻、第二电阻、第一三极管、第二三极管和PMOS管,所述PMOS管的漏极用于作为所述第一端口,所述PMOS管的源极分别与所述第一电阻一端、所述第二电阻一端连接后作为所述第二端口,所述PMOS管的栅极分别与所述第一电阻另一端、所述第一三极管的集电极连接,所述第一三极管的发射极接地,所述第一三极管的基极分别与所述第二电阻另一端、第二三极管的集电极连接,所述第二三极管的发射极接地,所述第二三极管的基极作为所述控制端口。Preferably, when the smart module detects that the USB power supply pin and the USB data negative pin are both in a low level state and that the USB data positive pin and the USB ID pin are both When the level is high, the intelligent module sets the GPIO pin to a low level by default, and the switching circuit includes a first resistor, a second resistor, a first triode, a second triode and a PMOS tube, so The drain of the PMOS transistor is used as the first port, the source of the PMOS transistor is respectively connected to one end of the first resistor and one end of the second resistor as the second port, and the PMOS transistor The grid of the first resistor is respectively connected to the other end of the first resistor and the collector of the first triode, the emitter of the first triode is grounded, and the base of the first triode is respectively connected to the first triode. The other end of the second resistor is connected to the collector of the second triode, the emitter of the second triode is grounded, and the base of the second triode serves as the control port.
本方案中,所述切换电路利用MOS管(绝缘栅型场效应管)、三极管的开关特性,并根据所述适配器输入端和所述USB端口均为悬空状态设置所述GPIO管脚为低电平,从而保证所述基于智能模块实现OTG和充电双功能的系统在具有OTG功能和充电功能共存基础上,仍然具有完整、独立的OTG功能和充电功能,即单独所述适配器输入端连接适配器时,所述基于智能模块实现OTG和充电双功能的系统就能独立充电,单独所述USB端口接入OTG从设备时就能独立进行OTG通信或单独所述USB端口接入主设备时所述智能模块就作为device实现通信。当然,同时接入OTG从设备和适配器,所述基于智能模块实现OTG和充电双功能的系统就同时具有OTG功能和充电功能。In this solution, the switching circuit utilizes the switching characteristics of MOS transistors (insulated gate field effect transistors) and triodes, and sets the GPIO pins as low power according to the adapter input terminal and the USB port being suspended. level, so as to ensure that the system based on the intelligent module to realize the dual functions of OTG and charging still has a complete and independent OTG function and charging function on the basis of the coexistence of OTG function and charging function, that is, when the adapter input terminal is connected to the adapter alone , the system based on the intelligent module to realize the dual functions of OTG and charging can be charged independently, and the OTG communication can be carried out independently when the USB port is connected to the OTG slave device alone, or the smart The module communicates as a device. Of course, if the OTG slave device and the adapter are connected at the same time, the system that realizes the dual functions of OTG and charging based on the intelligent module has both the OTG function and the charging function.
较佳地,所述充电管理单元还包括供电电压检测管脚,所述供电电压检测管脚与所述智能模块的供电电源连接,当所述充电管理单元检测到所述智能模块的供电电源为充满电状态时,所述充电管理单元停止通过所述供电管脚向所述智能模块的供电电源充电。Preferably, the charging management unit further includes a power supply voltage detection pin, the power supply voltage detection pin is connected to the power supply of the smart module, when the charging management unit detects that the power supply of the smart module is When fully charged, the charging management unit stops charging the power supply of the smart module through the power supply pin.
本方案中,通过监测所述智能模块的供电电源的电量状态从而决定是否继续充电,进一步提高可靠性和安全性。In this solution, whether to continue charging is determined by monitoring the power state of the power supply of the intelligent module, thereby further improving reliability and safety.
较佳地,所述切换电路还包括第三电阻,所述第三电阻一端与所述第二三极管的基极连接、另一端接地。Preferably, the switching circuit further includes a third resistor, one end of the third resistor is connected to the base of the second triode, and the other end is grounded.
较佳地,所述切换电路还包括稳压电路,所述稳压电路还包括使能端,所述使能端与所述控制端口连接,所述稳压电路的输入端为所述第三端口,所述稳压电路的输出端为所述第二端口,所述使能端为高电平有效用于控制所述稳压电路将所述智能模块的供电电源稳压后通过所述第二端口输出。Preferably, the switching circuit further includes a voltage stabilizing circuit, and the voltage stabilizing circuit further includes an enable terminal connected to the control port, and the input terminal of the voltage stabilizing circuit is the third port, the output terminal of the voltage stabilizing circuit is the second port, and the enabling terminal is active at a high level for controlling the voltage stabilizing circuit to stabilize the power supply of the intelligent module through the second port. Two port output.
本方案中,利用所述稳压电路来使得所述智能模块的供电电源与所述OTG从设备的电源需求进行匹配来进一步提高所述基于智能模块实现OTG和充电双功能的系统的使用灵活性。其中,所述稳压电路一般采用稳压芯片作为核心器件,鉴于现有应用中,智能模块的工作电压范围一般是3.5V-4.2V,而OTG从设备的供电电压一般是5V,即所述智能模块的供电电源的电压值低于所述OTG从设备的电源需求,所以所述稳压电路就采用升压型稳压芯片。In this solution, the voltage stabilizing circuit is used to match the power supply of the smart module with the power demand of the OTG slave device to further improve the flexibility of use of the system that realizes dual functions of OTG and charging based on the smart module . Wherein, the voltage stabilizing circuit generally adopts a voltage stabilizing chip as a core device. In view of existing applications, the operating voltage range of the smart module is generally 3.5V-4.2V, and the power supply voltage of the OTG slave device is generally 5V, that is, the The voltage value of the power supply of the intelligent module is lower than the power demand of the OTG slave device, so the voltage stabilizing circuit adopts a step-up voltage stabilizing chip.
较佳地,所述稳压电路还包括二极管,所述稳压电路的输出端与所述二极管的阳极连接,所述二极管的阴极作为所述第二端口。本方案中,利用二极管的单向导通特性来保护所述稳压电路,提高电路可靠性和安全性。Preferably, the voltage stabilizing circuit further includes a diode, the output terminal of the voltage stabilizing circuit is connected to the anode of the diode, and the cathode of the diode serves as the second port. In this solution, the unidirectional conduction characteristic of the diode is used to protect the voltage stabilizing circuit, thereby improving circuit reliability and safety.
本发明的积极进步效果在于:本发明通过增加切换电路将外部适配器电源的输入与OTG从设备的供电进行硬件分离,并结合软件流程通过GPIO(General Purpose InputOutput,通用输入/输出)接口控制切换电路,从而实现外部适配器电源的输入和OTG从设备的供电完全分离,使得智能设备同时支持OTG从设备和充电功能。The positive progress effect of the present invention is: the present invention carries out the hardware separation of the input of external adapter power supply and the power supply of OTG from equipment by increasing switching circuit, and controls switching circuit by GPIO (General Purpose Input/Output, general purpose input/output) interface in conjunction with software flow , so that the input of the external adapter power supply and the power supply of the OTG slave device are completely separated, so that the smart device supports both the OTG slave device and the charging function.
附图说明Description of drawings
图1为本发明较佳实施例的基于智能模块实现OTG和充电双功能的系统的示意图。Fig. 1 is a schematic diagram of a system for realizing dual functions of OTG and charging based on an intelligent module according to a preferred embodiment of the present invention.
图2为本发明较佳实施例的基于智能模块实现OTG和充电双功能的系统的内置软件的流程示意图。Fig. 2 is a schematic flow chart of the built-in software of the system based on the intelligent module to realize the dual functions of OTG and charging according to the preferred embodiment of the present invention.
具体实施方式detailed description
下面通过实施例的方式进一步说明本发明,但并不因此将本发明限制在所述的实施例范围之中。The present invention is further illustrated below by means of examples, but the present invention is not limited to the scope of the examples.
如图1-2所示,本实施例涉及的基于智能模块实现OTG和充电双功能的系统,包括智能模块1、切换电路2、适配器输入端3和USB端口4,所述智能模块1包括USB功能单元11、充电管理单元12、GPIO管脚,所述USB功能单元11包括USB供电管脚USB_VBUS、USB数据正端管脚USB_DP、USB数据负端管脚USB_DN、USB ID管脚USB_ID,所述充电管理单元12包括供电管脚VBAT,所述切换电路2包括第一端口21、第二端口22、第三端口23和控制端口24,所述USB端口4用于连接OTG从设备,所述适配器输入端3用于连接适配器,所述供电管脚VBAT连接所述智能模块的供电电源5;As shown in Figure 1-2, the system for realizing dual functions of OTG and charging based on the intelligent module involved in this embodiment includes an intelligent module 1, a switching circuit 2, an adapter input terminal 3 and a USB port 4, and the intelligent module 1 includes a USB Functional unit 11, charging management unit 12, and GPIO pins. The USB functional unit 11 includes a USB power supply pin USB_VBUS, a USB data positive pin USB_DP, a USB data negative pin USB_DN, and a USB ID pin USB_ID. The charging management unit 12 includes a power supply pin VBAT, the switching circuit 2 includes a first port 21, a second port 22, a third port 23 and a control port 24, and the USB port 4 is used to connect an OTG slave device, and the adapter The input terminal 3 is used to connect the adapter, and the power supply pin VBAT is connected to the power supply 5 of the intelligent module;
所述USB数据正端管脚USB_DP、所述USB数据负端管脚USB_DN、所述USB ID管脚USB_ID与所述USB端口4相应连接,所述适配器输入端3分别与所述第一端口21、所述USB供电管脚USB_VBUS连接,所述GPIO管脚与所述控制端口24连接,所述USB端口4的电源端与所述第二端口22连接,所述供电管脚VBAT与所述第三端口23连接;The USB data positive pin USB_DP, the USB data negative pin USB_DN, and the USB ID pin USB_ID are connected to the USB port 4 correspondingly, and the adapter input 3 is connected to the first port 21 respectively. , the USB power supply pin USB_VBUS is connected, the GPIO pin is connected to the control port 24, the power supply end of the USB port 4 is connected to the second port 22, and the power supply pin VBAT is connected to the second port 22. Three-port 23 connections;
在所述智能模块1根据内置软件流程(如图2所示)检测到所述USB供电管脚USB_VBUS由低电平变为高电平以及所述智能模块1检测到所述USB ID管脚USB_ID由高电平变为低电平时,所述智能模块1将所述GPIO管脚设置为高电平用于控制所述切换电路2将所述第二端口22与所述第一端口21断开以及将所述第二端口22与所述第三端口23导通,所述智能模块1通过所述USB供电管脚USB_VBUS从所述适配器输入端3获取电源,并且所述充电管理单元12通过所述供电管脚VBAT向所述智能模块1的供电电源5充电以及所述智能模块1的供电电源5通过所述切换电路2向所述OTG从设备(图1中未标识出所述OTG从设备)供电,所述智能模块1通过所述USB数据正极管脚USB_DP、所述USB数据负极管脚USB_DN与所述OTG从设备完成数据交换。本实施例具体实施中,所述智能模块1的供电电源5一般优选电池,比如锂电池,且可以为单节锂电池或者相互并联的双节锂电池,单节锂电池的电压一般为4.2V;所述智能模块1包括智能芯片,比如直接优选高通msm8909平台作为所述智能模块的核心,该平台包括有USB、充电管理等功能单元,所以当接入到所述USB端口4的设备为OTG从设备时,根据USB规范,这时OTG从设备就将所述USB ID管脚USB_ID拉低,使得所述智能模块1成为host,通过内置的软件就能实现OTG功能,而当接入到所述USB端口4的设备为主设备(图1中未标识出主设备)如PC(个人电脑)时,根据USB规范,主设备将所述USB数据正端管脚USB_DP与所述USB数据负端管脚USB_DN短接在一起而使得这两个管脚不存在电平差,这时所述智能模块1就作为device,通过内置的软件就能实现USB充电和/或数据通信,又比如当所述USB供电管脚USB_VBUS接入外部的电源如适配器时管脚电平就由低电平变成高电平,根据USB规范,所述智能模块就能获知所述USB供电管脚USB_VBUS接入了外部电源,这时所述智能模块1就从该外部电源获取电源,并通过所述充电管理单元12对所述智能模块1的供电电源5进行充电。因此,在所述智能模块1检测到所述USB供电管脚USB_VBUS由低电平变为高电平以及所述智能模块1检测到所述USB ID管脚USB_ID由高电平变为低电平时,即所述智能模块1检测到既接入了外部电源又接入了OTG从设备,这时所述智能模块1就将所述GPIO管脚设置为高电平,一方面使得所述切换电路2将外部电源用于对所述智能模块1进行供电并通过所述充电管理单元12对所述智能模块1的供电电源5进行充电管理,另一方面使得所述切换电路2将所述智能模块1的供电电源5向OTG从设备供电,这时所述智能模块1通过所述USB数据正极管脚USB_DP、所述USB数据负极管脚USB_DN与OTG从设备完成数据交换,从而所述智能模块就实现了OTG功能和充电功能的共存。When the smart module 1 detects that the USB power supply pin USB_VBUS changes from a low level to a high level according to the built-in software process (as shown in FIG. 2 ) and the smart module 1 detects that the USB ID pin USB_ID When changing from a high level to a low level, the intelligent module 1 sets the GPIO pin to a high level for controlling the switching circuit 2 to disconnect the second port 22 from the first port 21 And connect the second port 22 with the third port 23, the smart module 1 obtains power from the adapter input 3 through the USB power supply pin USB_VBUS, and the charging management unit 12 obtains power through the The power supply pin VBAT charges the power supply 5 of the smart module 1 and the power supply 5 of the smart module 1 charges the OTG slave device (the OTG slave device is not marked in Fig. 1 ) through the switching circuit 2 ), the smart module 1 completes data exchange with the OTG slave device through the USB data positive pin USB_DP and the USB data negative pin USB_DN. In the specific implementation of this embodiment, the power supply 5 of the intelligent module 1 is generally preferably a battery, such as a lithium battery, and can be a single-cell lithium battery or a double-cell lithium battery connected in parallel, and the voltage of a single-cell lithium battery is generally 4.2V. Described intelligent module 1 comprises intelligent chip, such as direct preferred high-pass msm8909 platform as the core of described intelligent module, this platform includes functional units such as USB, charging management, so when the equipment that is inserted into described USB port 4 is OTG When a slave device, according to the USB specification, the OTG slave device will pull down the USB ID pin USB_ID at this time, so that the intelligent module 1 becomes a host, and the OTG function can be realized through the built-in software, and when connected to the When the device of the USB port 4 is a master device (the master device is not identified in Fig. 1 ) such as a PC (personal computer), according to the USB specification, the master device connects the USB data positive terminal pin USB_DP to the USB data negative terminal The pins USB_DN are shorted together so that there is no level difference between the two pins. At this time, the smart module 1 is used as a device, and USB charging and/or data communication can be realized through the built-in software. When the USB power supply pin USB_VBUS is connected to an external power source such as an adapter, the pin level changes from low level to high level. According to the USB specification, the smart module can know that the USB power supply pin USB_VBUS is connected An external power source, at this time, the smart module 1 obtains power from the external power source, and charges the power supply 5 of the smart module 1 through the charging management unit 12 . Therefore, when the smart module 1 detects that the USB power supply pin USB_VBUS changes from a low level to a high level and the smart module 1 detects that the USB ID pin USB_ID changes from a high level to a low level , that is, the smart module 1 detects that both the external power supply and the OTG slave device are connected, and then the smart module 1 sets the GPIO pin to a high level, which on the one hand makes the switching circuit 2 use the external power supply to supply power to the smart module 1 and charge and manage the power supply 5 of the smart module 1 through the charging management unit 12, on the other hand, make the switching circuit 2 switch the smart module The power supply 5 of 1 supplies power to the OTG slave device. At this time, the smart module 1 completes data exchange with the OTG slave device through the USB data positive pin USB_DP and the USB data negative pin USB_DN, so that the smart module is Realized the coexistence of OTG function and charging function.
进一步,本实施例中,在所述智能模块1检测到所述USB供电管脚USB_VBUS、所述USB数据负端管脚USB_DM均为低电平状态且所述USB数据正端管脚USB_DP、所述USB ID管脚USB_ID均为高电平时,所述智能模块1将所述GPIO管脚默认设置为低电平,所述切换电路2包括第一电阻R1、第二电阻R2、第一三极管Q2、第二三极管Q3和PMOS管Q1,所述PMOS管Q1的漏极用于作为所述第一端口21,所述PMOS管Q1的源极分别与所述第一电阻R1一端、所述第二电阻R2一端连接后作为所述第二端口22,所述PMOS管Q1的栅极分别与所述第一电阻R1另一端、所述第一三极管Q2的集电极连接,所述第一三极管Q2的发射极接地,所述第一三极管Q2的基极分别与所述第二电阻R2另一端、第二三极管Q3的集电极连接,所述第二三极管Q3的发射极接地,所述第二三极管Q3的基极作为所述控制端口24。具体实施时,通过内置的软件流程根据所述适配器输入端和所述USB端口均为悬空状态设置所述GPIO管脚为低电平,从而保证所述基于智能模块实现OTG和充电双功能的系统在具有OTG功能和充电功能共存基础上,仍然具有完整、独立的OTG功能和充电功能,即单独所述适配器输入端3连接适配器时,所述基于智能模块实现OTG和充电双功能的系统就能独立充电,单独所述USB端口4接入OTG从设备时就能独立进行OTG通信或单独所述USB端口4接入主设备时所述智能模块1就作为device实现通信。当然,同时接入OTG从设备和适配器,所述基于智能模块实现OTG和充电双功能的系统就同时具有OTG功能和充电功能。具体实施中,所述切换电路2还包括第三电阻R3,所述第三电阻R3一端与所述第二三极管Q3的基极连接、另一端接地。Further, in this embodiment, after the intelligent module 1 detects that the USB power supply pin USB_VBUS and the USB data negative terminal pin USB_DM are both in a low level state and that the USB data positive terminal pin USB_DP, all When the USB ID pins USB_ID are all at high level, the intelligent module 1 sets the GPIO pin to low level by default, and the switching circuit 2 includes a first resistor R1, a second resistor R2, a first three-pole A transistor Q2, a second triode Q3, and a PMOS transistor Q1, the drain of the PMOS transistor Q1 is used as the first port 21, and the source of the PMOS transistor Q1 is respectively connected to one end of the first resistor R1, One end of the second resistor R2 is connected to serve as the second port 22, and the gate of the PMOS transistor Q1 is respectively connected to the other end of the first resistor R1 and the collector of the first triode Q2. The emitter of the first triode Q2 is grounded, the base of the first triode Q2 is respectively connected to the other end of the second resistor R2 and the collector of the second triode Q3, and the second three The emitter of the transistor Q3 is grounded, and the base of the second transistor Q3 serves as the control port 24 . During specific implementation, the GPIO pin is set to a low level according to the adapter input terminal and the USB port being suspended according to the built-in software process, thereby ensuring that the system based on the intelligent module realizes OTG and charging dual functions On the basis of the coexistence of the OTG function and the charging function, it still has a complete and independent OTG function and charging function, that is, when the adapter input terminal 3 is connected to the adapter alone, the system that realizes the dual functions of OTG and charging based on the intelligent module can be Independent charging, when the USB port 4 is connected to the OTG slave device alone, the OTG communication can be carried out independently, or when the USB port 4 is connected to the master device alone, the intelligent module 1 is used as a device to realize communication. Of course, if the OTG slave device and the adapter are connected at the same time, the system that realizes the dual functions of OTG and charging based on the intelligent module has both the OTG function and the charging function. In a specific implementation, the switching circuit 2 further includes a third resistor R3, one end of the third resistor R3 is connected to the base of the second transistor Q3, and the other end is grounded.
进一步,在本实施例中,所述充电管理单元12还包括供电电压检测管脚BAT_SNS,所述供电电压检测管脚BAT_SNS与所述智能模块1的供电电源5连接,当所述充电管理单元12检测到所述智能模块1的供电电源5为充满电状态时,所述充电管理单元12停止通过所述供电管脚BAT_SNS向所述智能模块1的供电电源5充电。Further, in this embodiment, the charging management unit 12 also includes a power supply voltage detection pin BAT_SNS, the power supply voltage detection pin BAT_SNS is connected to the power supply 5 of the smart module 1, when the charging management unit 12 When detecting that the power supply 5 of the smart module 1 is fully charged, the charging management unit 12 stops charging the power supply 5 of the smart module 1 through the power supply pin BAT_SNS.
进一步,在本实施例中,所述切换电路1还包括稳压电路25,所述稳压电路还包括使能端EN,所述稳压电路25一般优选稳压芯片251作为稳压电路的核心器件,所述稳压电路25还包括二极管D1,所述稳压电路25的输出端与所述二极管D1的阳极连接,所述二极管D1的阴极作为所述第二端口22,所述使能端EN与所述控制端口24连接,所述稳压电路25的输入端为所述第三端口23,所述稳压电路25的输出端为所述第二端口22,所述使能端EN为高电平有效用于控制所述稳压电路25将所述智能模块1的供电电源5稳压后通过所述第二端口22输出。具体实施中,智能模块的工作电压范围一般是3.5-4.2V,而OTG从设备的供电是5V,即所述智能模块的供电电源的电压值低于所述OTG从设备的电源需求,因此就采用升压型稳压电路。Further, in this embodiment, the switching circuit 1 also includes a voltage stabilizing circuit 25, and the voltage stabilizing circuit also includes an enable terminal EN, and the voltage stabilizing circuit 25 generally preferably uses a voltage stabilizing chip 251 as the core of the voltage stabilizing circuit device, the voltage stabilizing circuit 25 also includes a diode D1, the output terminal of the voltage stabilizing circuit 25 is connected to the anode of the diode D1, the cathode of the diode D1 is used as the second port 22, and the enabling terminal EN is connected to the control port 24, the input terminal of the voltage stabilizing circuit 25 is the third port 23, the output terminal of the voltage stabilizing circuit 25 is the second port 22, and the enabling terminal EN is The active high level is used to control the voltage stabilizing circuit 25 to stabilize the power supply 5 of the smart module 1 and output it through the second port 22 . In specific implementation, the operating voltage range of the intelligent module is generally 3.5-4.2V, and the power supply of the OTG from the equipment is 5V, that is, the voltage value of the power supply of the intelligent module is lower than the power demand of the OTG from the equipment. A step-up regulator circuit is used.
如图2所示,本实施例涉及的基于智能模块实现OTG和充电双功能的系统的内置软件流程包括:首先所述智能模块1根据USB规范检测所述USB端口4是否悬空,比如所述智能模块1检测到所述USB供电管脚USB_VBUS、所述USB数据负端管脚USB_DM均为低电平状态且所述USB数据正端管脚USB_DP、所述USB ID管脚USB_ID均为高电平时就表明所述USB端口4为悬空状态;然后,若先检测到所述USB端口4连接了设备,则根据USB规范,通过所述USB ID管脚USB_ID、所述USB数据正端管脚USB_DP、所述USB数据负端管脚USB_DM来识别出是OTG从设备还是主设备,若所述USB ID管脚USB_ID的电平由高变低就为OTG从设备,否则就为主设备从而所述智能模块1就作为device,再进一步判别是否有适配器插入,即判断所述USB供电管脚USB_VBUS的电平是否由低变高,这时若适配器和OTG从设备共存,则执行OTG和充电的功能,若仅为OTG从设备,则仅执行OTG功能;若先检测到所述适配器输入端3连接了适配器,即检测到所述USB供电管脚USB_VBUS的电平是否由低变高表明所述适配器输入端3连接了适配器,则再进一步判断所述USB端口4是否连接设备,即根据USB规范,通过所述USB ID管脚USB_ID、所述USB数据正端管脚USB_DP、所述USB数据负端管脚USB_DM来识别出是OTG从设备还是主设备,若为OTG从设备,这时若适配器和OTG从设备共存,则执行OTG和充电的功能,若仅为适配器,则仅执行充电功能;当所述USB端口4和所述适配器输入端3均为悬空状态,则流程一直处于开始等待状态。As shown in Figure 2, the built-in software process of the system based on the intelligent module to realize the dual functions of OTG and charging involved in this embodiment includes: first, the intelligent module 1 detects whether the USB port 4 is suspended according to the USB specification, such as the intelligent When module 1 detects that the USB power supply pin USB_VBUS and the USB data negative terminal pin USB_DM are both in a low level state and that the USB data positive terminal pin USB_DP and the USB ID pin USB_ID are both in a high level state It indicates that the USB port 4 is in a floating state; then, if it is first detected that the USB port 4 is connected to a device, according to the USB specification, the USB ID pin USB_ID, the USB data positive pin USB_DP, The USB data negative terminal pin USB_DM identifies whether it is an OTG slave device or a master device. If the level of the USB ID pin USB_ID changes from high to low, it is an OTG slave device, otherwise it is a master device so that the smart Module 1 is used as a device, and further judges whether there is an adapter plugged in, that is, judges whether the level of the USB power supply pin USB_VBUS changes from low to high. At this time, if the adapter and the OTG slave device coexist, the OTG and charging functions will be executed. If it is only an OTG slave device, only the OTG function is performed; if it is first detected that the adapter input terminal 3 is connected to an adapter, it is detected whether the level of the USB power supply pin USB_VBUS changes from low to high to indicate that the adapter input If terminal 3 is connected to an adapter, it is further judged whether the USB port 4 is connected to a device, that is, according to the USB specification, through the USB ID pin USB_ID, the USB data positive pin USB_DP, and the USB data negative pin pin USB_DM to identify whether it is an OTG slave device or a master device. If it is an OTG slave device, if the adapter and the OTG slave device coexist at this time, the OTG and charging functions will be performed. If it is only an adapter, only the charging function will be performed; If both the USB port 4 and the adapter input 3 are suspended, the process is always in a waiting state.
虽然以上描述了本发明的具体实施方式,但是本领域的技术人员应当理解,这仅是举例说明,本发明的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本发明的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本发明的保护范围。Although the specific implementation of the present invention has been described above, those skilled in the art should understand that this is only an example, and the protection scope of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710801156.3A CN107643998B (en) | 2017-09-07 | 2017-09-07 | System for realizing OTG and charging dual functions based on intelligent module |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710801156.3A CN107643998B (en) | 2017-09-07 | 2017-09-07 | System for realizing OTG and charging dual functions based on intelligent module |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN107643998A true CN107643998A (en) | 2018-01-30 |
| CN107643998B CN107643998B (en) | 2020-04-10 |
Family
ID=61110387
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710801156.3A Active CN107643998B (en) | 2017-09-07 | 2017-09-07 | System for realizing OTG and charging dual functions based on intelligent module |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107643998B (en) |
Cited By (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108446246A (en) * | 2018-02-27 | 2018-08-24 | 努比亚技术有限公司 | A kind of implementation method, device and the computer storage media of OTG functions |
| CN108594978A (en) * | 2018-05-08 | 2018-09-28 | 北京振中电子技术有限公司 | A kind of control method and device of handheld terminal |
| CN109617166A (en) * | 2018-12-21 | 2019-04-12 | 重庆大唛物联网科技有限公司 | Charging equipment for mobile phone and mobile phone protecting case |
| CN110765054A (en) * | 2019-10-24 | 2020-02-07 | 深圳市皓丽智能科技有限公司 | Switching circuit of conference tablet system, conference tablet and OPS (optical fiber switch) equipment |
| CN111313508A (en) * | 2020-03-31 | 2020-06-19 | 广东小天才科技有限公司 | A forward and reverse plug switching circuit, system and smart wearable device |
| CN114996187A (en) * | 2022-05-06 | 2022-09-02 | 东莞市步步高教育软件有限公司 | OTG function control method and device, computer equipment and storage medium |
| CN115391258A (en) * | 2022-08-16 | 2022-11-25 | 云码智能(海南)科技有限公司 | Interface management circuit, method, apparatus, device, storage medium, and program product |
| CN116054305A (en) * | 2021-10-28 | 2023-05-02 | 现代摩比斯株式会社 | A kind of in-vehicle infotainment IVI system and its operation method |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101901201A (en) * | 2010-08-06 | 2010-12-01 | 中兴通讯股份有限公司 | Method and device for realizing USB OTG function on electronic equipment |
| CN202257555U (en) * | 2011-09-01 | 2012-05-30 | 惠州Tcl移动通信有限公司 | USB terminal |
| CN103024195A (en) * | 2012-12-27 | 2013-04-03 | 青岛海信移动通信技术股份有限公司 | Smart mobile terminal and implementation method of charging of smart mobile terminal |
| CN202887727U (en) * | 2012-10-08 | 2013-04-17 | 浙江千能电力电子有限公司 | External power supply circuit, USB (universal serial bus) flash disk system with self-contained power supply, as well as terminal circuit |
| CN203387203U (en) * | 2013-05-09 | 2014-01-08 | 上海斐讯数据通信技术有限公司 | Charging switching system possessing USB on-the-go (OTG) function |
| CN103744821A (en) * | 2014-01-10 | 2014-04-23 | 广东欧珀移动通信有限公司 | Method and device for realizing USB OTG (Universal Serial Bus On-The-Go) function of mobile terminal |
-
2017
- 2017-09-07 CN CN201710801156.3A patent/CN107643998B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101901201A (en) * | 2010-08-06 | 2010-12-01 | 中兴通讯股份有限公司 | Method and device for realizing USB OTG function on electronic equipment |
| CN202257555U (en) * | 2011-09-01 | 2012-05-30 | 惠州Tcl移动通信有限公司 | USB terminal |
| CN202887727U (en) * | 2012-10-08 | 2013-04-17 | 浙江千能电力电子有限公司 | External power supply circuit, USB (universal serial bus) flash disk system with self-contained power supply, as well as terminal circuit |
| CN103024195A (en) * | 2012-12-27 | 2013-04-03 | 青岛海信移动通信技术股份有限公司 | Smart mobile terminal and implementation method of charging of smart mobile terminal |
| CN203387203U (en) * | 2013-05-09 | 2014-01-08 | 上海斐讯数据通信技术有限公司 | Charging switching system possessing USB on-the-go (OTG) function |
| CN103744821A (en) * | 2014-01-10 | 2014-04-23 | 广东欧珀移动通信有限公司 | Method and device for realizing USB OTG (Universal Serial Bus On-The-Go) function of mobile terminal |
Cited By (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108446246A (en) * | 2018-02-27 | 2018-08-24 | 努比亚技术有限公司 | A kind of implementation method, device and the computer storage media of OTG functions |
| CN108446246B (en) * | 2018-02-27 | 2021-09-21 | 努比亚技术有限公司 | Method and device for realizing OTG function |
| CN108594978A (en) * | 2018-05-08 | 2018-09-28 | 北京振中电子技术有限公司 | A kind of control method and device of handheld terminal |
| CN109617166A (en) * | 2018-12-21 | 2019-04-12 | 重庆大唛物联网科技有限公司 | Charging equipment for mobile phone and mobile phone protecting case |
| CN110765054A (en) * | 2019-10-24 | 2020-02-07 | 深圳市皓丽智能科技有限公司 | Switching circuit of conference tablet system, conference tablet and OPS (optical fiber switch) equipment |
| CN110765054B (en) * | 2019-10-24 | 2021-06-18 | 深圳市皓丽智能科技有限公司 | Switching circuit of conference tablet system, conference tablet and OPS (optical fiber switch) equipment |
| CN111313508A (en) * | 2020-03-31 | 2020-06-19 | 广东小天才科技有限公司 | A forward and reverse plug switching circuit, system and smart wearable device |
| CN116054305A (en) * | 2021-10-28 | 2023-05-02 | 现代摩比斯株式会社 | A kind of in-vehicle infotainment IVI system and its operation method |
| CN114996187A (en) * | 2022-05-06 | 2022-09-02 | 东莞市步步高教育软件有限公司 | OTG function control method and device, computer equipment and storage medium |
| CN115391258A (en) * | 2022-08-16 | 2022-11-25 | 云码智能(海南)科技有限公司 | Interface management circuit, method, apparatus, device, storage medium, and program product |
| CN115391258B (en) * | 2022-08-16 | 2023-05-02 | 云码智能(海南)科技有限公司 | Interface management circuit, method, apparatus, device, storage medium, and program product |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107643998B (en) | 2020-04-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107643998A (en) | OTG and the difunctional system that charges are realized based on intelligent object | |
| CN110829523B (en) | Electronic equipment and reverse charging method | |
| CN103019352B (en) | Universal serial bus power supply method, device end device and system applying same | |
| CN108988431B (en) | Multi-protocol charging device and multi-protocol charging method | |
| CN103208822A (en) | Universal serial bus (USB) charging control circuit | |
| CN105790356A (en) | Data line having charging circuit | |
| WO2012167677A1 (en) | Device and method for communication and charging for external device via usb interface | |
| CN107658920B (en) | A system that realizes dual functions of OTG and charging based on external charging | |
| CN103986211A (en) | A kind of intelligent charging control method | |
| CN105068959A (en) | A charging method and device for a terminal and a terminal with a data exchange function | |
| WO2014187415A1 (en) | Charging cable and charging system | |
| CN103403643B (en) | Management of charging and discharging device and mobile terminal | |
| CN106130124A (en) | A kind of method, system and terminal realizing multiple fast charge protocol compatibility | |
| CN202076771U (en) | USB OTG circuit and portable electronic device utilizing thereof | |
| CN103986210A (en) | A smart charger | |
| CN105071484A (en) | Charging method and apparatus of terminal having data exchange function | |
| CN202798035U (en) | Charging mode detection circuit and mobile terminal | |
| WO2015143793A1 (en) | Current control method and terminal device | |
| CN204376458U (en) | A kind of mobile terminal and charging device | |
| CN216531085U (en) | Switch power supply system and power transmission protocol chip thereof | |
| CN206878506U (en) | A kind of data wire and adapter | |
| CN104167793B (en) | The charging system and charging method of a kind of handheld terminal | |
| CN112134324A (en) | USB port insertion detection circuit, quick charging chip, power supply circuit and equipment | |
| CN107733025B (en) | USB and DC compatible double-charging circuit and operation method thereof | |
| CN207625314U (en) | A kind of double charging circuits compatible with DC USB |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP02 | Change in the address of a patent holder |
Address after: 200233 room 193, 2f, No. 25-1, Hongcao Road, Xuhui District, Shanghai Patentee after: QUECTEL WIRELESS SOLUTIONS Co.,Ltd. Address before: 200233 room 701, No. 1801 B, Hongmei Road, Xuhui District, Shanghai Patentee before: QUECTEL WIRELESS SOLUTIONS Co.,Ltd. |
|
| CP02 | Change in the address of a patent holder |