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(); } }