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.

CC2640 I2C drive strengh?

Expert 1930 points

Replies: 6

Views: 1450

I am having an issue using the I2C interface on a CC2640.

My peripheral is NAK'ing a transaction and I think it is due to the "low" levels on SCL and SDA not be low enough.

I know that SCL can be pulled to very close to 0.0V as one of the I2C peripherals requires that SCL be pulled low for > 39 ms to "wake" it.

I do this by "requesting" the I2C peripheral via the semaphore mutex, closing the I2C driver, pulling the SCL line low for about 45 ms, then releasing the pin and restarting the I2C driver.    The SCL line drops to a few millivolts when pulled low.

Here is a code snippet where I do this:

if(bspI2cReserve() == true) {
  bspI2cClose();
  // Gain access to the pin
  hI2CPin = PIN_open(&pinI2CState, myBoardI2CPinTable);
  if(hI2CPin != 0) {
  // Drive SCL pin low
    PIN_setOutputValue(hI2CPin, Board_I2C0_SCL0, 0);
    // Now wait for PERIPHERAL_WAKE_TIME_MS
    delay_ms(PERIPHERAL_SCL_LOW_TIME_MS);
    // Release SCL to go high
    PIN_setOutputValue(hI2CPin, Board_I2C0_SCL0, 1);
    // Give up the pin
    PIN_close(hI2CPin);
    // Release the I2C
    bspI2cDeselect();
    // Delay for Wake-up time
    delay_ms(PERIPHERAL_WAKE_TIME_MS);
    bspI2cInit(I2C_100kHz);
    success= true;
  } else {
    success = false;
  }
} else {
  success= false;
}

After this, I can perform I2C transactions, where the timing and high/low periods look correct, but the logic low levels are around 1.1 v (above the '0' threshold).

I see that the I2C driver initializes the pins deep in the driver (in I2CCC26XX_initIO in I2CCC26XX.c).   Is there some way to set the drive strength higher?

Am I missing a step when initializing the driver?

Thanks!

6 Replies

  • Here is a screen capture showing SCL and SDA.   Both logic and analog channels are shown.   Note that low levels of analog channels are at about 1.131 v!

  • In reply to Ed Hepler:

    I was able to force SCL and SDA to very close to 0 v for logic '0' by adding " | PIN_DRVSTR_MAX " to the attributes where SCL and SDA were defined in I2CCC26XX_initIO in I2CCC26XX.c

    But it seems that there should be a way to do this without hacking the driver code. What am I missing?

    Thanks!
  • Guru 106355 points

    In reply to Ed Hepler:

    Hi Ed,

    What are the values of the pull-ups in your circuit?

    Cheers,
    Fredrik

  • In reply to Fredrik K:

    Hi Fredrik,

    I'm using 4.7K resistors pulled up to 3.3v

    Thanks!
  • Guru 106355 points

    In reply to Ed Hepler:

    Hi Ed,

    Ok, that seems reasonable. 

    I am struggling a bit with understanding why the CC2640 is not able to pull the lines all the way to 0 V. Unless one of your I2C peripherals is actively pulling to VDD or the pull-up resistors are very low value it should not be a problem.

    What I2C peripherals do you have on the bus? Can you run your SW on TI reference HW (like the SensorTag) and check if you see the same problem there? What happens if you simply configures the SCL and SDA IOs as low logic outputs? Do you still see the 1 V level on the bus?

    Cheers,
    Fredrik

  • In reply to Fredrik K:

    Hi Fredrik,

    The I2C sensors on this particular board are the  Melexis MLX90615 and the Invensense MPU9250.   

    I don't have any TI reference HW.

    To "wake up" the MLX90615 I do configure the SCL line as a "normal" output and drive it low.   It goes all the way to "near" 0 v.    (This is how I first noticed the problem in accessing it, as the logic analyzer saw 1's and 0's, but an analog channel only showed the bottom of the waveform going to about 1 v. (versus the "wake-up" going all the way to 0v)).

    Thanks,

    Ed

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.