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.

CCS/MSP430F5529: Can't get UART0 interrupt to trigger

Part Number: MSP430F5529


Tool/software: Code Composer Studio

I've spent an entire day just trying to get UART0 RX to trigger an interrupt with no luck. I am able to get UART1 RX to trigger, and I am able to TX on both UART0 and UART1. I've tried swapping the RX lines (P3.4 & 4.5) and I get the same results (ie. triggering on UART1 but not on UART0) so it doesn't seem like it's my serial hardware or terminal that's the issue.

Can someone please take a look to see if something is obviously wrong with my code? This is the latest iteration that has been cleaned up. 

#include <msp430.h>


int main(void) {
    WDTCTL = WDTPW | WDTHOLD;   // Stop watchdog timer

    //SETUP UART0
    P3SEL    |= BIT3 + BIT4;                    // P3.3,4 = USCI_A0 TXD/RXD
    UCA0CTL1 |= UCSWRST;                        // **Put state machine in reset**
    UCA0CTL1 |= UCSSEL_1;                       // CLK = ACLK
    UCA0BR0 = 0x03;                             // 32kHz/9600=3.41 (see User's Guide)
    UCA0BR1 = 0x00;                             //
    UCA0MCTL |= UCBRS_3+UCBRF_0;                // Modulation UCBRSx=3, UCBRFx=0
    UCA0CTL1 &= ~UCSWRST;                       // **Initialize USCI state machine**
    UCA0IE |= UCRXIE;                           // Enable USCI_A0 RX interrupt

    // set up UART1
    P4SEL    |= BIT5 + BIT4;                    // USCI_A1 TXD/RXD
    UCA1CTL1 |= UCSWRST;                        // **Put state machine in reset**
    UCA1CTL1 |= UCSSEL_1;                       // CLK = ACLK
    UCA1BR0 = 0x03;                             // 32kHz/9600=3.41 (see User's Guide)
    UCA1BR1 = 0x00;                             //
    UCA1MCTL = UCBRS_3+UCBRF_0;                 // Modulation UCBRSx=3, UCBRFx=0
    UCA1CTL1 &= ~UCSWRST;                       // Initialize USCI state machine
    UCA1IE |= UCRXIE;                           // Enable USCI_A1 RX interrupt


    // Push button
    P1DIR |= BIT0;                              // Set P1.0 to output direction
    P1OUT &= ~BIT0;

    P1REN |= BIT1;                              // Enable P1.1 internal resistance
    P1OUT |= BIT1;                              // Set P1.1 as pull-Up resistance
    P1IES &= ~BIT1;                             // P1.1 Lo/Hi edge
    P1IFG &= ~BIT1;                             // P1.1 IFG cleared
    P1IE |= BIT1;                               // P1.1 interrupt enabled

    __bis_SR_register(LPM3_bits + GIE);         // Enter LPM0, interrupts enabled
    __no_operation();                           // For debugger

}

//Echo back RXed character, confirm TX buffer is ready first
// APP UART
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
    // This interrupt is never entered
    switch (__even_in_range(UCA0IV, 4)) {
    case 0:     break;
    case 2:
        while(!(UCA0IFG&UCTXIFG));
        UCA0TXBUF = UCA0RXBUF;
        break;
    case 4:     break;
    default:    break;
    }
}

//Echo back RXed character, confirm TX buffer is ready first
// APP UART
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{
    // This triggers on UART1
    switch (__even_in_range(UCA1IV, 4)) {
    case 0:     break;
    case 2:
        while(!(UCA1IFG&UCTXIFG));
        UCA1TXBUF = UCA1RXBUF;
        break;
    case 4:     break;
    default:    break;
    }
}

// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
    switch( __even_in_range( P1IV, P1IV_P1IFG7 )) {
    case P1IV_P1IFG1:                                       // Pin 1 (button 2)
        P1OUT^=BIT0;
        UCA0TXBUF = 0x22;       // This generates output on UART0
        UCA1TXBUF = 0x33;       // This generates output on UART1
        break;
    default:   _never_executed();

    }

}

  • Hello Daniel,

    Are you using the MSP430F5529 Launchpad for this evaluation? If so, one of the UARTs is connected to to the Backchannel UART path through the emulator. This means you would not get correct communication due to the emulation HW contesting the lines. To remedy this, just remove the TX/RX jumpers at the top of the launchpad.
  • Hi JH,

    Thanks for the feedback. Yes I am using the launchpad, but according to the schematic it's UART1 that's connected to the EZFET and that's the interface that is actually working as expected. Pin 3.3 and 3.4 which I'm having issues with go straight to the header. In any case I tried disconnecting the two jumpers but as expected, it made no difference.

    Dan

  • We happened to have another board, and I just tried loading my image to that one and everything is working as expected. It seems like the initial one I received through Mouser is faulty. Is there any way to have this board replaced by TI?
  • Hello Daniel,

    That's good to hear that the issue is resolved. As for board replacement, you will have to work with Mouser in the context of replacement/return of the Launchpad.

**Attention** This is a public forum