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);
}
}
}