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.

MSP430FR6928 I2C not working

Hello, 

I am developing software for a device based on MSP430FR6828 MCU using the sample code provided via the IAR Systems Workbench. I am trying to establish the I2C connection between the MCU and an EEPROM chip with an I2C address of 0x54. When the program running, I2C bus keeps quiet, nothing happens. The pins P3.1 and P3.2 works well if they are configured as GPIO. They are not working if they are configured for the I2C function. Could you technical support guys help me identify the problem? Thanks a lot. 

Code:

#define SLAVE_ADDRESS 0x54

uint8_t transmitData;

void main(void)
{
WDT_A_hold(WDT_A_BASE);

//Set DCO frequency to 1MHz
CS_setDCOFreq(CS_DCORSEL_0, CS_DCOFSEL_0);
//Set ACLK = VLO with frequency divider of 1
CS_clockSignalInit(CS_ACLK, CS_VLOCLK_SELECT, CS_CLOCK_DIVIDER_1);
//Set SMCLK = DCO with frequency divider of 1
CS_clockSignalInit(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
//Set MCLK = DCO with frequency divider of 1
CS_clockSignalInit(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);

// Configure Pins for I2C
//Set P1.6 and P1.7 as Secondary Module Function Input.
/*

* Select Port 1
* Set Pin 6, 7 to input Secondary Module Function, (UCB0SIMO/UCB0SDA, UCB0SOMI/UCB0SCL).
*/
GPIO_setAsPeripheralModuleFunctionOutputPin(
GPIO_PORT_P3,
GPIO_PIN1 + GPIO_PIN2,
GPIO_SECONDARY_MODULE_FUNCTION
);

/*
* Disable the GPIO power-on default high-impedance mode to activate
* previously configured port settings
*/
PMM_unlockLPM5();

//Initialize transmit data packet
transmitData = 0x01;

//Initialize Master
EUSCI_B_I2C_masterInit(EUSCI_B1_BASE,
EUSCI_B_I2C_CLOCKSOURCE_SMCLK,
CS_getSMCLK(),
EUSCI_B_I2C_SET_DATA_RATE_100KBPS,
1,
EUSCI_B_I2C_NO_AUTO_STOP
);

//Specify slave address
EUSCI_B_I2C_setSlaveAddress(EUSCI_B1_BASE,
SLAVE_ADDRESS
);

//Set in transmit mode
EUSCI_B_I2C_setMode(EUSCI_B1_BASE,
EUSCI_B_I2C_TRANSMIT_MODE
);

//Enable I2C Module to start operations
EUSCI_B_I2C_enable(EUSCI_B1_BASE);

while (1) {
//Send single byte data.
EUSCI_B_I2C_masterSendSingleByte(EUSCI_B1_BASE,
transmitData
);

//Delay until transmission completes
while (EUSCI_B_I2C_isBusBusy(EUSCI_B1_BASE)) ;

//Delay between each transaction
__delay_cycles(50);

//Increment transmit data counter
transmitData++;
}
}

**Attention** This is a public forum