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.
I am struggling with the I2C interface programming with MSP430G2553 MCU. I did not plug the slave device to test it, but I expected to have at least the slave address to be send over the I2C. I use internal resistors pull ups and ACLK to clock USCI. Here is my code:
#include <msp430.h> int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer DCOCTL = CALDCO_1MHZ; BCSCTL1 = CALBC1_1MHZ; // ACLK setup: VLO/8 BCSCTL1 &= ~XTS; // Select Low-Frequency clock BCSCTL3 = (BCSCTL3 & ~LFXT1S_3) | LFXT1S_2; // Select VLO BCSCTL1 = (BCSCTL1 & ~DIVA_3) | DIVA_3; // VLO/8 divider UCB0CTL1 |= UCSWRST; UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; UCB0CTL1 |= UCSSEL1; // Use ACLK UCB0BR0 = 180; UCB0BR1 = 0; UCB0I2CSA = 0x52; P1SEL |= BIT7 + BIT6; P1SEL2 |= BIT7 + BIT6; P1REN |= BIT6 + BIT7; P1OUT |= BIT6 + BIT7; UCB0CTL1 &= ~UCSWRST; __delay_cycles(200); while (UCB0STAT & UCBBUSY); UCB0CTL1 |= UCTR + UCTXSTT; while (UCB0CTL1 & UCTXSTT); UCB0TXBUF = 0x36; while (!(UCB0TXIFG & UCB0TXIFG)); while (UCB0STAT & UCBBUSY); UCB0CTL1 |= UCTXSTP; while (UCB0CTL1 & UCTXSTP); while(1); }
When debugging I see that the code gets stuck at the following line:
while (UCB0CTL1 & UCTXSTT);
The logic sniffer with the BusPirate device, shows that after initialization, both SDA and SCL are pulled high and stay in this state.
Here the Channel-0 is P1.6 (SCL); Channel-1 is P1.7 (SDA) and Channel-3 is PIN16 (RST). I use MSP-EXP430G2 Rev 1.5 launchpad for the test.
**Attention** This is a public forum