Hello,
I'm trying to make a simple application in which CC2650 works as an I2C slave.
[TI UPDATE 10/12/19: The use of I2CIntRegister below in a TI-RTOS based application can corrupt the vector table. Please see this FAQ for details why this can happen: https://e2e.ti.com/support/microcontrollers/other/f/908/t/849627]
Based on this figure, my app looks like this:
void init_i2c()
{
I2CSlaveInit(I2C0_BASE, 0x74);
I2CIntRegister(I2C0_BASE, i2cCB);
I2CSlaveIntEnable(I2C0_BASE, I2C_SLAVE_INT_START | I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_DATA);
}
void i2cCB()
{
uint32_t val;
uint32_t status = I2CSlaveIntStatus(I2C0_BASE, true);
I2CSlaveIntClear(I2C0_BASE, status);
if(status & I2C_SLAVE_INT_DATA)
{
status = I2CSlaveStatus(I2C0_BASE);
if(status & I2C_SLAVE_ACT_RREQ)
{
val = I2CSlaveDataGet(I2C0_BASE);
if(val == 0x01)
{
PIN_setOutputValue(ledPinHandle, Board_LED0, 1);
}
else if(val == 0x00)
{
PIN_setOutputValue(ledPinHandle, Board_LED0, 0);
}
}
}
}
But after running the program it gets stuck in an infinite loop exception:
1001bbd8: D0FD beq #0x1001bbd6 1001bbda: 4790 blx r2
Thank you!