I2C Pull-Up resistor Question - Using both a 3.3v and 5v (Not the standard question!)

Status
Not open for further replies.

jrdnjlly

New member
Hey guys!

First time posting, but this forum has been a really great source of information - thanks!

I've built a project that requires an I2C communication bus between two microcontrollers (Teensy 3.2 is SLAVE).
I've configured the EXTERNAL_PULLUPS on the teensy 3.2 I2C library.

The difference in my question compared to other I2C voltage mismatch questions online, is that I need the ability to change the MASTER controller that is being used (depending on a specific situation) and the two MASTER microcontrollers I have operate on 5V and 3.3V respectively.

In the demo phase, I was just using the 5V MASTER and used pull-up resistors to 5V accordingly.
Moving past the demo phase, I thought I'd just try and see if the 5V pull-ups worked with the 3.3V MASTER as per my reasoning below... and it did.

In my understanding, the 3.3V I2C bus will still work albeit with the 1.7V potential drop across the pull-up resistor wasting power.

My big question is firstly, is my reasoning above right? and secondly, are there any hardware specifics with the Teensy that might damage the board in the future (I'm thinking that due to the bi-directional communcation of I2C something bad might happen)?

Thanks in Advance!!
 
Usually the safest approach is to connect the resistors to 3.3V. The signals will be from 0 to 3.3V. Most 5V I2C master chips will recognize 3.3V as logic high.

Teensy 3.2 is 5V tolerant, so it's also ok to connect the resistors to 5V. You definitely would *not* want to do that with Teensy LC or 3.6, which aren't 5V tolerant.

The complex approach is to use a bidirectional level shifter circuit for each signal, which is usually just a N-channel mosfet and 2 pullup resistors.

https://www.sparkfun.com/products/12009

These level shifters are perfect for I2C. But beware of overly optimistic advice to use them for other types of signals. Years ago, both Adafruit and Sparkfun promoted these as sort of magic bullet, able to connect any type of logic signal between 2 voltages. Almost everyone copied their descriptions, leading to a widespread (but false) belief these level shifters could be used for SPI, WS2812/Neopixel addressable LEDs, fast serial, PWM to loads like LEDs, etc. The truth is this type of level shifter is only optimal for open-collector signal types, like I2C.
 
Hi Paul,

Thanks for the informative answer - good to know I'm not going to break anything with the current set up :p

That's interesting about the 5V I2C Master chips recognising 3.3V as logic high. I've had a bit of trouble in the past trying to implement this and had always attributed this to the fact that the 3.3V logic high was too close to the ~2.5V logic high cut-off level - although that was using a different microcontroller!

Those words of warning RE bi-directional logic level shifters rings very true to me, I've been caught out in the past haha.

Thanks again!
 
Status
Not open for further replies.
Back
Top