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.

MSP430F477: INTERRUPT SERVICE ROUTINE FOR NEGATIVE ACKNOWLEDGEMENT INTERRUPT FLAG (UCNACKIFG)

Part Number: MSP430F477
Other Parts Discussed in Thread: MSP430F47177

Dear All ,

I my application i am using I2C Master Transmitter Mode . 

I am Facing problem when the following condition :

1 - Acknowledgement BIT is lost or Negative Acknowledgement Bit is set.

I am unable to find , how to write the Interrupt Service routine for this negative acknowledgement &  what will be the vector address where the service routine will be written . 

In the datasheet i have also found UCNACKIE (Not-acknowledge interrupt enable)  bit . what is the role of UCNACKIE in the negative acknowledgement routine .

Regards,

Sameer Batra 

  • Hello Sameer,

    I'm sorry, but I don't understand what you're asking. Have you referenced our I2C code examples yet? If not, I would suggest starting with them. Also, please take a look at our Solutions to Common eUSCI and USCI Serial Communication Issues on MSP430™ MCUs app note.

    This thread may be helpful regarding UCNACKIE.

    Using UCNACKIE in I2C comms

    Regards,

    James

    MSP Customer Applications

  • Hello James,

    Thank you for the information you have shared .

    My question is how to write the service routine for the Negative Acknowledgement interrupt  ?

    Can you please give me link to for the referenced code for the I2C Code example .

    Regards ,

    Sameer

  • Hello Sameer,

    In the thread linked below, I see you've changed the part number from MSP430F477 to MSP430F47177. You can find the I2C code examples for the MSP430F47177 in the TI Resource Explorer. These examples can be downloaded and imported into CCS. 

    MSP430F47177 Code Examples

    For example, you can find the NACK ISR towards the bottom of the msp430x471x7_usci_i2c_standard_master.c code example.

    //******************************************************************************
    // I2C Interrupt For Start, Restart, Nack, Stop ********************************
    //******************************************************************************
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector = USCIAB0RX_VECTOR
    __interrupt void USCIAB0RX_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(USCIAB0RX_VECTOR))) USCIAB0RX_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
        if (UCB0STAT & UCNACKIFG)
        {
            UCB0STAT &= ~UCNACKIFG;             // Clear NACK Flags
        }
        if (UCB0STAT & UCSTPIFG)                        //Stop or NACK Interrupt
        {
            UCB0STAT &=
                ~(UCSTTIFG + UCSTPIFG + UCNACKIFG);     //Clear START/STOP/NACK Flags
        }
        if (UCB0STAT & UCSTTIFG)
        {
            UCB0STAT &= ~(UCSTTIFG);                    //Clear START Flags
        }
    }

    I see that Clemens has helped you with the NACK interrupt in the following thread, so I'm closing this thread.

    MSP430F47177: USCIAB0RX , USCIAB0TX , USCIAB1RX , USCIAB1TX - MSP430 INTERRUPTS

**Attention** This is a public forum