The device and method of terminal charger charging, USB charging and data communication
Technical field
The present invention relates generally to the communication electronic applications, relates in particular to the device and method of a kind of terminal charger charging, USB charging and data communication.
Background technology
Country had issued " GSM CDMA charger and interfacing require and method of testing " in 2007; The cable and the interface between the plug of clear and definite prescribed terminal charger need adopt USB interface; And pin D+ and D-short circuit that USB interface in the charger is inner, and stube cable between charger and the terminal and interface are designed by the designer voluntarily.
Fig. 1 is the sketch map of terminal charger 101USB interface under the existing standard, and among Fig. 1, two pins in terminal charger 101 left sides are power input, and four pins in the right are respectively V
Bus, D+, D-and GND, wherein pin D+ is connected through inner lead with D-and by short circuit.
The scheme that existing employing USB interface charges to the terminal is to utilize to comprise general input and output (GPIO mostly; General Purpose Input Output) circuit of interface, logic controller or triode is realized detection and differentiation to charger and usb data line, and is aided with corresponding method and realizes charger charging or USB charging are carried out in the terminal.
Fig. 2 realizes the circuit theory diagrams that terminal USB charges through the GPIO interface in the prior art, comprises among the figure:
Terminal inner charging module 201, charging inlet 202, outer computer 203, external charger 204 and rechargeable battery 205.Terminal inner charging module 201 comprises controller logic module 2011, and controller logic module 2011 comprises pin GPIO1, GPIO2, CHGDET, VCHG etc.
In terminal inner charging module 201; Resistance R 6 is the pull-up resistor on the data wire of pin USB_DP place; The charge mode testing circuit comprises resistance R 2, R3, R4 and R5, and wherein resistance R 2, R4 are input to pin GPIO1 for the data wire at USB_DM pin place constitutes dividing potential drop through after the dividing potential drop; And resistance R 3, R5 constitute dividing potential drop for the data wire at pin USB_DP place, are input to pin GPIO2 through after the dividing potential drop.Controller logic module 2011 is used for identification and carries out the full speed usb data communication with outer computer 203.
The entire circuit design principle is: controller logic module 2011 is according to the operating state at the voltage signal condition judgement terminal on pin GPIO1 and the GPIO2, thereby realization is charged and data communication to the terminal through USB interface.
When charging inlet 202 inserts the usb data line interface of external charger 204 and outer computer 203 simultaneously; The pin USB_DP of usb data line interface and USB_DM are by short circuit; It all is high that the while circuit makes pin GPIO1 and GPIO2 go up voltage, so controller logic module 2011 judges that current states are charged state;
When charging inlet 202 only inserted the usb data line interface of outer computer 203, the pin USB_DP of usb data line interface and USB_DM be by short circuit, this moment circuit to make the voltage on the pin GPIO1 be low for the voltage on high, the pin GPIO2.Therefore controller logic module 2011 judges that current state is the data communication state.
At present because terminal charger standard YD/T1591-2006 the release time of " GSM CDMA charger and interfacing require and method of testing " also not long, that is that all right is ripe for existing technical scheme, has a lot of deficiencies, specific as follows:
Under the little situation of the volume of transmitted data of present terminal and external equipment; Most of manufacturer terminals can only provide the USB1.1 interface to supply terminal and PERCOM peripheral communication used; The message transmission rate of USB1.1 interface is up to 12Mbps, carries out transfer of data in this speed, is not very harsh to the requirement of signal quality; Yet along with the multimedia function at terminal and the increase day by day of data processing function; To the raising day by day that the data throughput requires, the USB interface on the terminal must turn to supports the USB2.0 interface of transmission rate up to 480Mbps, owing to the requirement of USB2.0 interface to the circuit signal quality will improve greatly; Thereby to guaranteeing in the USB circuit design that signal integrity proposes higher requirement; And the prior USB circuit design directly increases parallel resistor, inductance and electric capacity even load on the data wire at the pin D+ that participates in usb communication, D-place, causes the destruction of transmission rate up to the signal integrity of 480Mbps, and the reliability of USB2.0 interface communication is reduced greatly.
Summary of the invention
In view of this; The object of the present invention is to provide the device and method of terminal charger charging, USB charging and data communication, be reached for the user provide circuit kit simple in structure, take that resource is few, terminal charger charging, USB charging and the three-in-one solution of data communication that signal quality and data transmission credibility are improved greatly.
The invention provides the device of terminal charger charging, USB charging and data communication, comprising:
Processor: comprise data-interface, first interface, second interface and the 3rd interface;
Usb interface module: comprise FPDP and power interface; Wherein, power interface is connected with second interface;
It is characterized in that, also comprise:
Select module: comprise selecting side, first switch and second switch, first switch and second switch comprise input, first output and second output respectively; Wherein, the selecting side is connected with the 3rd interface, is used to control the input of first, second switch and being connected of output; First output of first, second switch is connected with the data-interface of processor; Second output of first switch is connected with first interface, is used to trigger processor and produces the terminal charger insertion or extract interruption; Second output of second switch is connected with second interface, is used to trigger processor and produces the USB insertion or extract interruption; The input of first, second switch is connected with the FPDP of usb interface module.
This installs in the said selection module,
If the selecting side is a high level, then the input of first, second switch is connected with first output corresponding to this input;
If the selecting side is a low level, then the input of first, second switch is connected with second output corresponding to this input.
This installs said processor and comprises digital baseband block and ABB module, wherein,
Digital baseband block comprises usb interface unit, and this unit comprises first data-interface and second data-interface;
The ABB module comprises first interface, second interface and the 3rd interface.
This installs said ABB module and comprises the interruption controls unit, wherein,
First interface is connected with the interruption controls unit, is used to control the interruption controls unit and produces terminal charger insertion interruption;
Second interface is connected with the interruption controls unit, is used to control the interruption controls unit and produces terminal usb data interface insertion interruption.
This installs said ABB module and comprises power control unit, wherein,
Second interface is connected with power control unit, and for power control unit provides input voltage, power control unit is output voltage signal under digital baseband block control, and this voltage signal is through the output of the 3rd interface.
The present invention also provides the method for terminal charger charging, USB charging and data communication, comprising:
A. processor detects the triggering situation that USB inserts interruption and charger insertion interruption according to interrupt flag bit;
If B. USB insertion interruption and charger insert and interrupt all being triggered, confirm that then the terminal is in charger insertion state, startup charger charging flow; In this step,
After the usb interface module at charger and terminal connects; With the FPDP short circuit of usb interface module, power interface is accepted the charger power supply, makes the signal on second interface be changed to high level; Because the signal on the selecting side of selection module is a low level; The input of first, second switch is connected with second output corresponding to this input, and second input of first switch is connected with first interface, second input of second switch is connected with second interface; Therefore, make the signal on first interface also be changed to high level;
High level signal on first interface triggers processor and produces USB insertion interruption;
High level signal on second interface triggers processor and produces terminal charger insertion interruption;
Interrupt being triggered if C. only there is USB to insert, then confirm to be in the usb data line and insert state, start the USB charging flow, and carry out the usb data transmission; In this step,
After computer usb data interface and usb interface module connect; Power interface is accepted the power supply of computer usb data interface; Make the signal on second interface be changed to high level, high level signal on second interface triggers processor and produces terminal charger and insert and interrupt, and input voltage is provided for power control unit; Power control unit is output voltage signal under digital baseband block control; This voltage signal selects the signal of the selecting side of module to be changed to high level through the 3rd interface output, and the input of first, second switch is connected with first output corresponding to this input; The data-interface that makes digital baseband block connects through the FPDP and the computer usb data interface of usb interface module, carries out the usb data transmission;
After the signal of the selecting side of selection module is changed to high level; The input disconnection of first, second switch is connected with second output corresponding to this input; Make the signal on first interface be changed to low level, produce terminal charger insertion interruption thereby can not trigger processor.
The said step B of this method also comprises:
The charger disconnection is connected with usb interface module; Make the signal on first interface and second interface all be changed to low level; This low level signal triggering processor generation USB extracts interruption and terminal charger is extracted interruption; Processor detects USB according to interrupt flag bit and extracts and interrupt and charger is extracted after interruption all is triggered charge closing device charging flow.
The said step C of this method also comprises:
The disconnection of usb data interface is connected with usb interface module; Make the signal on second interface be changed to low level; This low level signal triggers processor and produces USB and extract interruption, processor according to interrupt flag bit detect USB extract interrupt being triggered after, close the USB charging flow.
The described processor of this method step B and C is the interrupt control unit in the ABB module.
The device and method of terminal charger charging of the present invention, USB charging and data communication; A plurality of control units through on hardware circuit, increasing in binary channels analog switch and ABB module that cooperates with this hardware circuit and the digital baseband block are realized the identification of terminal to charger and usb data line; To realize the charger charging or can carry out the USB charging of usb data communication simultaneously; Avoided on D+ and D-data wire increasing extra circuit load, be reached for the user provide circuit kit simple in structure, take that resource is few, the beneficial effect of solution that terminal charger charging, USB charging and data communication that signal quality and data transmission credibility are improved greatly are three-in-one.
Description of drawings
Fig. 1 is the sketch map of terminal charger USB interface under the existing standard;
Fig. 2 realizes the circuit theory diagrams that terminal USB charges through the GPIO interface in the prior art;
Fig. 3 is terminal charger charging among the present invention, USB charging and the three-in-one structure drawing of device of data communication;
Fig. 4 realizes the structure drawing of device of terminal charger charging when inserting for charger among the present invention;
Fig. 5 realizes the structure drawing of device of terminal USB charging and data communication when inserting for usb data interface among the present invention;
Fig. 6 is terminal charger charging among the present invention, USB charging and the three-in-one method flow diagram of data communication.
Embodiment
Fig. 3 is terminal charger charging among the present invention, USB charging and the three-in-one structure drawing of device of data communication, comprising:
Digital baseband block 301; Usb interface module 3011 in this module comprises pin USB_D+ and USB_D-; Pin USB_D+ is connected with No. 1 output of first switch of analog switch 303, and pin USB_D-is connected with No. 1 output of the second switch of analog switch 303.
ABB module 302; This module comprises pin VCHG_DET, VUSB_IN and VUSB; Wherein, pin VCHG_DET is connected with No. 0 output of first switch of analog switch 303, and pin VUSB_IN is connected with No. 0 output of the second switch of analog switch 303.
This module also comprises interruption controls unit 3021, power control unit 3022 and charging control unit 3023, wherein,
Pin VCHG_DET is connected with interruption controls unit 3021, is used for the triggering terminal charger and inserts or extract interruption.
Pin VUSB_IN is connected with interruption controls unit 3021, is used to trigger USB and inserts or extract interruption.
Pin VUSB_IN also is connected with power control unit 3022, and be used to power control unit 3022 input voltage is provided, digital baseband block 301 control power control units 3022 output+3V voltage signal VUSB, this voltage signal VUSB is through pin VUSB output.
Charging circuit module 305 is connected with the end of current-limiting resistance R3, and the other end of current-limiting resistance R3 is connected with No. 0 output of the second switch of analog switch 303, and charging circuit module 305 is charged to battery 306 under charging control unit 3023 controls.
Analog switch 303 comprises channel selecting pin S, and first switch and second switch, first switch and second switch comprise an input, No. 0 output and No. 1 output respectively.Wherein, channel selecting pin S is used to control the input of first, second switch and being connected of output.
USB socket 304 comprises slot GND, D+, D-and Power, and wherein, slot D+ is connected with the input of first switch of analog switch 303, and slot D-is connected with the input of the second switch of analog switch 303.
Slot Power is connected with the pin VUSB_IN of ABB module 302.
Fig. 4 realizes the structure drawing of device of terminal charger charging when inserting for charger among the present invention; Among Fig. 4; Standard charging device 401 inserts USB socket 304, and the pin GND of standard charging device 401 is connected with the slot GND of USB socket 304, and the pin D+ of standard charging device 401 is connected with the slot D+ of USB socket 304; The pin D-of standard charging device 401 is connected with the slot D-of USB socket 304, and the pin VCHG of standard charging device 401 is connected with the slot Power of USB socket 304.In addition, two pins of right-hand member of standard charging device 401 are the external power source input.
The course of work of device shown in Figure 4 is following:
The standard charging device inserts the USB socket at terminal; The slot Power of the pin VCHG of standard charging device through USB socket makes the signal on the pin VUSB_IN of ABB module be changed to high level; Because pin D+ in the standard charging device and D-are by short circuit; And the analog switch of this moment is in the passage conducting state No. 0; Therefore, the signal on the pin VCHG_DET of ABB module also is changed to high level, and the interrupt control unit that the high level signal on the pin VUSB_IN will trigger in the simulation baseband module produces USB insertion interruption; The interrupt control unit that high level signal on the pin VCHG_DET will trigger in the simulation baseband module produces terminal charger insertion interruption; The ABB module according to interrupt flag bit detect USB insert to interrupt with charger insert interrupt all being triggered after, confirm that the terminal is in charger and inserts state, startup charger charging flow.
After the standard charging device is extracted from the USB socket at terminal; The pin VCHG of standard charging device will break off and being connected of the slot Power of USB socket; Make the signal on pin VUSB_IN and the VCHG_DET be changed to low level; Produce USB and extract and interrupt extracting interruption with charger thereby trigger interrupt control unit in the simulation baseband module, the ABB module detects USB according to interrupt flag bit and extracts interruption and charger and extract after interruption all is triggered charge closing device charging flow.
Fig. 5 realizes the structure drawing of device of terminal USB charging and data communication when inserting for usb data interface among the present invention; Among Fig. 5; Computer usb data interface 501 inserts USB socket 304; The pin GND of computer usb data interface 501 is connected with the slot GND of USB socket 304; The pin D+ of computer usb data interface 501 is connected with the slot D+ of USB socket 304, and the pin D-of computer usb data interface 501 is connected with the slot D-of USB socket 304, and the pin VBUS of computer usb data interface 501 is connected with the slot Power of USB socket 304.
The course of work of device shown in Figure 5 is following:
After computer usb data interface inserts the USB socket at terminal; The pin VBUS of computer usb data interface will make the signal of the pin VUSB_IN of ABB module be changed to high level through the slot Power of USB socket; The interrupt control unit that this high level signal triggers in the simulation baseband module produces USB insertion interruption; High level signal on the pin VUSB_IN also will be for power control unit provides input voltage, digital baseband block control power control unit output+3V voltage VUSB, should+3V voltage VUSB exports through the VUSB interface of ABB module; Process pull-up resistor R1 is to analog switch channel selecting pin S; Make pin S go up voltage signal and be changed to high level, thereby make No. 1 passage conducting of analog switch, No. 0 pathway closure.
No. 1 passage conducting of analog switch is connected the pin D+ of computer usb data interface, D-respectively with pin USB_D+, the USB_D-of digital baseband block, carry out the usb data transmission thereby computer usb data interface is connected with the usb interface module of digital baseband block.
No. 0 pathway closure of analog switch is isolated from the outside the signal on the pin VCHG_DET of ABB module; Therefore; The interruption controls module can only produce USB and insert interruption; Confirm to have only USB to insert according to interrupt flag bit and interrupt, thereby confirm that the terminal is in the usb data line and inserts state, start the USB charging flow.
After computer usb data interface is extracted from the USB socket at terminal; The pin VUSB of computer usb data interface will break off and being connected of the slot Power of USB socket; Make the signal on the pin VUSB_IN no longer be high level; Produce USB and extract interruption thereby trigger interruption controls unit in the simulation baseband module, the ABB module according to interrupt flag bit detect USB extract interrupt being triggered after, close the USB charging flow.
Fig. 6 is terminal charger charging among the present invention, USB charging and the three-in-one method flow diagram of data communication, and concrete steps are following:
When step 601, terminal find to have charger or USB interface of computer to insert, get into operating state from default conditions, the terminal inner circuit is started working.
When the terminal inner circuit has just been started working, the analog switch control end by pull down resistor R2 drop-down be low level, this moment analog switch No. 0 passage conducting, No. 1 pathway closure.
Step 602, the ABB module detects the triggering situation that USB inserts interruption and charger insertion interruption according to interrupt flag bit.
Step 603 if USB inserts interruption and the charger insertion is interrupted all being triggered, confirms that then the terminal is in charger and inserts state, startup charger charging flow.
In this step; The standard charging device inserts the USB socket at terminal; The slot Power of the pin VCHG of standard charging device through USB socket makes the signal on the pin VUSB_IN of ABB module be changed to high level; Because the pin D+ in the standard charging device and D-be by short circuit, and analog switch at this moment is in the passage conducting state No. 0, therefore; Signal on the pin VCHG_DET of ABB module also is changed to high level; High level signal on the pin VUSB_IN will trigger the interrupt control unit of simulation in the baseband module and produce USB and insert and interrupt, and the high level signal on the pin VCHG_DET will trigger interrupt control unit in the simulation baseband module and produce terminal charger and insert and interrupt, the ABB module according to interrupt flag bit detect USB insert interrupt all being triggered with charger insertion interruption after; Confirm that the terminal is in charger and inserts state, start the charger charging flow.
In addition; After the standard charging device is extracted from the USB socket at terminal; The pin VCHG of standard charging device will break off and being connected of the slot Power of USB socket, and make the signal on pin VUSB_IN and the VCHG_DET be changed to low level, produce USB and will extract and interrupt and charger is extracted interruption thereby trigger interrupt control unit in the simulation baseband module; The ABB module detects USB according to interrupt flag bit and extracts and interrupt and charger is extracted after interruption all is triggered charge closing device charging flow.
Step 604 interrupts being triggered if only there is USB to insert, and then confirms to be in the usb data line and inserts state, starts the USB charging flow, and can carry out the usb data transmission simultaneously.
In this step; After computer usb data interface inserts the USB socket at terminal; The pin VBUS of computer usb data interface will make the signal of the pin VUSB_IN of ABB module be changed to high level through the slot Power of USB socket, the interrupt control unit that this high level signal triggers in the simulation baseband module produces USB insertion interruption, and the high level signal on the pin VUSB_IN also will provide input voltage for power control unit; Digital baseband block control power control unit output+3V voltage VUSB; Should+the VUSB interface output of 3V voltage VUSB through the ABB module,, make pin S go up voltage signal and be changed to high level to analog switch channel selecting pin S through pull-up resistor R1; Thereby make No. 1 passage conducting of analog switch, No. 0 pathway closure.
No. 1 passage conducting of analog switch is connected the pin D+ of computer usb data interface, D-respectively with pin USB_D+, the USB_D-of digital baseband block, carry out the usb data transmission thereby computer usb data interface is connected with the usb interface module of digital baseband block.
No. 0 pathway closure of analog switch is isolated from the outside the signal on the pin VCHG_DET of ABB module; Therefore; The interruption controls module can only produce USB and insert interruption; Confirm to have only USB to insert according to interrupt flag bit and interrupt, thereby confirm that the terminal is in the usb data line and inserts state, start the USB charging flow.
In addition; After computer usb data interface is extracted from the USB socket at terminal; The pin VUSB of computer usb data interface will break off and being connected of the slot Power of USB socket, and make the signal on the pin VUSB_IN no longer be high level, produce USB and will extract interruption thereby trigger interruption controls unit in the simulation baseband module; The ABB module according to interrupt flag bit detect USB extract interrupt being triggered after, close the USB charging flow.
The above is merely preferred embodiment of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.