How to communicate between MCUs with different level signals?

Let’s talk about the purpose of this circuit first: when two MCUs work under different working voltages (such as MCU1 working voltage 5V; MCU2 working Voltage 3.3V), then how to communicate serially between MCU1 and MCU2? Obviously, the corresponding TX and RX pins cannot be directly connected, otherwise the MCU with lower working voltage may be burned!

Let’s talk about the purpose of this circuit first: when two MCUs work under different working voltages (such as MCU1 working voltage 5V; MCU2 working voltage 3.3V), then how to communicate serially between MCU1 and MCU2? Obviously, the corresponding TX and RX pins cannot be directly connected, otherwise the MCU with lower working voltage may be burned!

The “level bidirectional conversion circuit” in Figure 1 can realize serial communication between MCUs with different VDD (chip operating voltage).

How to communicate between MCUs with different level signals?
figure 1

The core of the circuit lies in the MOS field effect Transistor (2N7002) in the circuit. It is very similar in function to the triode, and can be used as a switch to control the ON and off of the circuit. However, compared with triodes, MOS tubes have many advantages, which will be discussed in detail later.

Figure 2 is the 3D diagram and circuit diagram of the MOS tube. Simply put, to use it as a switch, as long as Vgs (on voltage) reaches a certain value, pins D and S will be turned on, and Vgs will be turned off before reaching this value.

How to communicate between MCUs with different level signals?
figure 2

The role of adding MOS tube

How to apply 2N7002 to the above circuit, and what role does it play? Let’s analyze it below.

How to communicate between MCUs with different level signals?
image 3

Looking at Figure 3, if you follow the lines a and b, cut the circuit. Then the TX pin of MCU1 is pulled up to 5V, and the RX pin of MCU2 is also pulled up to 3.3V. When the S and D pins of 2N7002 (corresponding to pins 2 and 3 in Figure 3) are turned off, it is equivalent to two lines a and b, cutting off the circuit. That is to say, this circuit can be done when the 2N7002 is turned off, delivering the corresponding working voltage to the two MCU pins.

1. Analyze the data transmission direction MCU1→MCU2:

How to communicate between MCUs with different level signals?
Figure 4

1) MCU1 TX sends a high level (5V), MCU2 RX is configured as a serial port receiving pin, at this time the S and D pins of 2N7002 (corresponding to pins 2 and 3 in Figure 4) are turned off, and diode 3 in 2N7002 → 2 directions are blocked. Then MCU2 RX is pulled up to 3.3V by VCC2.

2) MCU1 TX sends low level (0V), at this time the S and D pins of 2N7002 are still off, but the diodes 2→3 in 2N7002 are connected in the direction, that is, the diodes in VCC2, R2, 2N7002, and MCU1 TX form a loop . The 2 pin of 2N7002 is pulled low, at this time MCU2 RX is 0V. The circuit from MCU1 to MCU2 direction, data transmission, to achieve the effect of level conversion.

2. Analyze the data transmission direction MCU2→MCU1:

How to communicate between MCUs with different level signals?
Figure 5

1) MCU2 TX sends a high level (3.3V), at this time, the voltage difference of Vgs (the voltage difference between pins 1 and 2 in Figure 5) is approximately equal to 0, the 2N7002 is cut off, and the diode 3→2 in the 2N7002 is blocked in the direction. At this time, MCU1 The RX pin is pulled up to 5V by VCC1.

2) MCU2 TX sends a low level (0V), at this time, the voltage difference of Vgs (the voltage difference between pins 1 and 2 in Figure 5) is about 3.3V, the 2N7002 is turned on, the diode 3→2 in the 2N7002 is blocked in the direction, VCC1, The diodes in R1, 2N7002 and MCU2 TX form a loop. The 3 pin of 2N7002 is pulled low, at this time MCU1 RX is 0V.

The circuit from MCU2 to MCU1 direction, data transmission, to achieve the effect of level conversion.

At this point, the circuit is analyzed. This is a bidirectional serial level conversion circuit.

The advantages of MOS tube

1. The source S, gate G, and drain D of the FET correspond to the emitter e, base b, and collector c of the triode respectively, and their functions are similar. Figure 5(a) shows the N-channel MOS Transistor and NPN Transistor pin, (b) shows the corresponding diagram of P-channel MOS transistor and PNP transistor pin.

How to communicate between MCUs with different level signals?
Image 6

2. The FET is a voltage-controlled current device, and the ID is controlled by VGS. The ordinary transistor is a current-controlled current device, and the IC is controlled by the IB. The MOS pipe amplification factor is (transconductance gm) how many amps the drain current can be caused to change when the gate voltage changes by one volt. The transistor is the current amplification factor (beta) by how much the collector current can change when the base current changes by one milliamp.

3. The gate and other electrodes of the FET are insulated and do not generate current; while the base current IB determines the collector current IC when the triode works. Therefore, the input resistance of the FET is much higher than that of the triode.

