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.

MSP430 Uart Receiver Interrupt

Other Parts Discussed in Thread: MAX3232

Hi,


I want to check that whether my Rx ISR is getting executed. I wrote the following code to enable the RX interrupt and the ISR. But my ISR is not getting executed? Can anyone please tell me where am I doing wrong or missing something?

Here is my code for enabling ISR and my ISR routine.

Code for enabling ISR

EUSCI_A_UART_initAdvance(EUSCI_A0_BASE,
                    EUSCI_A_UART_CLOCKSOURCE_SMCLK,
                    8,
                    0,
                    0xD6,
                    EUSCI_A_UART_NO_PARITY,
                    EUSCI_A_UART_LSB_FIRST,
                    EUSCI_A_UART_ONE_STOP_BIT,
                    EUSCI_A_UART_MODE,
                    EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION );

            EUSCI_A_UART_enable(EUSCI_A0_BASE);

            EUSCI_A_UART_enableInterrupt(EUSCI_A0_BASE,EUSCI_A_UART_RECEIVE_INTERRUPT); // Enable interrupt

            __enable_interrupt();
            __bis_SR_register(GIE);

ISR :

#pragma vector=USCI_A0_VECTOR

__interrupt void USCI_A0_ISR(void)
{

      
        switch (__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG)) {
        case USCI_NONE: break;
        case USCI_UART_UCRXIFG:
            //rx = EUSCI_A_UART_receiveData(EUSCI_A0_BASE);
           
                break;
        case USCI_UART_UCTXIFG: break;
        case USCI_UART_UCSTTIFG: break;
        case USCI_UART_UCTXCPTIFG: break;
        }
}

Thanks in advance

Ayush

  • This can have multiple reasons.

    - you didn’t configure the port pins for UART use (PxSEL.y = 1)
    - there is no incoming data
    - your external data source uses different signal levels (e.g. connecting an MSP directly to a COM port without a level shifter like the MAX3232 is a bad idea)
    - you twisted RX and TX (some modems name their outgoing data line RX, as it is the RX data going to the end device, and TX is coming from the end device)
    - your program resets before it comes to the interrupt
    - the UART init function is never called by main
    - the UART has no clock (e.g. because you enter LPM4 or fall out of main before any data is coming and the IR can be triggered)

  • Hi Michael,

    Thanks for the help.

    Its working for me now.

    Regards

    Ayush

**Attention** This is a public forum