Electronic – Logic Levels between 5(V) and 3.3(V) devices

atmegalogic-leveltri-stateuart

I am using a 5V microcontroller to communicate with a Bluetooth module operating at 3.3V.

I have regulated the output from the 5V microcontroller rail to 3.3V rail for the Bluetooth module.

Since I am using a UART, I need to use a TX pin to go to the RX. The issue here I found is that the pins to the Bluetooth module aren't tolerable to 5V. So I decided to use a voltage divider to get 3.3V on the output.

Now, I got the UART TX working on the microcontroller side. Connecting to the RX of the Bluetooth, I see a logic 1 at the output.

After some debugging I found that infact the logic level is shifting between 2.3V for logic 1 and 1.79V for logic 0 (but this doesn't register as a 0). I presume 1.79V. Looking at the schematics of the Bluetooth Module, I found that the RX pin seems to be in tri-state between 2 resistors to VCC and GND. I need a 0V or lower than a certain tolerance for logic 0.

What can I use to get the proper logic level on the output for proper serial communication?

Best Answer

The workhorses of level shifting I use are the TXB010X and TXS010X from Texas instruments. Here, the X may be 2, 4 or 8 and represents the number of ports provided. Both are bidirectional, sense automatically who's input and who's output (and they can be mixed) and don't need external components other than a pair of decoupling caps. The TXB is the 'standard' and the TXS is an open-drain version (for GPIO and SPI, use the TXB; for I2C, use the TXS).

They are a bit expensive, but I never found a good alternative; NXP has an equivalent family, but it requires a pair of resistors per line, which complicates considerably the design.

Related Topic