Summary of the invention
The technical problem to be solved in the present invention is that the above-mentioned defective at prior art provides a kind of analog switch control circuit and mobile phone, and it can switch by the quick control analog switch, and simple in structure, is difficult for makeing mistakes.
The technical scheme that technical solution problem of the present invention is adopted is as follows:
A kind of analog switch control circuit, comprise the Micro USB interface, and the analog switch that is connected with the communication of Micro USB interface, wherein, the 2nd pin of described Micro USB interface, the 3rd pin are connected with the output of described analog switch, and the 1st pin of Micro USB interface is connected to the control end of described analog switch by a bleeder circuit.
Described analog switch control circuit, wherein, described bleeder circuit comprises first resistance and second resistance, one end of first resistance is connected to the 1st pin of described Micro USB interface, the other end of first resistance is connected to the control end of described analog switch, and the other end of described first resistance also connects with reference to ground by second resistance.
Described analog switch control circuit, wherein, described analog switch is the single-pole double throw analog switch, is used for two groups of separate signalling channels are common to an interface, described single-pole double throw analog switch comprises first pair of input and second pair of input.
Described analog switch control circuit, wherein, the resistance of described first resistance is 36K ohm, the resistance of described second resistance is 24K ohm.
A kind of mobile phone, comprise a mobile phone body, be arranged on the circuit board in the mobile phone body, and be arranged on analog switch control circuit on the described circuit board, wherein, described analog switch control circuit comprises a Micro USB interface, and an analog switch, the 2nd pin of described Micro USB interface, the 3rd pin are connected with the output of described analog switch, and the 1st pin of Micro USB interface is connected to the control end of described analog switch by a bleeder circuit.
Described mobile phone, wherein, described bleeder circuit comprises first resistance and second resistance, one end of first resistance is connected to the 1st pin of described Micro USB interface, the other end of first resistance is connected to the control end of described analog switch, and the other end of described first resistance also connects with reference to ground by second resistance.
Described mobile phone, wherein, described analog switch is the single-pole double throw analog switch, is used for two groups of separate signalling channels are common to an interface, described single-pole double throw analog switch comprises first pair of input and second pair of input.
Described mobile phone, wherein, on described circuit board, also be provided with usb data transmission circuit and application program of mobile phone download circuit, described application program of mobile phone download circuit is connected with first pair of input of described single-pole double throw analog switch, and described usb data transmission circuit is connected with second pair of input of described single-pole double throw analog switch.
Described mobile phone is characterized in that, the resistance of described first resistance is 36K ohm, and the resistance of described second resistance is 24K ohm.
A kind of analog switch control circuit provided by the present invention and mobile phone, owing to adopt the 2nd pin, the 3rd pin of described Micro USB interface to be connected with the output of described analog switch, its the 1st pin is connected to the control end of described analog switch by a bleeder circuit, its reasonably utilized the USB line with supply voltage, control analog switch with hardware mode, the method for conventional software control GPIO is quicker, effectively simple, do not take GPIO mouth resource.
Embodiment
A kind of analog switch control circuit provided by the present invention and mobile phone, clearer, clear and definite for making purpose of the present invention, technical scheme and advantage, below develop simultaneously with reference to accompanying drawing that the present invention is described in more detail for embodiment.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
MTK platform mobile phone with certain band USB function is an example, and Micro USB interface and analog switching circuit reduced graph thereof are as shown in Figure 1.Analog switch adopts single-pole double throw analog switch 110 among the figure, and the power end VCC of its single-pole double throw analog switch 110 connects working power VBAT, and the GND termination is with reference to ground.Micro USB(micro USB) interface 100 has become a kind of interface standard gradually, and its 1 pin power supply and 5 pin ground are as charger or USB power source charges interface, and 2 pin and 3 pin are as the USB transmission signals, and 4 pin can use it for anything else.
And the UART(program is downloaded line) also be a kind of communication interface commonly used on the present mobile phone, such as twin wire UART interface (UTXD and URXD signal among Fig. 1), it mainly can be used for the mobile phone-downloaded application program.Can see that the signal pins on the Micro usb 1 00 is very limited, have only 5.In order to save space and resource, generally adopt a single-pole double throw analog switch 110, the USB interface on the mobile phone master chip and UART interface are common to 2,3 pin of a Micro USB interface.
General procedure is downloaded line and is not with power line, and USB tape power line.Like this, the mobile phone end can be that USB line or program are downloaded line by detecting what whether have on the Micro usb 1 pin that high level distinguishes insertion just.
Usually the mobile phone master chip is controlled the Enable Pin (control end) of analog switch with a general input/output signal (GPIO1 among Fig. 1), to switch different signalling channels.Such as with regard to this kind of mobile phone, the acquiescence initial condition of this single-pole double throw analog switch 110 is that channel B 01, B02 are linked to each other with D01, D02 respectively, and A01, A02 disconnect with D01, D02 respectively; Be under the default situations, signal end D-, the D+ of mobile phone Micro USB interface downloads end UTXD, URXD with program and is connected.
When the GPIO1 of mobile phone master chip was output as low level, single-pole double throw analog switch 110 also was that channel B 01, B02 are linked to each other with D01, D02 respectively, and A01, A02 disconnect with D01, D02 respectively; And when the GPIO1 of mobile phone master chip was output as high level, control single-pole double throw analog switch 110 disconnected B01, B02 respectively with D01, D02 passage, and A01, A02 link to each other with D01, D02 passage respectively.
Because mobile phone is when using the UART interface to download, mobile phone is in improper open state, and the uncontrollable GPIO signal of master chip so generally UART is connected on the signalling channel of single-pole double throw analog switch 110 acquiescence initial conditions, promptly is connected on B01, B02 mouth.
When the insertion program was downloaded line (UART line), 1 pin VCHG of Micro usb 1 00 was a low level like this, and single-pole double throw analog switch 110 acquiescence B01, B02 link to each other with D01, D02, and mobile phone just can normally download.
Because USB_DM, the USB_DP of USB function end are connected to A01, A02 respectively.When inserting the USB line, handset identity is to the high level of Micro usb 1 pin, mobile phone can switch to A01, A02 with the signalling channel of single-pole double throw analog switch 110 by control GPIO1 and be connected with D01, D02 respectively under open state, use USB function.
In actual applications, can run into a sequence problem, cause mobile phone under off-mode, can't correctly be identified as USB device by computer.By analyzing the protocol specification of USB communication, learn the Ji Li of usb host (as computer) identification peripheral hardware, when usb host detects voltage difference on holding wire D+, the D-, just thinking has peripheral hardware to insert, start and the hand shake procedure of peripheral hardware, if handshake of the 500 milliseconds of transmissions in every interval is the continuous correct response that does not all obtain peripheral hardware for three times, it is overtime to shake hands, and what main frame was then thought insertion is invalid USB device.This process is about 1500 milliseconds.
End thus again sees the mobile phone, as shown in Figure 1, under the mobile phone power-on state, insert the USB line, mobile phone detect main frame output to behind the 5V voltage (VCHG) on the usb 1 pin can be immediately be that high level switches single-pole double throw analog switch 110 passage A01, A02 are connected with D01, D02 respectively by control GPIO1, mobile phone and main frame can normally be shaken hands in the time limit, use the USB function.
And under the off-mode, after inserting the USB line, signal sequence as shown in Figure 2.The 5V voltage (VCHG) that mobile phone detects on the usb 1 pin is opened each modular power source immediately, and by the UART communications protocol, UTXD and URXD signal can be exported one group of level that just changes (shown in the D+/UTXD line as shown in Figure 2).Because B01, the B02 of analog switch link to each other with D01, D02 passage respectively under the default conditions, D+, D-level are subjected to UTXD, URXD effect of signals.After main frame detected the pressure reduction of D+, D-, thinking had the USB peripheral hardware to insert, and just starts hand shake procedure.And at this moment mobile phone is only finished boot program, control GPIO1 is that passage A01, the A02 of high level (shown in the GPIO1 line as shown in Figure 2) ability switching analoging switch links to each other with D01, D02, this moment analog switch about 2.3S switching time, at this moment the hand shake procedure of main frame is overtime, and computer can't detect mobile phone as USB device.
Thus, a kind of analog switch control circuit 200 that the embodiment of the invention provides, as shown in Figure 3, comprise Micro USB interface 210, and the single-pole double throw analog switch 220 that is connected with 210 communications of Micro USB interface, be used for two groups of separate signalling channels are common to an interface, as shown in Figure 3, described single-pole double throw analog switch 220 comprises first couple of input B1 and B2 and the second couple of input A1 and A2, for example, the first couple of input B1 of described single-pole double throw analog switch 220 and B2 are connected to application program of mobile phone respectively download end UTXD and URXD, its second couple of input A1 and A2 are connected to UBS data transmit-receive end USB_DP and USB_DM respectively.
Wherein, the 2nd pin of described Micro USB interface 210, the 3rd pin are connected with D2 with the output D1 of described single-pole double throw analog switch 220, and the 4th pin of Micro USB interface 210 is as other usefulness.The 5th pin connects with reference to ground, and the 1st pin of Micro USB interface 210 is connected to the control end C1 and the C2 of described single-pole double throw analog switch 220 by a bleeder circuit 230.
Further, as shown in Figure 3, described bleeder circuit 230 comprises first resistance R 1 and second resistance R 2, one end of first resistance R 1 is connected to the 1st pin of described Micro USB interface 210, the other end of first resistance R 1 is connected to the control end C1 and the C2 of described single-pole double throw analog switch 220, and the other end of described first resistance R 1 also connects with reference to ground by second resistance R 2.Preferably, the resistance of described first resistance is 36K ohm, and the resistance of described second resistance is 24K ohm.
Therefore the analog switch control circuit 200 of the embodiment of the invention changes hardware circuit (i.e. bleeder circuit 230 as shown in Figure 3) control analog switch into by original software GPIO signal controlling, has shortened the switching time of analog switch.As Fig. 3, change the signal of GPIO1 into control signal (control level) by bleeder circuit 230.VCHG signal on 1 pin of Micro USB interface 210 directly obtains the required control level of single-pole double throw analog switch by a bleeder circuit of being made up of R1 and R2.
As shown in Figure 3, when USB device is inserted Micro USB interface 210, the 5V level that main frame output is arranged on the VCHG signal, by bleeder circuit 230 Enable Pin (being control end C1 and the C2) signal of single-pole double throw analog switch 220 is drawn high, passage switches to A1, A2 and is connected with D1, D2 respectively, and D1, D2 disconnect with B1, B2 passage respectively.It can switch by the quick control analog switch, and simple in structure, is difficult for makeing mistakes.
Analog switch control circuit based on the foregoing description, the embodiment of the invention also provides a kind of mobile phone, as shown in Figure 4, comprise a mobile phone body 400, be arranged on the circuit board 410 in the mobile phone body 400, and be arranged on analog switch control circuit 200 on the described circuit board 410, as shown in Figure 5, wherein, described analog switch control circuit 200 comprises a Micro USB interface 210, and a single-pole double throw analog switch 220, is used for two groups of separate signalling channels are common to an interface, as shown in Figure 5, described single-pole double throw analog switch comprises first couple of input B1 and B2 and the second couple of input A1 and A2.
As shown in Figure 5, the 2nd pin (D-), the 3rd pin (D+) of described Micro USB interface 210 are connected with output D2, the D1 of described single-pole double throw analog switch 220 respectively, and the 1st pin of Micro USB interface 210 is connected to the control end C1 and the C2 of described single-pole double throw analog switch 220 by a bleeder circuit 230.
Further, described bleeder circuit 230 comprises first resistance R 1 and second resistance R 2, one end of first resistance R 1 is connected to the 1st pin of described Micro USB interface 210, the other end of first resistance R 1 is connected to the control end C1 and the C2 of described single-pole double throw analog switch 220, and the other end of described first resistance R 1 also connects with reference to ground by second resistance R 2.Preferably, the resistance of described first resistance R 1 is 36K ohm, and the resistance of described second resistance R 2 is 24K ohm.
Further, as shown in Figure 5, on described circuit board 410, also be provided with usb data transmission circuit 240 and application program of mobile phone download circuit 250, described application program of mobile phone download circuit 250 is connected with B2 with first couple of input B1 of described single-pole double throw analog switch 220 respectively with the URXD end by its UTXD end, and the USB_DP end of described usb data transmission circuit 240 is connected A1 with second pair of input of described single-pole double throw analog switch 220 respectively with USB_DM and is connected with A2.
As shown in Figure 5, when mobile phone of the present invention is in off-mode, insert the USB line, signal sequence such as Fig. 6.The 5V level that main frame output is arranged on the VCHG signal, by bleeder circuit 230 control signal (i.e. control level line as shown in Figure 6) of the control end C1 and the C2 of single-pole double throw analog switch 220 is drawn high, passage in the single-pole double-throw switch (SPDT) 220 switches A1 and is connected with D2 with D1 respectively with A2, and control D1 and D2 disconnect with B1 and B2 passage respectively.Level on D+, the D-just has not been subjected to the effect of signals on UTXD, the URXD, level all is low, draw high D+(D+ line as shown in Figure 6 up to the mobile phone end), tell main frame to have peripheral hardware to insert, main frame is with regard to the hand shake procedure of startup and peripheral hardware, use the USB function, correctly recognize mobile phone and be USB device.
Therefore, the mobile phone of the embodiment of the invention reasonably utilized the USB line with supply voltage (being the 1st pin voltage of Micro USB interface 210), hardware controls mode in order to bleeder circuit 230 is controlled analog switch, method than conventional software control GPIO, quicker, effectively simple, do not take GPIO mouth resource, only increase few hardware cost.
In sum, a kind of analog switch control circuit provided by the present invention and mobile phone, owing to adopt the 2nd pin, the 3rd pin of described Micro USB interface to be connected with the output of described analog switch, its the 1st pin is connected to the control end of described analog switch by a bleeder circuit, its reasonably utilized the USB line with supply voltage, control analog switch with hardware mode, method than conventional software control GPIO, quicker, effectively simple, do not take GPIO mouth resource.
Should be understood that application of the present invention is not limited to above-mentioned giving an example, for those of ordinary skills, can be improved according to the above description or conversion that all these improvement and conversion all should belong to the protection range of claims of the present invention.