I note that TI suggests a method for "pinging" slaves on the I2C bus (e.g., for "discovery" feature) wherein interrupts are disabled globally and both the start and stop conditions are asserted with UCBxI2CSA set to the slave address being "pinged", the UCNACKIFG bit is saved once UCTXSTP is cleared (i.e., stop completed), then all interrupt flags are cleared before finally re-enabling global interrupts.
Is there are reason why this procedure is performed with global interrupts disabled? That is, could you simply disable the specific I2C interrupt flags (e.g., UCBxTXIE, UCBxRXIE, and all bits in UCBxI2CIE) and leave global interrupts enabled? Or does the possibility of an intervening unrelated IRQ cause timing problems with the "ping" logic?
It would be good to have global interrupts enabled so that a timer could be used to detect a bus error instead of just waiting forever for the UCTXSTP flag to clear (e.g., I have noted that sometimes the STP condition flag never clears) or having to resort to inserting an arbitrary loop count into the "while (UCBxCTL1 & UCTXSTP);"
Please advise.