I'm having difficulties responding to the INT from the TCA6424 we're using.
Configuration and Polarity program in fine. No failures at all. The first cycle of reads work fine. Then, that's it, all writes fail. The sequence:
1: Program Configuration and Polarity 2: Send command 0x0 (read register 0) 3: Read back a byte 4: Send command 0x1 (read register 1) 5: Read back a byte 6: Send command 0x2 (read register 2) 7: Read back a byte *interrupt* 1: Send command 0x0 (read register 0) -- At this point, writing a byte out to I2C fails -- Code to write to I2C: // Just read a single byte and return USCI_B_I2C_masterSingleReceiveStartWithTimeout(I2C_BASE, I2C_TIMEOUT); //*pBuf = USCI_B_I2C_masterSingleReceive(I2C_BASE); retVal = localReadByte(I2C_BASE, pBuf); USCI_B_I2C_clearInterruptFlag(I2C_BASE, USCI_B_I2C_RECEIVE_INTERRUPT); __enable_interrupt(); return retVal; static int localReadByte(unsigned int DevAddr, unsigned char *pBuf) { long nTimeout = I2C_TIMEOUT; // Polling RXIFG0 if RXIE is not enabled if (!(HWREG8(DevAddr + OFS_UCBxIE) & UCRXIE)) while (!(HWREG8(DevAddr + OFS_UCBxIFG) & UCRXIFG)) if(--nTimeout <= 0) return 0; // Read a byte. *pBuf = HWREG8(DevAddr + OFS_UCBxRXBUF); return 1; }
My confusion is whether or not I need to send a NAK at the end of every read transaction, and whether or not this would make the TCA6424 stop responding if I didn't.
Can some kind soul help clarify the reading process? Thanks!
Ed Averill