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.

MSP-EXP430FR2355: Not getting from ISR

Part Number: MSP-EXP430FR2355


Hello,

I have faced an issue where i had transmitted data(contains '\n' at end of data) from another MSP430 MCU and here i'm storing in buffer for every interrupt.

In ISR, When '\n' reaches i had set Flag=1 in else. It is reaching else but not going back to main function. It is going to abort function. please let me know what happening.

Below is the code i tried. Any help would be very thankful.

#include<msp430.h>
int main(void)
{
     WDTCTL = WDTPW | WDTHOLD;   // stop watchdog timer

    // Configure GPIO
     initGpio();
     clock_setup();

    PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
                          // to activate 1previously configured port settings

    // Configure UART pins
    P1SEL0 |= BIT6 | BIT7;                  // set 2-UART pin as second function

    // Configure UART
    UCA0CTLW0 |= UCSWRST;                     // Put eUSCI in reset
    UCA0CTLW0 |= UCSSEL__SMCLK;

    // Baud Rate calculation
    UCA0BR0 = 24;                              // 24000000/1000000 = 24
    UCA0MCTLW = 0;                  // 1000000/115200 - INT(1000000/115200)=0.68
                                    // UCBRSx value = 0xD6 (See UG)
    UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
    UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt

    __bis_SR_register(GIE);         // Enter LPM3, interrupts enabled
    __no_operation();                         // For debugger

    if(flag == 1)
    {
        data_packet();
    }
}

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
    switch (__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG))
    {
    case USCI_NONE:
        break;
    case USCI_UART_UCRXIFG:
         UCA0IFG &= ~UCRXIFG;            // Clear interrupt
         while(!(UCA0IFG&UCTXIFG));
         if(UCA0RXBUF != '\n')
         {
             UCA0TXBUF = UCA0RXBUF;
             total_packet[i] = UCA0RXBUF;
         }
         else
         {
             flag = 1;
         }
         i++;
        __no_operation();
        break;
    case USCI_UART_UCTXIFG:
        break;
    case USCI_UART_UCSTTIFG:
        break;
    case USCI_UART_UCTXCPTIFG:
        break;
    default:
        break;
    }
}

 

**Attention** This is a public forum