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.

Stop condition not send if code place outside the interrupt

Hi,

I got trouble with the I2C stop condition if I try to execute them outside the interrupt with a MSP430f21232 configure as Master. I attached to this post an example to illustrate my trouble. Inside the main.h a define select where the stop condition is apply.

Thank you for your advise.

2476.mainI2C.h

7026.mainI2C.c

  • S��bastien Pernecker said:
    I got trouble with the I2C stop condition if I try to execute them outside the interrupt with a MSP430f21232 configure as Master.

    Well in main, the TX interrupt is always already handled by the ISR. So the main loop is eternally waiting for the TXIFG - either the ISR has handled the interrupt, then IFG is clear before main can see it, or the ISR didn'T handle the interrupt properly, then IFG is stills et and the ISR is called again and again - and main effectively freezes as there is always an interrupt left to be handled.
    You'll need to either clear the TXIE bit or add GIE to teh __bic_SR_register_on_exit in your ISR, so no more ISRs happen.

**Attention** This is a public forum