Saturday, March 22, 2014

TTL to I2C

Since I'm using 5 volts as the standard I2C bus voltage, I need a way to translate from the 3.3 volts the MCU uses to the 5 volts the I2C bus uses. The interface needs to be bidirectional without having any switching since either the 5 volt side or the 3.3 volt side can pull the bus low. And there is no way to tell in advance which side might want to do that so a bus translator like the 74LVC2T45 will not work. I did try the the P82B96, but, despite being a very popular chip it latched up on me. Some manufacturers allude to this when they tout "no latch up" at the top of their data sheets for I2C bus voltage level translators. NXP describes how to do it with N channel MOSFET transistors in their application note AN10441. The circuit described there is what we would have called in the old days a grounded grid circuit. Today we call it grounded gate. The gate is grounded for AC despite the 3.3volt bias on it because the 3.3 volts comes from a power supply which is heavily filtered to eliminate any AC voltage on the supply. Despite being low cost I decided not to use this method because low cost transistors commonly come in an SOT23 package (which is big enough so that I can actually hand solder it). But the SOT23 package takes up a fair amount of board area by today's standards.

So I settled on the NVT2002 chip which looks like it has two transistors in the package along with disconnect circuitry which prevents translator operation if both sides of the bus aren't powered. Because the transistors are basically pass through devices they don't add much bus delay (on the order of nano seconds or less). And just to cap off the sweetness they cost a lot less than the P82B96.

To make life easier for I2C bus users I put 3 of our standard RJ11 I2C bus jacks on the board, so that if you are using 3 or fewer devices on the bus you don't need to buy doublers or triplers to daisy chain bus devices. Although you would have to use them if your bus is long in order to keep your bus capacitance below the specified maximum.

Bare boards for the I2C bus adapter are available from OSH Park for $5.15. You can find the documentation for the board (schematic, parts list, and parts layout) here.

You have a choice of powering the I2C bus with the power supply providing power to the MCU board or if your bus peripherals use a lot of 5V power you can give the TTL to I2C adapter its own power supply so as to avoid dragging down the 5 volts supplying the MCU board.

Engineering is the art of making what you want from what you can get at a profit.

No comments:

Post a Comment