level shifter voor 3.3 to 5V I2C communications
ErikdS
Posts: 37
Can anyone recommend a good level shifter (plus eventually some demo code, would be welcome)?
Thx!
Erik
Thx!
Erik
Comments
I2C uses pull-up resistors on both the clock and data lines. The chips connected to these lines should only pull the lines low, not set them high.
I've used a 5V real time clock many times with a Propeller with both lines pulled to 3.3V using 10K resistors. The Prop never sees more than 3.3V and the 3.3V logic is enough for the RTC to read. It would have also been possible to pull the lines to 5V since the current is limited by the 10K resistors, the 5V wouldn't hurt the Prop.
I had a hard time believing that there would only be 3.3V on the I2C line so I monitored it with an oscilloscope while the Prop and RTC were communicating. Sure enough, the signals never went above 3.3V.
So basically you shouldn't need a level shifter for 3.3V and 5V I2C devices.
-Phil
I sure hope you'll correct me if I gave Erik any bad information.
I suppose it's possible for some 3.3V devices not to tolerate a 5V logic signal even if the 5V is through a 10K pull-up resistor, and it's possible for some 5V devices not to recognize 3.3V as a logic high, but I'd think (based on my limited experience) the cases where you had both such components on a single I2C bus would be rare.
Would a level shifter on an I2C bus that had both 3.3V and 5V devices be needed very often?
2. Some 3.3V devices may either not tolerated 5V, or their protection diodes will pull the pulled-up +5V down to a lower level.
The only advice I can give is to read the datasheets for the devices be designed in and use a level converter if the devices on the bus are incompatible.
-Phil