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.

MSP430F5529: MSP430F5529 I2C

Part Number: MSP430F5529

Hi,

I am trying to use I2C Peripheral. MSP4305529 controller I2C pins are connected to I2C EEPROM Memory. To monitor transmit I have used polling function instead of interrupt.

I am facing problem that during dubug mode pointer get stop at polling of TX flag and RX flag. Sometime it smoothly work with flag without any change in code or any other thing.

  • Are you stepping through your code?
    Just as far as I remember, it goes like this with your code:

    1) You send a start with address, and immediately TXIFG = 1

    2) You put first char in the buffer, TXIFG = 0

    3) You enter some kind of a delay

    4) When the address is transmitted and ACK received, MSP I2C immediately starts transmitting the first character you've entered and TXIFG = 1 again

    5) The MSP I2C will stall the line after the seventh bit, and will not send an eighth bit before you put another character into the buffer

    So if you're too slow (because of the long delay or because of stepping through) the slave might reject the transaction. I don't see the need for the delays, the flag polling mechanism assures that everything is done in time. I also recommend you to check the NACK flag, so use something like this:

    while((UCB0IFG & UCTXIFG) == 0)
    {
        // Check for NACK while waiting
        if(UCB0IFG & UCNACKIFG) == 1)
            return TRANSACTION_FAILED_FLAG;
    }
    

  • The baud rate can be set only while the module is in reset.
    But the line "UCV0CTL1 = UCSSEL_2" cleared the reset bit.

    "=" changes all bits in the register. When setting or clearing individual bits, take care to use "|=" or "&=~".

**Attention** This is a public forum