Wednesday, November 3, 2010

I2C level shifing

I couldn't get the off the shelf level translator (I2C-TRN) to work. I followed the instructions and removed the 3V3 jumper, and wired it up according to the instructions - but the IC on the board was getting REALLY hot (fried my finger tip) and there was > 3V on the "low side" SCL/SDA lines - which should have only been 1.8V max! I was concerned that I fried the BeagleBoard I2C I/O's (but fortunately they were OK).

I emailed support@gravitech.us asking for assistance with the I2C-TRN, but never got a response.

So, I instead of using the I2C-TRN, I opted to build an I2C level translator using 2 MOSFETs. I followed the Philips App Note AN7055, using (2) ZVN4424A/C thru-hole MOSFETs ordered from Digikey for about $1 each. The App Note was very clear and the design is simple and makes perfect sense.

This worked perfectly - the levels on both sides for logic 1 and 0 looked good, and I could immediately probe the bus and see the digital pot:

$ sudo i2cdetect -y -r 2
[sudo] password for mikevoyt:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Reading the pot 0 value worked:

$ i2cget -y 2 0x28
0x00

Writing a new value for pot 0 worked as well:
$ i2cset -y 2 0x28 0xa9 0x80
$ i2cget -y 2 0x28
0x80

And, indeed the resistance between L0 and W0 went from a few hundred ohms to 5K ohm.

1 comment:

  1. I2C-TRN is yours a V2 (Version 2) if so. the pin out has changed. Seems like they changed from a TI PCA9306 to a PHLIPS PCA9512.

    look @ the datasheet for a PCA9512

    ReplyDelete