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.

MSP430F478 UART

Other Parts Discussed in Thread: MSP430F478

One of my project using MSP430F478 but i am having problem on UART. I am following the sample code (msp430F(G)47x_uscia0_uart_9600), set baud rate to 9600 and source clock to ACLK but UART is not working. Who can help to provide solution? For instance, C-code which is tested can be working ....

 

  • Make sure that the baud rate, number of data bits, parity, stop bits, etc., are configured the same for the transmitter and receiver.  Using and oscilloscope, make sure that data really is being sent from the device.  And, remember that for UART communication, the RX should be connected to TX, and TX should be connected to RX.

  • Below is the code, all settings are configured based on the sample code on TI website but still cannot solve the problem. I tested step by step and i found that the interrupt is not generated when the buffer is ready. Someone is successfully using F487 UART, i am appreciated if you can share the code.  

     

    #include  <msp430xG47x.h>

    void main(void)
    {
      volatile unsigned int i;

      WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
      FLL_CTL0 |= XCAP14PF;                     // Configure load caps

      do
      {
        IFG1 &= ~OFIFG;                         // Clear OSCFault flag
        for (i = 0x47FF; i > 0; i--);           // Time for flag to set
      }
      while ((IFG1 & OFIFG));                   // OSCFault flag still set?

      P2SEL |= BIT4+BIT5;                       // P2.4,5 = USCI_A0 RXD/TXD
      UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
      UCA0BR0 = 0x03;                           // 32k/9600 - 3.41
      UCA0BR1 = 0x00;                           //
      UCA0MCTL = 0x06;                          // Modulation
      UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
      IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

      _BIS_SR(LPM0_bits + GIE);                 // Enter LPM0, interrupts enabled
    }

    //  Echo back RXed character, confirm TX buffer is ready first
    #pragma vector=USCIAB0RX_VECTOR
    __interrupt void USCIA0RX_ISR (void)
    {
      while(!(IFG2&UCA0TXIFG));
      UCA0TXBUF = UCA0RXBUF;                    // TX -> RXed character
    }

  • You have not said what you are communicating with (computer serial port, another MSP43f478), or if the two are communicating with the same baud rate, number of data bits, parity, stop bits, etc.  If the two are not configured exactly the same, the data received will not be in the right format, and you will not get an interrupt.  However, for erroneous data, the bits in the UCA0STAT register will be set if there are data format errors (look at table 19-1 in the user's guide).

    You can disable the data format check by setting the UCA0CTL1 UCRXEIE bit, and this will allow interrupts even for erroneous characters. 

**Attention** This is a public forum