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.

CCS/MSP430F5529: I2C clock stretching

Part Number: MSP430F5529


Tool/software: Code Composer Studio

Hi guys, 

So I'm using a MSP430F5529 to implement an I2C communication. My msp is in slave mode. I can properly receive data with it, but I now need to add clock stretching to my code. From my understanding, clock stretching is used when the slave wants to slow down the communication. It then holds the clock low so the master can not send any new data. Once the slave is ready it releases the clock. 

I've noticed that my MSP goes in the RXIFG interrupt every time it receives an ACK.This is where I get confused. If my master sends for example AA BB, and there's an if condition in my RXIFG that calls a function 1secondDelay() when I receive AA , my MCU is going to wait until the delay of 1 second is done to receive the BB in the RXIFG interrupt.  So what is the point of clock stretching if you receive your interrupt only when your MCU has completed all its task ? In which situation does a slave wants to slow down the communication ?

Furthermore how should I implement a manual clock stretching in my code ?

Thank you very much guys !

  • Hello Amine,

    In general for MSP430 devices using the (e)USCI modules for I2C, the RXIFG will fire every time the Receive buffer is filled, and the TXIFG will fire every time the Transmit buffer is empty.

    For debugging your I2C issues, please see the following application note.
    "Solutions to common eUSCI and USCI serial communication issues on MSP430 MCUs.' (http://www.ti.com/lit/slaa734 )

**Attention** This is a public forum