This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123 using I2C: pulling SCL/SDA to 5V a problem?

Hi,

I'm using a TM4C123 to communicate with an external device via I2C. It has been working well, until one day the SCL line became stuck low. We swapped the board with the TM4C123 and it worked fine again. So my guess is that the SCL pin was damaged.

We are pulling SCL/SDA to 5V via 10k resistors. My understanding was that most of the TM4C123 pins are 5V tolerant, but then I found the following statement in the SPMA059 pdf:

"Only 3.3V I2C buses are directly supported. 5V or 1.8V buses can be supported with the use of external level shifting diodes."

Could the 5V pullups be the problem? If so, why did it take several weeks for the damage to occur?

Thanks,
Joe

  • Joseph Driscoll said:
    why did it take several weeks for the damage to occur?

    Would you have been happier if it failed more quickly?    Seriously - having past worked for another, semi-cond. "giant" - the internal routings & constructs may fail in stages - degrading with time & use until they cease to (fully) function.

    Pity that your device was so unforgiving - and that you found that I2C statement later - rather than sooner.   

    As you report "swapping" the damaged board - might that same, "pull to 5V" have been inflicted upon that 2nd board?    (you now know the "expected" outcome.)

    If such an I2C limitation did not appear w/in the MCU manual - you may have a legitimate squawk.    Myself (most others) cannot "crack" vendor's SPMA encoding scheme - unknown is how likely you were to read/review that doc. - to escape that problem.

  • Hi Joseph,

    Which pins did you use?


    I am actually worried about this, I never saw that document nor that info in the datasheet. I actually had friends using the launchpad with 5V i2c slave.

    I tried to find info on non-tolerant pins for 5V on the datasheet and I found only this:


    Note: All GPIO signals are 5-V tolerant when configured as inputs except for PD4, PD5, PB0 and

    PB1, which are limited to 3.6 V. See “Signal Description” on page 649 for more information

    on GPIO configuration.

    Note: GPIO pads are tolerant to 5-V digital inputs without creating reliability issues, as long as

    the supply voltage, VDD, is present. There are limitations to how long a 5-V input can be

    present on any given I/O pad if VDD is not present. Not meeting these conditions will affect

    reliability of the device and affect the GPIO characteristics specifications.

    ■ If the voltage applied to a GPIO pad is in the high voltage range (5V +/- 10%) while VDD

    is not present, such condition should be allowed for a maximum of 10,000 hours at 27°C

    or 5,000 hours at 85°C, over the lifetime of the device.

    ■ If the voltage applied to a GPIO pad is in the normal voltage range (3.3V +/- 10%) while

    VDD is not present or if the voltage applied is in the high voltage range (5V +/- 10%)

    while VDD is present, there are no constraints on the lifetime of the device

    .


    And this:


    GPIO signals have alternate hardware functions. The following table lists the GPIO pins and their
    analog and digital alternate functions. All GPIO signals are 5-V tolerant when configured as inputs
    except for PD4, PD5, PB0 and PB1, which are limited to 3.6 V. The digital alternate hardware functions
    are enabled by setting the appropriate bit in the GPIO Alternate Function Select (GPIOAFSEL)
    and GPIODEN registers and configuring the PMCx bit field in the GPIO Port Control (GPIOPCTL)
    register to the numeric encoding shown in the table below. Analog signals in the table below are
    also 5-V tolerant and are configured by clearing the DEN bit in the GPIO Digital Enable (GPIODEN)
    register. The AINx analog signals have internal circuitry to protect them from voltages over VDD (up
    to the maximum specified in Table 24-1 on page 1359), but analog performance specifications are
    only guaranteed if the input signal swing at the I/O pad is kept inside the range 0 V < VIN < VDD.
    Note that each pin must be programmed individually; no type of grouping is implied by the columns
    in the table. Table entries that are shaded gray are the default values for the corresponding GPIO
    pin.


  • Hi,

    I had also seen those sections, and they also made me think that 5V should be fine. But note that they say that the pins are 5V-tolerant when used as inputs; it's the SCL line that is damaged, which is an output since my TM4C123 serves as the master on the bus.

    Joe
  • I would say that is very likely since the SCL on the TM4C123 is not a open-drain output.

    Though I am still worried how nothing is refered in the datasheet.
  • I realized I forgot to answer your question: I am using I2C pins PA6 and PA7.

    Joe

  • Thanks for coming back with the answer.

    I actually forgot to ask back because I went ahead and checked the possible SCL pins - none were of the inputs with maximum 3.6V input
  • Hi Luis,
    Simply must note the great effort & value you've provided - this thread now (nicely) - and in one compressed space - presents a neat summary of GPIO usage & voltage restrictions.  (although those "restrictions" are many - and may prove a "moving" target (i.e. be updated))

    My take-away - "ONLY" allow 3V3 - and no higher voltage - to arrive @ MCU pins!     Yes - the manual states that 5V is "generally" accepted - but trying to keep track of that, "laundry list of 5V exceptions & prohibitions" - is "not" for my small, tech firm.    (and - might that data be subject to future revision - thus must constantly be read & re-read - to be (really) sure.)

    While bit of a bother - it's not too hard/costly to provide 5V to the external I2C device (when, where & if such 5V is demanded) - while limiting to 3V3 - that "fed" to TM4C...    And then - and only then - we escape (all) of this unwelcome (often hidden) restrictive, input signal level detail...

  • I'm just glad I found this now...

    We have here some lever shifters good for I2C but I never use them since the Tiva is 5V tolerant (and the I2C slaves are able to identify 3.3V as high level)... will have to start using them.

  • Amit Ashara suggested that I check the misbehaving SCL pin further by trying to toggle it as a GPIO output. We tried, and the line stays low all the time. We confirmed the code works by using a second (identical) board.

    Fyi,
    Joe

  • Hello Joe

    1. Can you share the configuration you used to make it a GPIO Pin as Output. I would like to see the register values of the corresponding GPIO Ports?
    2. Since there is a Pull Up on the line, if you make the GPIO as an Input, then does the GPIODATA register read a 1 for the corresponding pin. Please do send a register dump for it as well.

    At this point I would suspect a GPIO damage, but only when I check the register dump.

    Note that the GPIO's are 5V tolerant and not 5V drivers. In case of I2C it should be OK, as the GPIO only drive 0 and the Pull up takes it to 5V. However in High Speed mode that is a different case (surely you are not using HS mode) on the IO.

    Regards
    Amit
  • We configured PA6 as an input, and copied its value to another pin (which was configured as output). We manually toggled between 3.3V and 0V on PA6, and monitored the other pin with a voltmeter. The pin never changed, so I'd say that PA6 is not working as a GPIO input.

    Because of the uncertainty, and especially because of the document that says that only 3.3V is supported on I2C for TM4C123, we're just going to change our pullups to 3.3V.

  • Hello Joe,

    While it is good to have the Pull Up to 3.3V, the experiment you mentioned is not conclusive to me for the following reason

    1. Which API did you use to configure the GPIO PA6 as input. Was it a custom API or TivaWare API

    Regards
    Amit
  • Hi,

    We are using the TivaWare API for this, for example GPIOPinTypeGPIOInput.

    Joe
  • Hello Joe,

    Thanks for the confirmation. Then I can concur that may be there has been a damage to the IO.

    Regards
    Amit
  • Given the statement in SPMA059 pdf about only 3.3V being supported, can we officially conclude that the TM4C123 cannot directly support 5V pullups on the I2C lines (at least for the clock, since it's not open-drain)?

    Joe
  • Hello Joe,

    The Open Drain on the SCL is controlled by the I2C Controller as in High Speed Mode it has to be driven. So as long as the HS mode is not used, a 5V pull up can be used.

    Regards
    Amit
  • I'm still not convinced that 5V is allowed, given the text in section 4.4 of spma059.pdf. And note it doesn't mention the I2C speed anywhere:

    "A TM4C123x device can have up to six I2C buses. The buses appear on the I2C0SCLI2C5SCL/

    I2C0SDA-I2C5SDA signals. Each bus is functionally equivalent to the others and can be either a

    master or a slave. Refer to the Inter-Integrated Circuit (I2C) Interface” chapter of the TM4C123x data

    sheet for detailed information.

    The I2C bus requires signals to be configured in open-collector mode. The I2CSDA pin requires the

    associated GPIO to be configured as an open-collector signal in the GPIOODR register. The I2CSCL pin

    should not be configured in this manner as the pad is designed differently. The TivaWare

    GPIOPinTypeI2C() API should be used for the I2CSDA pin and the GPIOPinTypeI2CSCL() API should be

    used for the I2CSCL pin. The I2C pins must be externally pulled-up to 3.3V for proper operation. Typical

    pull-up values are 2.2KΩ resistors but the value used depends on bus speed and total bus capacitance.

    Refer to the Pull-up resistor sizing section of the UM10204 “I2C-bus specification and user manual” v.5

    from NXP for details on how to calculate the minimum and maximum pull-up resistor values.

    Only 3.3V I2C buses are directly supported. 5V or 1.8V buses can be supported with the use of external

    level shifting diodes."

  • Hello Joe,

    That statement comes from the fact that High Speed operation will not allow 5V or 1.8V. However it is always better to have voltage swings close to the VDD supply to ensure electrical parameters are not violated.

    Regards
    Amit