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-EXP430 Problem with UART

Other Parts Discussed in Thread: MSP-EXP430FR5969, MSP430FR5969

Hello all, I am trying to configure UART configuration on my MSP430FR5969 launchpad (MSP-EXP430FR5969). I am using one of the TI examples, specifically the one called msp430fr59xx_euscia0_uart_01.c, this program is supposed to echo characters written to a terminal back at the user. However, when I run this program I am unable to type anything in the serial COM port. Some things worth noting that I have changed is changing the configuration of GPIO pins (b/c the example used P2.0 and P2.1 for RXD / TXD but these are P2.5 / P2.6 on the launchpad). Other than that, I am not sure where I am slipping up, would anyone have strategies for debugging this problem? The complete code I am using is shown below. Any help is appreciated!

// Configure GPIO
    P2SEL1 = 01100000;                    // USCI_A0 UART operation
    P2SEL0 = 00000000;

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

    // Startup clock system with max DCO setting ~8MHz
    CSCTL0_H = CSKEY >> 8;                    // Unlock clock register
    CSCTL1 = DCOFSEL_3 | DCORSEL;             // Set DCO to 8MHz
    CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;
    CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers
    CSCTL0_H = 0;                             // Lock CS registers

    // Configure USCI_A0 for UART mode
    UCA0CTLW0 = UCSWRST;                      // Put eUSCI in reset
    UCA0CTLW0 |= UCSSEL__SMCLK;               // CLK = SMCLK
    // Baud Rate calculation
    // 8000000/(16*9600) = 52.083
    // Fractional portion = 0.083
    // User's Guide Table 21-4: UCBRSx = 0x04
    // UCBRFx = int ( (52.083-52)*16) = 1
    UCA0BR0 = 52;                             // 8000000/16/9600
    UCA0BR1 = 0x00;
    UCA0MCTLW |= UCOS16 | UCBRF_1;
    UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
    UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt

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

#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:
      while(!(UCA0IFG&UCTXIFG));
      UCA0TXBUF = UCA0RXBUF;
      __no_operation();
      break;
    case USCI_UART_UCTXIFG: break;
    case USCI_UART_UCSTTIFG: break;
    case USCI_UART_UCTXCPTIFG: break;
  }
}

  • Nothing jumps out at me except the choice of pins. On my Launchpad I use 2.0 and 2.1 which connects to the backchannel UART over the USB port. Are you connecting some other serial hardware to the pins you chose?

    If nothing else works, ditch the echo and just transmit a continous stream of characters. You should see that on your terminal or least be able to use a logic probe or some such to see the data.

  • Hi David, thanks for the reply.

    I tried doing this with the backchannel pins 2.0 and 2.1 on the launchpad, still no luck. I'm not connecting any serial hardware, but do these pins need to be connected physically on the board?

    Also, how would I go about transmitting a continuous stream of characters? Would that be implemented in the interrupt?

  • I think that there are jumpers (J13) but the default is to pass through the serial. Check the documentation to be sure. You will also need to check and make sure that the computer end is working. I use minicom (under Linux). When I plug in the Launchpad I see two serial ports appear. One is used for programming and the other is the serial. ("minicom -D /dev/ttyACM1")

    You don't need interrupts to send continuous data. Just a loop that waits on TXIFG and shoves a character into TXBUF when it is set. Repeat.

  • >>GPIO pins (b/c the example used P2.0 and P2.1 for RXD / TXD but these are P2.5 / P2.6 on the launchpad)

    My apologies if I am missing something here, but these are 2 separate serial ports (and can verify on the datasheet: https://www.ti.com/lit/gpn/msp430fr5969 )

    You are not accidentally mixing them up somehow are you?

    (I often mess up the pinmux in the register until I verify with an oscilloscope).  

**Attention** This is a public forum