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.

CC2650 I2C Slave Module problems

Other Parts Discussed in Thread: CC2650, CC2640

Hello,

I'm currently facing problems with the I2C Slave Module on a CC2650. The master issues a write request and sends some bytes. The slave accepts the address and the first byte following the address. After that, it may NACK incoming data at any time. Mostly, the slave receiver NACKs the second byte following the address. It accepts some more bytes sometimes, but I don't know when and why this happens. It looks completely random to me.

What could cause such behavior? Configuration is probably OK, as there is at least some data coming in. This leaves the interrupt handler, which basically looks as follows. Is there something wrong with it?

// I2CSlaveIntEnable(I2C0_BASE, I2C_SLAVE_INT_START | I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_DATA);
static void I2CHandler(void)
{
    static uint32_t cnt;
    uint32_t val;
    uint32_t status = I2CSlaveIntStatus(I2C0_BASE, true);
    I2CSlaveIntClear(I2C0_BASE, status);

    if(status & I2C_SLAVE_INT_STOP)
    {
        cnt = 0;
    }

    if(status & I2C_SLAVE_INT_DATA)
    {
        status = I2CSlaveStatus(I2C0_BASE);

        if(status & I2C_SLAVE_ACT_RREQ)
        {
            val = I2CSlaveDataGet(I2C0_BASE);

            if(val)
                ++cnt;
        }
        else if(status & I2C_SLAVE_ACT_TREQ)
        {
            I2CSlaveDataPut(I2C0_BASE, 0);
        }
    }
}

  • This doesn't answer your question directly, but have you tried using the bsp_i2c.c/.h files from the SensorTag example? they provide a higher level wrapper to the I2C peripheral and have worked on many different slaves for us. 

  • I had a look at them, but the files here support master mode only.
  • Hello,

    Currently, only I2C master mode is supported at the driver level for CC2650/CC2640. I2C slave & multi-master may be delivered in a future driver update.

    Best wishes
  • Slave related function are already in the driver lib:
    software-dl.ti.com/.../group__i2c__api.html

    What does "only master mode is supported at the driver level" mean in that context? Is there a problem with the on-chip slave module?
  • Just to be complete, here is how I configured the slave module:

    PRCMPowerDomainOn(PRCM_DOMAIN_SERIAL);
    
    while((PRCMPowerDomainStatus(PRCM_DOMAIN_SERIAL) != PRCM_DOMAIN_POWER_ON))
    {
    }
    
    PRCMPeripheralRunEnable(PRCM_PERIPH_I2C0);
    PRCMPeripheralSleepEnable(PRCM_PERIPH_I2C0);
    PRCMPeripheralDeepSleepEnable(PRCM_PERIPH_I2C0);
    PRCMLoadSet();
    
    while(!PRCMLoadGet())
    {
    }
    
    IOCPinTypeI2c(I2C0_BASE, Board_I2C0_SDA0, Board_I2C0_SCL0);
    I2CSlaveInit(I2C0_BASE, 0x51);
    I2CIntRegister(I2C0_BASE, I2CHandler);
    I2CSlaveIntEnable(I2C0_BASE, I2C_SLAVE_INT_START | I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_DATA);
    

  • Hi Team CC26,
    I also have a customer experiencing the same NACK issue when CC2640 I2C is in slave mode. Any update WRT the cause of this or how the comms can be improved to reduce the NACKing?
    Thanks, Merril
  • Hi all,

    v2.1 of our BLE stack ships with TI-RTOS v2.13.0.6 which only support I2C master mode as suggested by JXS. What version of RTOS and CC26xxware are you using?
  • Hi Sean,
    Thanks. I can check. So you are saying that the CC26 I2C then cannot work in slave mode? It is in fact being used this way by my customer (and the other user in this thread).. just getting some unwanted NACKs. That said.. looks like NWP (Network processor) mode is only supported in SPI/UART (and not I2C).
    Thanks, Merril
  • Hello Merril,

    The current TI-RTOS drivers do not support I2C slave or multi-master, however the HW does support this capability and there is some capability in the driverlib. I should caution that operating the I2C in these modes is not qualified/supported by SW at this time.

    For NWP, correct the NPI is not adapted to I2C. This may become an option in the future if/when the TI-RTOS is updated to support the aforementioned I2C modes.

    I will see if there is any guidance we can provide based on the current driverlib.

    Best wishes
  • We solved the problem by kicking the device out of the design. The non-TI device we're using now works a treat.

  • The new stack 2.2.1 can resolve this problem? Now I need using CC2640 I2C Slave. Do you have some suggestion? Thanks!
  • I'm interested in this problem too. Can CC2650 work as a slave?

    I'm using I2CSlaveInit / I2CSlaveDataGet / I2CSlaveIntEnable from the "i2c.h" file. Now it's stuck in an infinite loop at: 

    1001bbd6:   2A00                cmp        r2, #0
    1001bbd8:   D0FD                beq        #0x1001bbd6



    Thank you!

  • Hi JXS,

    Can you please update the TI RTOS driver support status for  i2c multimaster mode .

    we are planning to use CC2640R2 in our design and one of the peripheral default i2c mode is multimaster. 

    Regards,

    Arul.

  • Hi all,
    I know this thread is quite old, but are there any updates about this issue?
    I need the cc2640 in i2c-slave mode. Using another chip is not an alternative.

    My implementation, based on <driverlib/i2c.h>, works fine for writing up to 9 byte of data; but on 9th byte the cc2640 always returns an nack on the i2c-bus.

    Furthermore, is there a reason why current TI-RTOS does not support i2c-slave mode?

    Thanks & regards!