Part Number: MSP430G2553
I am a beginner in MSP Launchpad.
I am transmitting a single byte using I2C and just checking the signals (start bit,slave address...) from the oscilloscope. For now, I have not connected a slave. I have issue seeing signals in the oscilloscope from SCL and SDA pins of Launchpad. It is showing High throughout, when a single byte is transferred.
I have checked with toggling the SCL bit (BIT 6) inside the while loop just to check if the rise time is greater than fall time but both happens to be same. It seems like I2C is not activated.
I have placed 10k pullup resistor to SCL and SDA pins.
Is there any issue with the Open drain configuration and if so how can I fix it ?
Here's the code
#include <msp430g2553.h>
unsigned char TXData;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1SEL |= BIT6 + BIT7; // Assign I2C pins to USCI_B0
P1SEL2|= BIT6 + BIT7; // Assign I2C pins to USCI_B0
P1REN |= BIT6 + BIT7;
P1OUT |= BIT6 + BIT7;
P1DIR |= BIT0;
UCB0CTL1 |= UCSWRST; // Enable SW reset
UCB0CTL0 = UCMST + UCMODE_3 + UCSYNC; // I2C Master, synchronous mode
UCB0CTL1 = UCSSEL_2 + UCSWRST; // Use SMCLK, keep SW reset
UCB0BR0 = 10; // fSCL = SMCLK/12 = ~100kHz
UCB0BR1 = 0;
UCB0I2CSA = 0x48; // Slave Address is 048h
UCB0CTL1 &= ~UCSWRST; // Clear SW reset, resume operation
IE2 |= UCB0TXIE; // Enable TX interrupt
TXData = 0x55; // Holds TX data
while (1)
{
//P1OUT ^= BIT6;
UCB0TXBUF = TXData; // Load TX buffer
__delay_cycles(2000000);
P1OUT ^= BIT0;
}
}