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.

MSP430FR6989: MSP430FR6989:DiverLib:I2C

Part Number: MSP430FR6989


I am using I2C interface on the MSP430FR6989 launch pad dev board.  The UCB1SDA functionality is available on P3.1, P4.0 and P4.6 AND  UCB1SCL functionality is available on P3.2, P4.1 and P4.7.

I am using UCB1SDA = P4.0 and UCB1SCL = P4.1.

Q1. How can I ensure I have correctly configured UCB1 I2C functionality for P4.0 and P4.1.

Currently, I am following below steps along with MSP430FR6989 driverlib I2C driver,

1. 

// Set P4.0 and P4.1 as Primary Module Function.
GPIO_setAsPeripheralModuleFunctionInputPin(
GPIO_PORT_P4,
GPIO_PIN0 + GPIO_PIN1,
GPIO_PRIMARY_MODULE_FUNCTION
);

2. Initialize Master ( steps 2-4 during enatialize)

i2cParams.selectClockSource = EUSCI_B_I2C_CLOCKSOURCE_SMCLK;
i2cParams.i2cClk = 2000000; // 2MHz
i2cParams.dataRate = EUSCI_B_I2C_SET_DATA_RATE_100KBPS;
i2cParams.byteCounterThreshold = 0;
i2cParams.autoSTOPGeneration = EUSCI_B_I2C_NO_AUTO_STOP; 

EUSCI_B_I2C_initMaster(EUSCI_B1_BASE, &i2cParams);

3. Set slave address ( 7 bit dev address)
EUSCI_B_I2C_setSlaveAddress(EUSCI_B1_BASE, I2C_WRITE_ADDR >> 1);

4. // Enable I2C
EUSCI_B_I2C_enable(EUSCI_B1_BASE);

5. Wrte to I2C ( Enable Tx Interupt  and first byte and second sencond byte when Tx interupt occurs)

EUSCI_B_I2C_enableInterrupt(EUSCI_B1_BASE, EUSCI_B_I2C_TRANSMIT_INTERRUPT0);
EUSCI_B_I2C_masterSendMultiByteStart(EUSCI_B1_BASE, txData.txBuffer[0] );

The program is stuck during sending first byte at 

In function EUSCI_B_I2C_masterSendMultiByteStart()  

and code is 

 while(!(HWREG16(baseAddress + OFS_UCBxIFG) & UCTXIFG))
 {
 ;
}

Q2. Is above sequence correct? what is the correct sequence of instruction?

Thanks in advance.

Rajaram

  • Hey Rajaram,

    1. I think you just have to test it out by hooking up a slave or another MSP Launchpad configured as a slave. It's also possible if you hook it up to a logic anaylzer and look at the signals.

    2. There are some register level USCI B I2C examples available here: dev.ti.com/.../

    These don't use the driverlib functions, but they can take you through the flow.

    Thanks,
    JD

**Attention** This is a public forum