Earphone interface circuit and portable electron device
Technical field
The utility model belongs to earphone interface communication field, relates in particular to a kind of earphone interface circuit and portable electron device.
Background technology
At present, general earphone interface standard has two in the world, first kind earphone interface is the standard of OMTP, as shown in Figure 1, respectively save contact with the Earphone joint of first kind earphone interface adaptation and be defined as successively from outside to inside L channel contact L, R channel contact R, microphone contact MIC and ground contact GND; Second Type earphone interface is the standard of CTIA, as shown in Figure 2, respectively saves contact be defined as successively from outside to inside L channel contact L, R channel contact R, ground contact GND and microphone contact MIC with the Earphone joint of Second Type earphone interface adaptation.
Therefore, the external device being connected with mobile phone by earphone interface, as mobile phone card-brushing device, POS (Point OfSale, point-of-sale terminal) machine, just can not directly be connected with earphone signal, and must be first through polarity judgement, polarity switching circuit ability exact connect ion, with ensure compatibility.Traditional method is first to judge earphone interface by polarity detection circuit, then be connected to audio decoder, coding circuit with analog switch, and conventional polar testing circuit need to take GPIO (the General Purpose InputOutput of more CPU (central processing unit), universal input/output) resource, be generally 3~4, analog switch cost is also higher.
Utility model content
Based on this, be necessary to provide a kind of earphone interface polarity to detect and take the earphone interface circuit that resource is few.
A kind of earphone interface circuit, compatible first kind earphone interface and Second Type earphone interface are to carry out data interaction with external equipment, this first kind earphone interface comprises L channel contact pin successively, R channel contact pin, microphone contact pin and ground connection contact pin, Second Type earphone interface comprises L channel contact pin successively, R channel contact pin, ground connection contact pin and microphone contact pin, described earphone interface circuit is connected with a GPIO who produces level signal, this earphone interface circuit comprises Earphone joint, receiving circuit, transtation mission circuit and polarity switching circuit, this Earphone joint has the first contact, the second contact, R channel contact and L channel contact, in the time of plugged earphone interface, this first contact connects the microphone contact pin of first kind earphone interface or the ground connection contact pin of Second Type earphone interface, this second contact connects the ground connection contact pin of first kind earphone interface or the microphone contact pin of Second Type earphone interface, this R channel contact connects the R channel contact pin of first kind earphone interface or the R channel contact pin of Second Type earphone interface, this L channel contact connects the L channel contact pin of first kind earphone interface or the L channel contact pin of Second Type earphone interface, this receiving circuit is connected with R channel contact and the L channel contact of described Earphone joint, and this transtation mission circuit is connected with the first contact and second contact of described Earphone joint, and this polarity switching circuit is connected with described the first contact and the second contact, and this polarity switching circuit makes the first contact or the second contact ground connection of described Earphone joint under the control of described level signal, cause the microphone contact pin of described transtation mission circuit and described first kind earphone interface or Second Type earphone interface to realize data interaction.
Further, described transtation mission circuit comprises the first resistance, the second resistance, the 3rd resistance, the 4th resistance, the 5th resistance and the first electric capacity, wherein:
The first end of described the first electric capacity is connected with the first contact of described Earphone joint by described the first resistance, is connected, by described the 3rd grounding through resistance by described the second resistance with the second contact of described Earphone joint; The second end of described the first electric capacity, by described the 4th grounding through resistance, connects the microphone contact pin transmission of described data to described first kind earphone interface or Second Type earphone interface by described the 5th resistance.
Further, described polarity switching circuit comprises the first switch module and second switch module, the hot end of this first switch module is connected with the first contact of described Earphone joint, the hot end of this second switch module is connected with the second contact of described Earphone joint, the ground potential points ground connection of this first switch module and second switch module, the control end of this first switch module and second switch module receives described level signal, this first switch module can be by the first contact ground connection of described Earphone joint under the control of high level, this second switch module can be by the second contact ground connection of described Earphone joint under low level control.
Further, described the first switch module comprises the first triode, the 6th resistance and the 7th resistance, this first triode is NPN type, the first end of the 6th resistance is used for receiving described level signal as the control end of described the first switch module, and the second end of the 6th resistance connects the base stage of described the first triode; The collector electrode of described the first triode connects the first contact of described Earphone joint, grounded emitter, and be connected with its base stage by described the 7th resistance.
Further, described second switch module comprises the second triode, the 3rd triode, the 8th resistance, the 9th resistance and the tenth resistance, this second triode is positive-negative-positive, the 3rd triode is NPN type, the first end of the 8th resistance is used for receiving described level signal as the control end of described second switch module, and the second end is connected with the base stage of described two triodes; The emitter of described two triodes connects power supply, collector electrode is connected with the base stage of described the 3rd triode by described the 9th resistance, the collector electrode of described the 3rd triode connects the second contact of described Earphone joint, grounded emitter, and be connected with its base stage by described the tenth resistance.
Further, described receiving circuit comprises the 11 resistance, the 12 resistance, the 13 resistance, the 14 resistance, the 15 resistance, the 16 resistance, the second electric capacity, the 3rd electric capacity and the 4th electric capacity, wherein:
The first end of described the second electric capacity connects the R channel contact of described Earphone joint by described the 11 resistance, connect the L channel contact of described Earphone joint by the 12 resistance, and the R channel contact of this Earphone joint is by described the 13 grounding through resistance, the second end of described the second electric capacity is by the 14 grounding through resistance, be connected with the first end of the 16 resistance by the 15 resistance, the second termination power of the 16 resistance, and the first end of the 16 resistance is by described the 3rd capacity earth, the first end of described the 4th electric capacity is connected with the second end of described the second electric capacity, and as the output of described receiving circuit, the second end ground connection of described the 4th electric capacity.
In addition, a kind of portable electron device is also provided, comprise above-mentioned earphone interface circuit and central processing unit, this central processing unit comprises the Data Input Interface being connected with described receiving circuit, the data output interface being connected with described transtation mission circuit and the control interface that produces described level signal.
In above-mentioned earphone interface circuit and portable electron device, only need to use 1 GPIO mouth and can realize the switching of earphone type, save more GPIO resource than traditional method.
Brief description of the drawings
Fig. 1 is the structural representation that can be applicable to a type four-way earphone of the electronic installation of the utility model preferred embodiments;
Fig. 2 is the structural representation that can be applicable to the another type four-way earphone of the electronic installation of the utility model preferred embodiments.
Fig. 3 is the structural representation of the first kind earphone interface of the four-way earphone adaptation shown in can Fig. 1;
Fig. 4 is that structural representation the utility model embodiment of the Second Type earphone interface of the four-way earphone adaptation shown in can Fig. 2 provides
Fig. 5 is the structural representation of earphone interface circuit in the electronic installation of the utility model preferred embodiments;
Fig. 6 is the circuit theory diagrams of transtation mission circuit in the earphone interface circuit of the utility model preferred embodiments;
Fig. 7 is the circuit theory diagrams of receiving circuit in the earphone interface circuit of the utility model preferred embodiments;
Fig. 8 is the circuit theory diagrams of a switch module of earphone interface circuit Semi-polarity commutation circuit of the utility model preferred embodiments;
Fig. 9 is the circuit theory diagrams of another switch module of earphone interface circuit Semi-polarity commutation circuit of the utility model preferred embodiments.
Embodiment
In order to make the technical problems to be solved in the utility model, technical scheme and beneficial effect clearer, below in conjunction with drawings and Examples, the utility model is further elaborated.Should be appreciated that specific embodiment described herein is only in order to explain the utility model, and be not used in restriction the utility model.
The utility model preferred embodiments provides a kind of portable electron device (figure is mark not), for example mobile phone card-brushing device, POS machines etc., can compatible two kinds of dissimilar four-way earphones, and carry out data interaction by four-way Earphone joint and external equipment (as mobile phone).For convenience of description, in the present embodiment, the four-way earphone that each contact point structure from outside to inside is as shown in Figure 1 followed successively by L channel contact L, R channel contact R, microphone contact MIC and ground contact GND is defined as first kind Earphone joint; The four-way earphone that each contact point structure from outside to inside is as shown in Figure 2 followed successively by L channel contact L, R channel contact R, ground contact GND and microphone contact MIC is defined as Second Type Earphone joint.The four-way earphone that each contact point structure from outside to inside is as shown in Figure 3 followed successively by L channel contact pin L, R channel contact pin R, microphone contact pin MIC and ground connection contact pin GND be defined as with Fig. 1 in the first kind earphone interface 11 of first kind Earphone joint adaptation; The four-way earphone that each contact point structure from outside to inside is as shown in Figure 4 followed successively by L channel contact L, R channel contact R, ground contact GND and microphone contact MIC be defined as with Fig. 2 in the Second Type Earphone joint 12 of Second Type earphone adaptation.
See also Fig. 3, Fig. 4 and Fig. 5, this portable electron device comprises earphone interface circuit 100 and central processing unit 200, earphone interface circuit 100 is connected with a control port GPIO who produces level signal MIC_Ctrl on central processing unit 200, and this earphone interface circuit 100 comprises Earphone joint 110, receiving circuit 130, transtation mission circuit 120 and polarity switching circuit 140; This central processing unit 200 comprises the Data Input Interface IN being connected with described receiving circuit 130, the data output interface OUT being connected with described transtation mission circuit 120 and the control interface GPIO that produces described level signal MIC_Ctrl.
This Earphone joint 110 has the first contact MIC/GND1, the second contact MIC/GND2, R channel contact EAR+ and L channel contact EAR-.In the time inserting the earphone interface (please refer to Fig. 3 and Fig. 4) of external equipment, this first contact MIC/GND1 connects the microphone contact pin MIC of first kind earphone interface 11 or the ground connection contact pin GND of Second Type earphone interface 12, this second contact MIC/GND2 connects the ground connection contact pin GND of first kind earphone interface 11 or the microphone contact pin MIC of Second Type earphone interface 12, this R channel contact EAR+ connects the R channel contact pin of first kind earphone interface 11 or the R channel contact pin R of Second Type earphone interface 12, this L channel contact EAR-connects the L channel contact pin L of first kind earphone interface 11 or the L channel contact pin L of Second Type earphone interface 12, this receiving circuit 130 is connected with R channel contact EAR+ and the L channel contact EAR-of described Earphone joint 110, this transtation mission circuit 120 is connected with the first contact MIC/GND1 and the second contact MIC/GND2 of described Earphone joint 110, and this polarity switching circuit 140 is connected with described the first contact MIC/GND1 and the second contact MIC/GND2, and this polarity switching circuit 140 makes the first contact MIC/GND1 or the second contact MIC/GND2 ground connection of described Earphone joint 110 under the control of described level signal MIC_Ctrl, cause described transtation mission circuit 120 and the microphone contact pin MIC of described first kind earphone interface 11 or Second Type earphone interface 12 to realize data interaction.
With reference to figure 6, transtation mission circuit 120 comprises the first resistance R 1, the second resistance R 2, the 3rd resistance R 3, the 4th resistance R 4, the 5th resistance R 5 and the first electric capacity R6.
The first end of described the first electric capacity R6 is connected with the first contact MIC/GND1 of described Earphone joint 110 by described the first resistance R 1, be connected with the second contact MIC/GND2 of described Earphone joint 110 by described the second resistance R 2, by described the 3rd resistance R 3 ground connection; The second end of described the first electric capacity R6 is by described the 4th resistance R 4 ground connection, be connected with the data output interface OUT of central controller 200 by described the 5th resistance R 5, connect described data the microphone contact pin MIC transmission to described first kind earphone interface 11 or Second Type earphone interface 12.
With reference to figure 7, receiving circuit 130 comprises the 11 resistance R the 11, the 12 resistance R the 12, the 13 resistance R the 13, the 14 resistance R the 14, the 15 resistance R the 15, the 16 resistance R 16, the second capacitor C 2, the 3rd capacitor C 3 and the 4th capacitor C 4.
The first end of described the second capacitor C 2 connects the R channel contact EAR+ of described Earphone joint 110 by described the 11 resistance R 11, connect the L channel contact EAR-of described Earphone joint 110 by the 12 resistance R 12, and the R channel contact EAR+ of this Earphone joint 110 is by described the 13 resistance R 13 ground connection, the second end of described the second capacitor C 2 is by the 14 resistance R 14 ground connection, be connected with the first end of the 16 resistance R 16 by the 15 resistance R 15, the second termination power of the 16 resistance R 16, and the first end of the 16 resistance R 16 is by described the 3rd capacitor C 3 ground connection, the first end of described the 4th capacitor C 4 is connected with the second end of described the second capacitor C 2, and be connected as the output of described receiving circuit 130 and the Data Input Interface IN of central processing unit 200, the second end ground connection of described the 4th capacitor C 4.
Please also refer to Fig. 5, Fig. 8 and Fig. 9, polarity switching circuit 140 comprises the first switch module 141 and second switch module 142, the hot end of this first switch module 141 is connected with the first contact MIC/GND1 of described Earphone joint 110, the hot end of this second switch module 142 is connected with the second contact MIC/GND2 of described Earphone joint 110, the ground potential points ground connection of this first switch module 141 and second switch module 142, the control end of this first switch module 141 and second switch module 142 receives described level signal MIC_Ctrl, this first switch module 141 can be by the first contact MIC/GND1 ground connection of described Earphone joint 110 under the control of high level, this second switch module 142 can be by the second contact MIC/GND2 ground connection of described Earphone joint 110 under low level control.
With reference to figure 8, described the first switch module 141 comprises the first triode Q1, the 6th resistance R 6 and the 7th resistance R 7, this first triode Q1 is NPN type, the first end of the 6th resistance R 6 is used for receiving described level signal MIC_Ctrl as the control end of described the first switch module 141, and the second end of the 6th resistance R 6 connects the base stage of described the first triode Q1; The first contact MIC/GND1 that the collector electrode of described the first triode Q1 connects described Earphone joint 110 as the hot end of the first switch module 141 connects, the emitter of described the first triode Q1 is as the earth potential end ground connection of the first switch module 141, and is connected with its base stage by described the 7th resistance R 7.
With reference to figure 9, described second switch module 142 comprises the second triode Q2, the 3rd triode Q3, the 8th resistance R 8, the 9th resistance R 9 and the tenth resistance R 10, this second triode Q2 is positive-negative-positive, the 3rd triode Q3 is NPN type, the first end of the 8th resistance R 8 is used for receiving described level signal MIC_Ctrl as the control end of described second switch module 142, and the second end is connected with the base stage of the second triode Q2; The emitter of the second triode Q2 connects power supply, the collector electrode of the second triode Q2 is connected with the base stage of described the 3rd triode Q3 by described the 9th resistance R 9, the collector electrode of described the 3rd triode Q3 connects the described hot end as second switch module 142 and is connected with the second contact MIC/GND2 of Earphone joint 110, emitter is as the cold end ground connection of second switch module 142, and is connected with its base stage by described the tenth resistance R 10.
Periodically switch the first contact MIC/GND1 and the second contact MIC/GND2 connection to ground by two NPN type triodes, external equipment coordinates with mancarried electronic aid and sends and detect whether interaction success of data, once data interaction success, represent that current polarity is correct, stop switching, start normal communication.In order to reduce the quantity of the GPIO mouth that uses central processing unit 200, between two NPN type triodes, realize the function of logic NOT with a PNP triode, only need so altogether 1 GPIO mouth just can realize automatic detection and polarity handoff functionality, compare traditional method, utilize 3~4 GPIO mouths to reduce a lot, and with triode replace analog switch can save cost.
The operation principle of the electronic installation in the utility model preferred embodiment will be introduced in detail below.
In earphone interface circuit 100, R channel contact EAR+ and L channel contact EAR-are used for receiving data, microphone contact in the first contact MIC/GND1 and the second contact MIC/GND2 is used for sending data, because the left and right acoustic channels of two kinds of earphone standards is all the same, therefore receiving circuit 130 need not switch; For transtation mission circuit 120, due to uncertain the first contact MIC/GND1 and the second contact MIC/GND2, which is earth point, which is microphone contact, but transmitted signal is loaded into this first contact MIC/GND1 and the second contact MIC/GND2 the signal Audio_out after coding (above-mentioned data) by resistance, real microphone contact can obtain the signal needing, real earth point can be shorted to ground the signal sending over, invalidating signal, owing to there being resistive isolation, transmitted signal can not be affected; Polarity switching circuit 140, level signal MIC_Ctrl is the control signal of the control interface GPIO output of central processing unit 200, in the time that level signal MIC_Ctrl is high level, the first contact MIC/GND1 receives ground, the second contact MIC/GND2 is unsettled, and the earphone interface that now Earphone joint 110 accesses is OMTP standard; In the time that level signal MIC_Ctrl is low level, the second contact MIC/GND2 receives GND ground, and the first contact MIC/GND1 is unsettled, and the earphone interface that now Earphone joint 110 accesses is CTIA standard; Level signal MIC_Ctrl periodically exports high level, low level, and external equipment coordinates with mancarried electronic aid and sends and detect whether interaction success of data, once data interaction success, represent that current polarity is correct, stop switching, polarity judges and has switched, starts normal communication.
The foregoing is only preferred embodiment of the present utility model; not in order to limit the utility model; all any amendments of doing within spirit of the present utility model and principle, be equal to and replace and improvement etc., within all should being included in protection range of the present utility model.