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.

MSP430F5529: I2C communication to a slave - NOT fully WORKING!

Part Number: MSP430F5529

Hi, I'm using MSP430F5529 Launchpad and are trying to talk to a slave (slave address 0x4C) using I2C.  I'm trying to write 0x42 to this slave's register address 0xFF.

However, when I am probing the I2C pins, all I see are repeated [Start bit][0x4C][Write][ACK by slave].  I DON'T see this 0xFF or 0x42 anywhere on the scope.  My code is below.  Can you please help?

If you have another code using interrupt, feel free to share.

Thanks.

===================================

#include <msp430.h>

unsigned char TXData;
unsigned char TXByteCtr;

int main(void)

{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P4SEL |= 0x06; // Assign I2C pins to USCI_B0
UCB1CTL1 |= UCSWRST; // Enable SW reset
UCB1CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB1CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
UCB1BR0 = 120; // fSCL = SMCLK/12 = ~100kHz
UCB1BR1 = 0;
UCB1I2CSA = 0x4C; // Slave Address is 048h
UCB1CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
UCB1IE |= UCTXIE; // Enable TX interrupt

UCB1IE &= ~UCRXIE; // Disable RX interrupt
UCB1IE |= UCTXIE; // Enable TX interrupt

while (1)
{
UCB1IFG &= ~(UCTXIFG + UCRXIFG); // Clear any pending interrupts

while (UCB1CTL1 & UCTXSTP); // Ensure stop condition got sent
UCB1CTL1 |= UCTR + UCTXSTT; // I2C TX, start condition
UCB1TXBUF = 0xFF; // Load TX buffer
UCB1TXBUF = 0x42;
UCB1CTL1 |= UCTXSTP; //I2C stop 
}
}

**Attention** This is a public forum