Connecting Devices with Different Logic Levels Understanding the I2C Bus with Level Shifters
18.1 Connecting Devices with Different Logic Levels
Chapter 16 describes how to connect devices with different voltage levels to the same bus using pull-up resistors connected to the power supply line. While this is a simple solution, low voltage devices must tolerate 5V, making them more expensive. However, by using a bidirectional level shifter, devices with different power and logic voltages on an I2C bus can be connected. The configuration is illustrated in Figure 45.
On the left side of the diagram, the low-voltage devices are connected to a 3.3V power supply with pull-up resistors. On the right, the high-voltage side is connected to a 5V power supply, also using pull-up resistors. Both parts of the bus have I/O pins configured with logic input levels and open-drain outputs. The level shifters for each bus line are identical, consisting of discrete N-channel MOSFETs (TR1 and TR2) on the serial data line (SDA) and serial clock line (SCL).
The gate (g) of the MOSFETs is connected to the supply voltage (VDD1), the source (s) to the low-voltage side of the bus, and the drain (d) to the high-voltage side. Many MOSFETs have their substrate internally connected to the source; if not, an external connection is required. Each MOSFET has an integrated diode (n-p junction) between its drain and substrate.
Level Shifter Operation
In the operation of the level shifter, three states need to be considered:
-
No device pulling the bus low: The low-voltage side of the bus is pulled high by the pull-up resistor (Rp) to 3.3V. The gate and source of the MOSFET are both at 3.3V, so the VGS is below the threshold voltage, and the MOSFET is off. This allows the high-voltage side to pull the bus high via its pull-up resistor to 5V.
-
A 3.3V device pulls the bus low: The source of the MOSFET is pulled low by the 3.3V device, while the gate remains at 3.3V. The VGS increases above the threshold, and the MOSFET turns on, pulling the high-voltage side of the bus low.
-
A 5V device pulls the bus low: The substrate-diode of the MOSFET pulls the low-voltage side low until the VGS exceeds the threshold, turning the MOSFET on. The low-voltage side is then pulled further down by the 5V device.
These three states demonstrate the transmission of logic levels between two parts of a bus, independent of which side is driving the bus. State 1 performs the level shifting function, while States 2 and 3 ensure the I2C bus works correctly according to its specifications.
Voltage Levels
In normal operation, VDD2 must equal or exceed VDD1. However, when using switch-mode power supplies, VDD2 can be lower than VDD1, for example, 2V for VDD1 and 10V for VDD2.
Figure 45: Bidirectional Level Shifter for I2C Bus with Different Voltage Parts
This level shifter mechanism ensures smooth communication between devices with different voltage logic levels on the same I2C bus.
评论区