4. The field effect tube only has majority carriers involved in conduction; the triode has both majority carriers and minority carriers involved in conduction. Because the minority carrier concentration is greatly affected by factors such as temperature and radiation, the field The effect tube has better temperature stability than the triode.

5. When the source electrode of the FET is not connected to the substrate, the source electrode and the drain electrode can be used interchangeably, and the characteristics change little, but when the collector electrode and the emitter electrode of the triode are used interchangeably, the characteristics are very different. large, the b value will decrease a lot.

6. The noise figure of the FET is very small. The FET should be selected in the input stage of the low noise Amplifier circuit and the circuit requiring a high signal-to-noise ratio.

7. Field effect transistors and ordinary transistors can be used to form various amplifying circuits and switching circuits, but the manufacturing process of field effect transistors is simple and has excellent characteristics that ordinary transistors cannot match. It is gradually being replaced in various circuits and applications. Common transistors, field effect transistors have been widely used in current large-scale and ultra-large-scale integrated circuits.

8. High input impedance and low driving power: Since there is a silicon dioxide (SiO2) insulating layer between the gate and source, the DC resistance between the gate and source is basically the SiO2 insulation resistance, generally about 100MΩ, and the AC input impedance is basically The capacitive reactance of the input Capacitor.

Due to the high input impedance, there will be no voltage drop for the excitation signal, and it can be driven with voltage, so the driving power is extremely small (high sensitivity). The general transistor must have the base voltage Vb, and then generate the base current Ib, in order to drive the generation of the collector current. The driving of the transistor requires power (Vb×Ib).

9. Fast switching speed: The switching speed of mosfet has a great relationship with the capacitive characteristics of the input. Due to the existence of the capacitive characteristics of the input, the switching speed is slowed down, but when used as a switch, the internal resistance of the drive circuit can be reduced. , to speed up the switching speed (the input is driven by the “perfusion circuit” described later, which speeds up the capacitive charge and discharge time).

The MOSFET only relies on the conduction of many electrons, and there is no minority carrier storage effect, so the turn-off process is very fast, the switching time is between 10-100ns, and the operating frequency can reach more than 100kHz. There is always a hysteresis in the switch, which affects the improvement of the switching speed (the operating frequency of the switching power supply using MOS transistors can easily reach 100K/S~150K/S, which is unimaginable for ordinary high-power transistors) .

10. No secondary breakdown: Because ordinary power transistors have the phenomenon that when the temperature rises, the collector current will rise (positive temperature-current characteristics), and the rise of the collector current will cause the temperature to rise further. A further rise in temperature further leads to a vicious circle of rising collector current.

The withstand voltage VCEO of the transistor decreases gradually as the temperature of the transistor increases, which results in the continuous rise of the tube temperature and the continuous decrease of the withstand voltage, which eventually leads to the breakdown of the transistor. The destructive thermoelectric breakdown phenomenon, which accounts for 95% of the tube damage rate, is also known as the secondary breakdown phenomenon.

The MOS tube has the opposite temperature-current characteristics to the ordinary transistor, that is, when the tube temperature (or ambient temperature) rises, the channel current IDS drops instead. For example; a MOS FET switch with IDS=10A, when the VGS control voltage remains unchanged, IDS=3A at a temperature of 250C, when the chip temperature rises to 1000C, the IDS decreases to 2A, which is caused by the temperature rise. The negative temperature current characteristics of the channel current IDS drop, so that it will not generate a vicious cycle and thermal breakdown.

That is to say, there is no secondary breakdown of the MOS tube. It can be seen that the damage rate of the switch tube is greatly reduced by using the MOS tube as the switch tube. The greatly reduced damage rate is also an excellent proof.

11. After the MOS tube is turned on, its conduction characteristics are purely resistive: when the ordinary transistor is saturated and turned on, it is almost straight, and there is a very low voltage drop, which is called the saturation voltage drop. Since there is a voltage drop, then That is; ordinary transistors are equivalent to a Resistor with a very small resistance after saturation conduction, but this equivalent Resistor is a nonlinear resistor (the voltage on the resistor and the current flowing through it cannot conform to Ohm’s law), The MOS tube is used as a switch tube, and there is also a very small resistance after saturation conduction.

However, this resistor is equivalent to a Linear resistor. The resistance value of the resistor, the voltage drop at both ends, and the current flowing through it conform to Ohm’s law. The larger the current, the larger the voltage drop, and the smaller the current, the smaller the voltage drop. After conduction, since the equivalent It is a linear element, and the linear element can be applied in parallel. When the two resistors are connected in parallel, there is an automatic current balance. Therefore, when the power of one tube is not enough, the MOS tube can be applied in parallel with multiple tubes, and there is no need to add additional balance measures (non-linear devices cannot be directly applied in parallel).