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.

TCA6424A appears to NAK write request

Other Parts Discussed in Thread: MSP430F5638, TCA6424A

Ok, this is my first real I2C project, so forgive any newbie-ish-ness.

I have a TCA6424A as the sole device on the I2C bus driven from USCI B1 on an MSP430F5638.  I try writing a single byte to the device and I never see it accepted.

Poking around with the scope I can see the address getting clocked out, but nothing happens.. no ACK as far as I can tell.  I also see UCSCLLOW as 1, UCBBUSY as 1, and UCNAKIFG as 1 (which I assume means I got NACKed).

!RESET on the TCA6424A is HIGH, so it's not that it's in reset... I'd assume no NAK if it were being held in reset.

I've tried 0x44 and 0x45 both, and either one gets me the NAK flag.

Does anyone have any idea what might be happening here? I'm puzzled.

All help appreciated!

Ed Averill

  • Hi Ed,
    The hex slave address for the device can be 0x22 or 0x23 as mentioned in the datasheet on page 19. Did you refer to the slave address as 0x44 and 0x45?

    Thanks,
    Rajan
  • I had seen 0x44 and 0x45 in another thread since it's a seven-bit address.. moved the defines to 0x22 and 0x23 and STILL get NACKed.

    Do those register contents I posted tell me anything useful?

    And thanks for the response!

    Ed Averill
  • Here's my I2C initialization:

    	USCI_B_I2C_disable(I2C_BASE);		// I2C bus off
    
    	USCI_B_I2C_masterInit(I2C_BASE, USCI_B_I2C_CLOCKSOURCE_SMCLK,
    			 UCS_getSMCLK(), USCI_B_I2C_SET_DATA_RATE_100KBPS);
    
    	USCI_B_I2C_enable(I2C_BASE);		// I2C bus on

    ...end to write..

    	// You can't change bus modes without resetting the bus.  So,
    	// let's reset the dang thing into RECEIVE mode
    
    	I2C_Init(TRUE);
    
    	SetI2CTarget(DevAddr, TRUE);
    
    	if(nLength == 1)
    	{
    		// Just send a single byte out and return
    		retVal = USCI_B_I2C_masterSendSingleByteWithTimeout(I2C_BASE,  *pBuf, I2C_TIMEOUT);
            USCI_B_I2C_clearInterruptFlag(I2C_BASE, USCI_B_I2C_TRANSMIT_INTERRUPT);
        	__enable_interrupt();
    		return retVal;
    	}
    
    	// True multi-byte send, process
    
    	if(USCI_B_I2C_masterMultiByteSendStartWithTimeout(I2C_BASE, *pBuf++, I2C_TIMEOUT) == TRUE)
    	{
    		nLength--;								// First byte went out
    		while(nLength-- > 1)
    		{
    			USCI_B_I2C_masterMultiByteSendNext(I2C_BASE, *pBuf++);
    		}
    		if(USCI_B_I2C_masterMultiByteSendFinishWithTimeout(I2C_BASE, *pBuf, I2C_TIMEOUT) == TRUE)
    			retVal = TRUE;						// Everything succeeded
    	}
    
        USCI_B_I2C_masterMultiByteSendStop(I2C_BASE);
    
        USCI_B_I2C_clearInterruptFlag(I2C_BASE, USCI_B_I2C_TRANSMIT_INTERRUPT);
    

    ..anything obviously wrong with this?

    Ed Averill

  • Ok, it's working now.. I found some sample Arduino code online, converted it to the MSP430, and now both reads and writes succeed.