#include "driverlib.h"
const uint16_t baseAddress = __MSP430_BASEADDRESS_EUSCI_B0__;
const uint8_t slaveAddress = 00000001;
//P1.6 SDA P1.7 SCLK
int main(void) {
WDT_A_hold(WDT_A_BASE);
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN6 + GPIO_PIN7, GPIO_SECONDARY_MODULE_FUNCTION);
EUSCI_B_I2C_initMasterParam master_init = {EUSCI_B_I2C_CLOCKSOURCE_SMCLK,
CS_getSMCLK(),
EUSCI_B_I2C_SET_DATA_RATE_400KBPS,
1, //byteCounterThreshold
EUSCI_B_I2C_NO_AUTO_STOP
};
EUSCI_B_I2C_initMasterParam *master_init_ptr = &master_init;
EUSCI_B_I2C_initMaster(baseAddress, master_init_ptr);
EUSCI_B_I2C_setSlaveAddress(baseAddress, slaveAddress);
EUSCI_B_I2C_setMode(baseAddress, EUSCI_B_I2C_TRANSMIT_MODE);
EUSCI_B_I2C_enable(baseAddress);
//EUSCI_B_I2C_enableInterrupt(baseAddress, mask);
while (1) {
EUSCI_B_I2C_masterSendSingleByte(baseAddress, 0x55);
__delay_cycles(50);
} // end while
return (0);
}
Above is my code. I am attempting to network together a group of 4 MSP430s. Currently I can't even get the master to send the start signal. The code gets stuck in EUSCI_B_I2C_masterSendSingleByte(baseAddress, 0x55), specifically line 249
//Poll for transmit interrupt flag.
while (!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG));
This is directly after the send start condition line
//Send start condition.
HWREG16(baseAddress + OFS_UCBxCTLW0) |= UCTR + UCTXSTT;
Seems to me that the UCTXIFG flag is supposed to be set but it is not getting set. Also I am monitoring both lines with a logic analyzer and after the send start condition line is executed no actually start condition is sent. SDA remains high. I am powering the lines with 3V and using Im using the MSP430FR5969 development boards. Please advise.