Thanks for the reply Kef and sorry, I forgot to incluse these defines:
#define IICC_REG_DEFAULT 0xC0
#define IICC_REG_RX IICC_REG_DEFAULT
#define IICC_REG_TX (IICC_REG_DEFAULT | IICC_TX_MASK)
I was trying:
if (IICS & IICS_SRW_MASK)
{
IICC1 = IICC_REG_TX;
if ((IICS & IICS_RXAK_MASK) == 0) //0=ACK, 1=No Ack
{
to see if it might correct the problem, my orignal code was (which still had the same problem):
if (IICC1 & IICC_TX_MASK)
{
if ((IICS & IICS_RXAK_MASK) == 0) //0=ACK, 1=No Ack
{
I've removed the extra assignments of the IICC1 register and I'm seeing the same non-response to a repeated start. Here's the newest ISR:
__interrupt void IsrI2c(void)
{
uint8_t i2cDummyRead;
//Clear interrupt flag
IICS = IICS_IICIF_MASK;
PTBD &= ~0x01;
PTBD |= 0x01;
PTBD &= ~0x01;
PTBD |= 0x01;
PTBD &= ~0x01;
//Lost Arbitration?
if (IICS & IICS_ARBL_MASK)
{
IICS |= IICS_ARBL_MASK;
//not Addressed as slave?
if (!(IICS & IICS_IAAS))
{
return;
}
}
else //Arbitration not lost
{
//not Addressed as slave?
if ((IICS & IICS_IAAS_MASK) == 0)
{
//if Slave TX
if (IICC1 & IICC_TX_MASK)
{
if ((IICS & IICS_RXAK_MASK) == 0) //0=ACK, 1=No Ack
{
if (mTxCount < MAX_TX_COUNT)
{
IICD = mI2cTxBuf[mTxCount];
mTxCount++;
mTxRequestedHasBeenSent = TRUE;
}
else
{
//send default
IICD = 0xFF;
}
}
else
{
//no ACK, switch to RX mode
IICC1 = IICC_REG_RX;
//dummy read
i2cDummyRead = IICD;
}
}
else //Slave RX
{
mI2cRxBuf[mRxCount] = IICD;
mRxCount++;
if (mRxCount >= MAX_RX_COUNT)
{
mRxCount = 0;
}
}
return;
}
}
PTBD |= 0x01;
//we are addressed as a slave
//check direction of transfer
if (IICS & IICS_SRW_MASK)
{
//Master requesting us to TX
IICC1 = IICC_REG_TX;
IICD = mI2cTxBuf[0];
mTxCount = 1;
mTxRequestedHasBeenSent = TRUE;
}
else //Master requesting us to RX
{
IICC1 = IICC_REG_RX;
//reset received byte counter to 0
mRxCount = 0;
//dummy read
i2cDummyRead = IICD;
}
}