Invention content
The purpose of the present invention aims to solve at least one of described technological deficiency.
For this purpose, it is an object of the invention to propose a kind of super adaption system of serial ports
To achieve the goals above, the embodiment of the present invention provides a kind of super adaption system of serial ports, including:First two-waySPDT switch, the second two-way SPDT switch, two-way SP3T switches, the first electrical level transferring chip, second electrical level conversion chip, firstOperational amplifier, second operational amplifier and control chip, wherein
The ends TX1 and the ends RX2 of the first two-way SPDT switch are connect with the ends TX/RX from equipment, first two-wayThe ends TX2 and the ends RX1 of SPDT switch are connect with the ends RX/TX from equipment, the ends TX_S1 of the first two-way SPDT switch and instituteThe ends TX3 stated the first electrical level transferring chip to connect with the ends TX_IN of second electrical level conversion chip, and switched with the two-way SP3TConnection, the ends RX_S1 of the first two-way SPDT switch and first electrical level transferring chip and second electrical level conversion chipThe ends the RX3 connection of the forward end of the ends RX_IN and the first operational amplifier, two-way SP3T switches, first level turnThe ends TX_OUT for changing chip are connect with the ends TX4 switched the two-way SP3T, the RX4 at the ends RX_OUT and two-way SP3T switchesEnd connection, for that will be and the matched high level of main equipment from the low transition of equipment;The second electrical level conversion chipThe ends TX_OUT are connect with the ends TX5 switched the two-way SP3T, and the ends RX_OUT are connect with the ends RX5 switched the two-way SP3T,For the matched low level of main equipment will to be changed to from the highland flat turn of equipment,
The ends TX_S3, second operation at the ends TX_S2 and the second two-way SPDT switch of the two-way SP3T switchesThe forward end of amplifier connects, and the ends RX_S2 and the ends RX_S3 of the second two-way SPDT switch of the two-way SP3T switches connectIt connects, the ends TX6 of the second two-way SPDT switch and the ends TX/RX of main equipment connect, the RX6 of the second two-way SPDT switchEnd is connect with the ends RX/TX of the main equipment, and the output end of first operational amplifier and second operational amplifier is and instituteState control chip connection, the control chip further makes with the first two-way SPDT switch and the second two-way SPDT switchIt can end EN and the connection of the switching end ends SW, the Enable Pin EN with first electrical level transferring chip and second electrical level conversion chipConnection,
Wherein, two pins of the control chip are connect respectively at described from the ends TX/RX of equipment and the ends RX/TX,Another two pin is connect with the ends TX/RX of the main equipment and the ends RX/TX respectively, is cut for detecting level height with carrying out switchIt changes;Two pins that the control chip is connect with the main equipment continue trapped state, and arbitrary signal is sent at main equipment end,The data received are stored in storehouse by the control chip, and the second two-way SPDT switch is enabled according to differentiating to the pin for having signalSwitched path;Correspondingly, the control chip continues trapped state with two connect from equipment the pin, from equipment endArbitrary signal is sent, the data received are stored in storehouse by the control chip, and the is enabled according to differentiating to the pin for having signalOne two-way SPDT switch switched path reaches direction adaptation.
Further, the control chip uses microcontroller.
Further, further include:Triode RC time delay circuits, the first data indicator light and the second data indicator light, wherein instituteThe input terminal for stating triode RC time delay circuits is connect with the second two-way SPDT switch, the triode RC time delay circuits it is defeatedOutlet is connect with the first data indicator light and the second data indicator light respectively.
Further, when described identical with the level of the main equipment from equipment, two-way described in the control chip controlsSP3T switchings are to TX3/RX3;
When the level for being less than the main equipment from the level of equipment, two-way SP3T described in the control chip controlsSwitching is to TX4/RX4;
When the level for being higher than the main equipment from the level of equipment, two-way SP3T described in the control chip controlsSwitching is to TX5/RX5.
Further, two pins of the microcontroller are connect respectively at described from the ends TX/RX of equipment and the ends RX/TX,Level height for detecting above-mentioned both ends then enables the first two-way SPDT switch when detecting that the ends TX/RX are high level, willSwitching is to TX1 and RX1;When detecting that the ends RX/TX are high level, then the first two-way SPDT switch is enabled, by switchingTo TX2 and RX2;
The another two pin of the microcontroller is connect respectively at the ends TX/RX of the main equipment and the ends RX/TX, for examiningThe level height for surveying above-mentioned both ends then enables the second two-way SPDT switch, switch is cut when detecting that the ends TX/RX are high levelChange to TX6 and RX6;When detect the ends RX/TX be high level, then enable the second two-way SPDT switch, by switching to TX7 withRX7。
Further, when the microcontroller is differentiated to the TX/RX end pipe feet that the pin for having signal be connection main equipment, enabled theTwo two-way SPDT switches, switched path to TX6 and RX6;If differentiating that there is the pin of signal be the RX/TX for connecting main equipmentWhen end pipe foot, the second two-way SPDT switch, switched path to TX7 and RX7 are enabled.
Further, the control chip carries out level adapted after completing direction adaptation, enables the first two-way SPDT switchWith the second two-way SPDT switch, the output signal of the first operation comparator and the second operation comparator is read, if it is high level,Then judge the level of comparator front end input for 3.3V;If it is low level, then judge that the level of comparator front end input is1.8V。
The super adaption system of serial ports according to the ... of the embodiment of the present invention, the interface direction of automatic adaptation access and interface level,It as long as being inserted into, can work normally, not have to distinguish serial ports direction or serial ports level.The present invention is mainly with terminal device stringIt for mouth-UART port, but actually uses scheme and is not limited to UART port, other serial ports adaptation schemes similarly are also contained in this hairIn bright.In addition the present invention can not only make serial port adapter, but also can be integrated in host side makes interface become super serial ports,Greatly facilitate use.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partly become from the following descriptionObviously, or practice through the invention is recognized.
Specific implementation mode
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to endSame or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attachedThe embodiment of figure description is exemplary, it is intended to for explaining the present invention, and is not considered as limiting the invention.
The present invention propose a kind of serial ports direction, level super adaption system, carried out side using some characteristics of serial portsThe design of case, is greatly improved convenience.
As shown in Figure 1, the super adaption system of the serial ports of the embodiment of the present invention, including:First two-way SPDT switch, second pairRoad SPDT switch, two-way SP3T switches, the first electrical level transferring chip 500, second electrical level conversion chip 600, the first operation amplifierDevice 700, second operational amplifier 800 and control chip 100.In one embodiment of the invention, control chip 100 can be adoptedUse microcontroller.It should be noted that two-way SP3T switches can also use the substitute switching switch for realizing identical function, mainlyRealize the matching problem of front and back level.
First two-way SPDT switch is mainly used for solving, from the directionality problem of equipment 300TX/RX, being controlled using microcontrollerMake its enabled and switching.It is not turned on it should be noted that the switch preferably inputs output end in the case where EN feet drag down,And the frequency of switch can reach that 500K or more can be very abundant meet rate requirement.Second two-way SPDT switch is mainDirectionality problem for solving main equipment 400TX/RX, principle and the first two-way SPDT switch are substantially completely identical, same to useMicrocontroller is carried out controlling its switching and be enabled.
The ends TX1 and the ends RX2 of first two-way SPDT switch are connect with the ends TX/RX from equipment 300, and the first two-way SPDT is openedThe ends TX2 and the ends RX1 of pass are connect with the ends RX/TX from equipment 300, the ends TX_S1 and the first level of the first two-way SPDT switchConversion chip 500 is connected with the ends TX_IN of second electrical level conversion chip 600, and is connect with the ends TX3 of two-way SP3T switches, theThe ends RX_IN of the ends RX_S1 of one two-way SPDT switch and the first electrical level transferring chip 500 and second electrical level conversion chip 600 withAnd first operational amplifier 700 forward end, two-way SP3T switch the connection of the ends RX3, the TX_ of the first electrical level transferring chip 500OUT terminal is connect with the ends TX4 that two-way SP3T is switched, and the ends RX_OUT are connect with the ends RX4 that two-way SP3T is switched, and being used for will be from equipment300 low transition be and 400 matched high level of main equipment;The ends TX_OUT of second electrical level conversion chip 600 and two-wayThe ends the TX5 connection of SP3T switches, the ends RX_OUT connect with the ends RX5 that two-way SP3T is switched, and being used for will be from the high Horizon of equipment 300Be converted to 400 matched low level of main equipment.
The ends TX_S2 of two-way SP3T switch and the ends TX_S3 of the second two-way SPDT switch, second operational amplifier 800Forward end connects, and the ends RX_S2 of two-way SP3T switches are connect with the ends RX_S3 of the second two-way SPDT switch, the second two-way SPDTThe ends TX6 of switch are connect with the ends TX/RX of main equipment 400, the RX/TX at the ends RX6 and main equipment 400 of the second two-way SPDT switchThe output end of end connection, the first operational amplifier 700 and second operational amplifier 800 is connect with control chip 100, controls corePiece 100 further connects with the Enable Pin EN and the switching end ends SW of the first two-way SPDT switch and the second two-way SPDT switchIt connects, connect with the Enable Pin EN of the first electrical level transferring chip 500 and second electrical level conversion chip 600.
Two electrical level transferring chips are mainly to realize the transfer problem of front and back level.
By taking UART as an example, it is 1.8V and two kinds of 3.3V that most common UART, which is divided to, and the first electrical level transferring chip 500 is from settingStandby 300 are 1.8V signals, under the particular context that main equipment 400 is 3.3V signals, and the signal of front end 1.8V is converted to 3.3V'sSignal.
Second electrical level conversion chip 600 is to realize antipodal function, i.e., in the signal from equipment 300 for 3.3V, masterEquipment 400 is that the signal of front end 3.3V is converted to the signal of 1.8V under the particular context of the signal of 1.8V.It notes also thatBe that the two electrical level transferring chips preferably input output end and are not turned on, and the frequency supported needs to reach 500K or moreJust it is well positioned to meet rate requirement.
The main matching problem for realizing front and back level of two-way SP3T switches.Equally by taking UART as an example, may be from equipment 300Either 3.3V main equipments 400 are equally possible is 1.8V or 3.3V by 1.8V, therefore can have four kinds of level conditions.
(1) when identical with the level of main equipment 400 from equipment 300, control chip 100 controls two-way SP3T switchingsTo TX3/RX3.For example, being 1.8V from equipment 300, main equipment 400 is 1.8V.
(2) when identical with the level of main equipment 400 from equipment 300, control chip 100 controls two-way SP3T switchingsTo TX3/RX3.For example, being 3.3V from equipment 300, main equipment 400 is 3.3V.
(1), (2) both of these case lower switch can be switched to TX3/RX3, since level is matched, so from settingBeing connected directly with main equipment 400 for 300 can.
(3) when being less than the level of main equipment 400 from the level of equipment 300, control chip 100 controls two-way SP3T switchesIt is switched to TX4/RX4.For example, being 1.8V from equipment 300, main equipment 400 is 3.3V;In this case it is switched to TX4/RX4, is madeTurn the first electrical level transferring chip 500 of 3.3V with 1.8V.
(4) when being higher than the level of main equipment 400 from the level of equipment 300, control chip 100 controls two-way SP3T switchesIt is switched to TX5/RX5.For example, being 3.3V from equipment 300, main equipment 400 is 1.8V, is switched to TX5/RX5 in this case, makesTurn the second electrical level conversion chip 600 of 1.8V with 3.3V.
Same electrical level transferring chip positive-negative connected (A to B either B to A) uses unconfined turn of front and back level heightChip is changed, the two conversion chips can use the chip of the same model.
Controlling chip 100, mainly control is used, and notices that the level for being uniformly controlled pin is a range.Control chip 100Two pins respectively at from equipment 300 the ends TX/RX and the ends RX/TX connect, another two pin respectively with main equipment 400The ends TX/RX are connected with the ends RX/TX, for detecting level height to carry out switching.By taking UART as an example, microcontroller has to prop upThe level input of 1.8-3.3V is held, and 1/2 and 3/4 foot needs to support the high level of judgement 1.8V and 3.3V, therefore interface is unifiedFor 1.8V, the incoming level upper limit is a kind of relatively good selection higher than 3.3V.
Two pins that control chip 100 is connect with main equipment 400 continue trapped state, send and appoint at 400 end of main equipmentThe data received are stored in storehouse by meaning signal, control chip 100, and the second two-way is enabled according to differentiating to the pin for having signalSPDT switch switched path;Correspondingly, two pins being connect with from equipment 300 of control chip 100 continue trapped state, from300 end of equipment sends arbitrary signal, and the data received are stored in storehouse by control chip 100, according to differentiation to the pipe for having signalFoot enables the first two-way SPDT switch switched path, reaches direction adaptation.
Two pins of microcontroller respectively at from equipment 300 the ends TX/RX and the ends RX/TX connect, it is above-mentioned for detectingThe level height at both ends then enables the first two-way SPDT switch, by switching to TX1 when detecting that the ends TX/RX are high levelAnd RX1;When detecting that the ends RX/TX are high level, then the first two-way SPDT switch is enabled, by switching to TX2 and RX2;
The another two pin of microcontroller is connect respectively at the ends TX/RX of main equipment 400 and the ends RX/TX, for detectingThe level height for stating both ends then enables the second two-way SPDT switch, switching is arrived when detecting that the ends TX/RX are high levelTX6 and RX6;When detecting that the ends RX/TX are high level, then the second two-way SPDT switch is enabled, by switching to TX7 and RX7.
It is when connecting the TX/RX end pipe feet of main equipment 400, to enable the second two-way that microcontroller, which differentiates to the pin for having signal,SPDT switch, switched path to TX6 and RX6;If differentiating that there is the pin of signal be the ends RX/TX for connecting main equipment 400When pin, the second two-way SPDT switch, switched path to TX7 and RX7 are enabled.
Chip 100 is controlled after completing direction adaptation, level adapted is carried out, enables the first two-way SPDT switch and second pairRoad SPDT switch, the output signal for reading the first operation comparator and the second operation comparator then judge ratio if it is high levelLevel compared with the input of device front end is 3.3V;If it is low level, then judge the level of comparator front end input for 1.8V.
In addition, the super adaption system of the serial ports of the embodiment of the present invention, further includes:Triode RC time delay circuits 200, first countAccording to indicator light and the second data indicator light, wherein the input terminal of triode RC time delay circuits 200 and the second two-way SPDT switch connectIt connects, the output end of triode RC time delay circuits 200 is connect with the first data indicator light and the second data indicator light respectively, to realityExisting data flow instruction.
With reference to figure 1, the super adaption system of serial ports of the embodiment of the present invention, operation principle is as follows:
(all devices are given tacit consent to all in off state), 1 and 2 feet of microcontroller can carry out two after serial ports is all connected on both sidesGrade detects, because most of serial ports is gathered around, there are one characteristics if the first order, are exactly only TX meetings when external high-impedance statePull-up, therefore also only have TX that can detect high level.Another RX is generally high resistant, or drags down, therefore the 1 of microcontrollerIt can only identify that one of them is high level with 2 feet, another is not.
If normally detecting that 1 foot of microcontroller is high level, 2 feet are not then to control and enable the first two-way SPDT switchSPDT1, by switching to TX2 and RX2 (by 11/12 foot control system of microcontroller, just opposite with 400 one end TX/RX of main equipment).If detecting that 2 feet of microcontroller are high level and 1 foot is not, control and enable the first two-way SPDT switch SPDT1, then willSwitching is to TX1 and RX1 (by 11/12 foot control system of microcontroller, just opposite with 400 one end TX/RX of main equipment).It in this way can mistakeMost equipment is filtered, once first order logic detection success (1Z/10 or Z1/01), will detect without the second level,If being otherwise all 1 just carries out second level detection.
3 and 4 feet of microcontroller also need to carry out the detection of same flow, if 3 feet detect high level, 4 feet do not have,It so controls and enables the second two-way SPDT switch SPDT3, by switching to TX6 and RX6 (by 13/14 foot control system of microcontroller).If 4 feet detect high level and 3 feet do not have, controls and enable the second two-way SPDT switch SPDT3 by switching to TX7With RX7 (by 13/14 foot control system of microcontroller).Second level detection is to detect to fail in first order condition, that is, detect 11It is carried out when logic.The equipment of very few can pull up RX, these tabless of equipment by break opening contact detection be it is impossible, mustIt must carry out logical signal detection.In this case, microcontroller can enter the lasting trapped state of 3/4 foot first, in main equipment400 ends send arbitrary signal, and 3/4 foot of microcontroller has a certain pin and receives a data, this data is stored in storehouse.When sentencingWhen the pin for being clipped to signal is 3 foot, then enabled SPDT3 and then switched path are equally carried out to TX6 and RX6;If differentiation is arrivedIt is 4 feet to have the pin of signal, then enabling SPDT3 and then switched path to TX7 and RX7.If also entering from equipment 300Two level is sending arbitrary signal from equipment 300, is then being differentiated and controlled by 1 foot and 2 feet then can equally enter identical flowSPDT1 processed reaches direction adaptation.
After the completion of RX and the TX adaptation of main equipment 400, SPDT1 and SPDT3 can be enabled again at this time into the matching of line level,Then the output signal of two comparators is read.The comparator of 5 foot of microcontroller connection, datum for comparing is 2.2~2.8V can be realized with the mode of LDO or electric resistance partial pressure.If input is high level 1, illustrate the input of comparator front endLevel is 3.3V;If input is low level 0, illustrate that the level of comparator front end input is 1.8V.Same reason carries outDetect another comparator.Second comparator, one principle illustrates that comparator front end is defeated if input is high level 1The level entered is 3.3V;If input is low level 0, illustrate that the level of comparator front end input is 1.8V.
It has been completed to the judgement of level range at this time, then need to be adapted to switch by intermediate conversion chip,Adaptation method is with reference to aforementioned:
(1) when identical with the level of main equipment 400 from equipment 300, control chip 100 controls two-way SP3T switchingsTo TX3/RX3.
(2) when being less than the level of main equipment 400 from the level of equipment 300, control chip 100 controls two-way SP3T switchesIt is switched to TX4/RX4.
(3) when being higher than the level of main equipment 400 from the level of equipment 300, control chip 100 controls two-way SP3T switchesIt is switched to TX5/RX5.
Finally when adaptation is complete, the enabled of all switches, switching and the enabled of electrical level transferring chip should be in oneUnder a correct control.
In most cases, adaptation procedure is quick and automatic, if entering second level inspection mentioned immediately aboveIt surveys, then sending a notification instruction toward connection equipment end or being flickered with the warning of lamp to prompt user to carry out simple operations.User needs the transmission arbitrary signal on one side in prompt, the bag data continuously to send out above and separated in time three times, ensureIt will not be judged by accident because of packet loss problem.So far adaptation procedure is fully finished in the case of various.
The super adaption system of serial ports according to the ... of the embodiment of the present invention, the interface direction of automatic adaptation access and interface level,It as long as being inserted into, can work normally, not have to distinguish serial ports direction or serial ports level.The present invention is mainly with terminal device stringIt for mouth-UART port, but actually uses scheme and is not limited to UART port, other serial ports adaptation schemes similarly are also contained in this hairIn bright.In addition the present invention can not only make serial port adapter, but also can be integrated in host side makes interface become super serial ports,Greatly facilitate use.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically showThe description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or examplePoint is included at least one embodiment or example of the invention.In the present specification, schematic expression of the above terms are notCentainly refer to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be anyOne or more embodiments or example in can be combined in any suitable manner.
Although the embodiments of the present invention has been shown and described above, it is to be understood that above-described embodiment is exampleProperty, it is not considered as limiting the invention, those skilled in the art are not departing from the principle of the present invention and objectiveIn the case of can make changes, modifications, alterations, and variations to the above described embodiments within the scope of the invention.The scope of the present inventionIt is extremely equally limited by appended claims.