Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Teensy 3.5 I2C tolerance

  1. #1

    Teensy 3.5 I2C tolerance

    Hi All,

    I did a search for my question but could not find a definitive answer despite posts regarding it.

    Is the 3.5 5v tolerant on the I2C bus? If I put the Teensy on the I2C with other 5v I2C devices will it damage the Teensy. There will not be 5v to any other pins on the Teensy pins, only pins 18 and 19.

    Regards
    Steve

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,542
    Quote Originally Posted by Steevo25 View Post
    Hi All,

    I did a search for my question but could not find a definitive answer despite posts regarding it.

    Is the 3.5 5v tolerant on the I2C bus? If I put the Teensy on the I2C with other 5v I2C devices will it damage the Teensy. There will not be 5v to any other pins on the Teensy pins, only pins 18 and 19.

    Regards
    Steve
    The Teensy 3.5 is tolerant on 5v on the digital pins. It is not 5v tolerant on the analog only pins (A10, A11, A21, A22), nor on the program or reset pins. On analog inputs, anything over 3.3v will register as 3.3v.

    So the narrow question of will attaching 5v devices to i2c and using 5v power for them, will not harm the Teensy. However, the i2c bus may not work properly with a mixture of voltages. Some of the 5v devices might not notice 3.3v signals from the Teensy. Generally, it is better to segment the i2c bus into 3.3v sections, and 5v sections, and use a bi-directional voltage converter to change from 3.3v to 5v. Adafruit, Sparkfun, and Pololu have all made versions of these level converters:


    In the past, I've used both the Pololu and Adafruit versions, and I may have used earlier versions of the Sparkfun. I don't use I2C that much these days, and where I use it, I'm using devices that work with 3.3v voltage, so I haven't bothered using a logical level converter.

    At present Adafruit is closed due to the virus, and I didn't see the Adafruit board at digikey.com. Sparkfun and Pololu seem to be shipping, but with notes that it may take longer than before.

    These converters are somewhat slow in terms of digital speeds. They are fast enough for normal I2C and UART speeds. They are not fast enough for things like WS2812B (neopixel) LEDs that have strict timing windows. I don't know if they are fast enough for the highest I2C and UART speeds.

    If you haven't used I2C on Teensys before, you will need pull-up resistors on each of the SDA and SCL pins (this is a resistor in parallel to the data between the pin and 3.3v). Older systems like the Arduino Uno don't need pull-up resistors, but systems using the ARM microprocessors do. Many devices have pull-up resistors, and if you are using such a device, you don't need extra resistors.

    If none of your I2C devices have pull-up resistors (or you sometimes operate without devices on the I2C bus), you will need to add pull-up resistors to the Teensy. Typically 2.2K is a good value for 3.3v i2c buses (and 4.7K is typically used for 5v I2C buses). The simple way to check is to run the Wire -> Scanner example, and if it hangs, you need pull-up resistors. I vaguely recall that when I was doing mixed voltage I2C setups, I didn't need the pull-up resistors because the voltage level shifter provided the necessary pull-ups.
    Last edited by MichaelMeissner; 03-22-2020 at 04:53 PM.

  3. #3
    The devices I will be using are the Adafruit ADS1015 and the Adafruit MCP4725. The issue is that I need to run those boards at 5v because the DAC has to output up to 5V and the ADC inputs will go up to 5V on the Adafruit boards.

    I have run these in the past at 5V and removed the pull-up resistors on the breakout boards and connected them to a 3.6 (running the Teensy 3.6 at 3.3v and the Adafruit boards at 5v). This worked fine. I am just trying to keep things simple and not have to start adding logic converters, resistor dividers and such like.

    The Adafruit boards seem to run fine at 3.3v logic on the I2C even when powered from 5v. I know the 3.5 is 5v tolerant on the digital pins but wasn’t sure that if 5v appeared at pins 18 and 19 it would damage then Teensy. The Adafruit breakout boards seem to see anything over 2v as a logic high and anything below that as a logic low even when powered at 5v. Last time I damaged one of the Adafruit boards trying to remove the pull-up resistors so I wanted to avoid removing them again. I like the Adafruit stuff but I really wish they would use dip switches or such like for the pull-up resistors so you can select what you want the pull-ups at easily.

  4. #4
    Junior Member
    Join Date
    Mar 2020
    Posts
    5

    Question Why level converters and not just pullups to 5V?

    Quote Originally Posted by MichaelMeissner View Post
    ...
    So the narrow question of will attaching 5v devices to i2c and using 5v power for them, will not harm the Teensy. However, the i2c bus may not work properly with a mixture of voltages. Some of the 5v devices might not notice 3.3v signals from the Teensy. Generally, it is better to segment the i2c bus into 3.3v sections, and 5v sections, and use a bi-directional voltage converter to change from 3.3v to 5v.
    ...
    My understanding: if you put pullups to 5V (not 3.3V) on SCL and SDA, you will get 0V (low) and 5V (high, because the I2C bus works with open collector drivers) in both directions (from and to the Teensy) and it should be
    a) interpreted correctly by the 5V devices AND by the Teensy (5V>3.3V, also high)
    b) not damage the Teensy as those pins are 5V tolerant.

    So why would one need level converters in this case?

    Regards
    Patrick

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,542
    Quote Originally Posted by paf View Post
    My understanding: if you put pullups to 5V (not 3.3V) on SCL and SDA, you will get 0V (low) and 5V (high, because the I2C bus works with open collector drivers) in both directions (from and to the Teensy) and it should be
    a) interpreted correctly by the 5V devices AND by the Teensy (5V>3.3V, also high)
    b) not damage the Teensy as those pins are 5V tolerant.

    So why would one need level converters in this case?

    Regards
    Patrick
    I'll let somebody else with more electronics knowledge answer this.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,498
    Yes, Teensy 3.5 is 5V tolerant on those pins. So you can use pullup resistors to 5V. You can use 5V I2C chips without a level converter.

  7. #7
    Junior Member
    Join Date
    Mar 2020
    Posts
    5

    Thank you for the information!
    Regards, Patrick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •