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.

MSP430F5419A: MSP430F5419A UART receive wrong data

Part Number: MSP430F5419A
Other Parts Discussed in Thread: MSP430F5529

Hi,

I am running into a seemingly simple issue with the UART, particularly the UCA3 port on the MSP430F5419A chipset. The setup looked ok since I was able to transmit properly (verified received data with Widows app) but when I tried to send data from this Windows app to the chipset the the received data looked random. I probed the pins with a Saleae and confirmed the data byte through the wire was correct but the UCA3RXBUF readout was wrong. I also checked the wiring to make sure they made all connections to the appropriate pins.

Btw, I used the same setup routine for UCA1 UART and had no problem with this.

Any clue is appreciated,

Ed

  • How are you displaying the data?
    Could the data be reversed? i.e., instead of 00000001 you get 10000000?
  • No, the received data look rather random with no particular pattern even though the Saleae shows consistently correct data in proper order every time. This is very baffling because TX channel has no problem whatsoever.
  • Any idea?
  • You need to share your software.

    You are not at an exact multiple of the baud rate set in the program, are you?
  • The software is as simple as:

    Data = UCA3RXBUF;

    When I put a break point here the UCA3RXBUF register looks random. As stated the TX is working flawlessly for the same port so I don't think exact multiple for BAUD rate is a problem here. If anything my guess would be on board interference on this RX pin somehow, but not sure yet.

    Thanks for your input!
  • is Data volatile?
  • Hi Keith,

    No but does it matter? I looked directly into UCA3RXBUF and it was wrong from there.
  • Hello Snuk,

    This is a strange error. You said it works fine for UCA1 but doesn't work for UCA3. Can you post your UART setup and ISR code? I don't see how switching UART ports would affect anything unless you've forgotten to change one of the configuration registers from UCA1 to UCA3.

    Please read through Section 3 Common UART Communication Issues in our Solutions to Common eUSCI and USCI Serial Communication Issues on MSP430 MCUs app note.

    Regards,

    James

  • It is quite strange! The weirdest thing is the TX is always perfect but the RX is garbage. Anyway, one more strange thing is that when I move to 9600 BAUD (from 14400 BAUD) both TX and RX are working properly now, without changing any other settings in the code. I currently don't have time to investigate further but if anyone has any clue please comment. Thanks!

  • For these devices, we see many users that aren't following our recommendations regarding the system frequency versus supply voltage and PMMCOREVx settings as illustrated by Figure 5-1 in the datasheet. If your system clock isn't configured correctly, it could fluctuate enough to affect the UART communication, even if you have the correct baud rate settings.

    Since you're using the MSP430F5419A, you can read more about this in Section 2.2.4 Increasing VCORE to Support Higher MCLK Frequencies in the MSP430x5xx and MSP430x6xx Family User's Guide. As specifically mentioned in this section, it's critical that the VCORE level be increased by only one level at a time. The following steps 1 through 4 show the procedure to increase VCORE by one level. As a reference, the following is a C code example for increasing VCORE. The sample libraries provide routines for increasing and decreasing the VCORE and should be used whenever possible.

    There's also an important NOTE at the end of the section.

    NOTE: The MSP430 Driver Library (which replaces the MSP430 F5xx/F6xx Core Libraries) contains useful and easy-to-use functions for easily configuring and using the PMM module. The MSP430 Driver Library can be downloaded with MSP430Ware.

    As a reference, here's a code example for the similar MSP430F5529 with the important SetVcoreUp() function. For this example, the DCO is run at 25MHz, so the core voltage must be raised level-by-level using this function to run correctly at 25MHz. Keep in mind that you may need to make some changes to other parts of the code for the MSP430F5419A.

    MSP430F55xx_UCS_10.c

    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2012, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     *******************************************************************************
     * 
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //   MSP430F552x Demo - Software Toggle P1.1 with 25MHz DCO
    //
    //   Description: Toggle P1.1 by xor'ing P1.1 inside of a software loop.
    //   ACLK is rought out on pin P1.0, SMCLK is brought out on P2.2, and MCLK
    //   is brought out on pin P7.7.
    //   ACLK = REFO = 32kHz, MCLK = SMCLK = 25MHz
    //
    //                MSP430F5529
    //             -----------------
    //         /|\|                 |
    //          | |             P1.0|-->ACLK
    //          --|RST          P7.7|-->MCLK
    //            |             P2.2|-->SMCLK
    //            |                 |
    //            |             P1.1|-->Port Pin toggle
    //
    //   Bhargavi Nisarga
    //   Texas Instruments Inc.
    //   April 2009
    //   Built with CCSv4 and IAR Embedded Workbench Version: 4.21
    //******************************************************************************
    #include <msp430.h>
    
    void SetVcoreUp (unsigned int level);
    
    int main(void)
    {
      volatile unsigned int i;
    
      WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
      P1DIR |= BIT1;                            // P1.1 output
    
      P1DIR |= BIT0;                            // ACLK set out to pins
      P1SEL |= BIT0;                            
      P2DIR |= BIT2;                            // SMCLK set out to pins
      P2SEL |= BIT2;                            
      P7DIR |= BIT7;                            // MCLK set out to pins
      P7SEL |= BIT7;           
    
      // Increase Vcore setting to level3 to support fsystem=25MHz
      // NOTE: Change core voltage one level at a time..
      SetVcoreUp (0x01);
      SetVcoreUp (0x02);  
      SetVcoreUp (0x03);  
      
      UCSCTL3 = SELREF_2;                       // Set DCO FLL reference = REFO
      UCSCTL4 |= SELA_2;                        // Set ACLK = REFO
    
      __bis_SR_register(SCG0);                  // Disable the FLL control loop
      UCSCTL0 = 0x0000;                         // Set lowest possible DCOx, MODx
      UCSCTL1 = DCORSEL_7;                      // Select DCO range 50MHz operation
      UCSCTL2 = FLLD_0 + 762;                   // Set DCO Multiplier for 25MHz
                                                // (N + 1) * FLLRef = Fdco
                                                // (762 + 1) * 32768 = 25MHz
                                                // Set FLL Div = fDCOCLK/2
      __bic_SR_register(SCG0);                  // Enable the FLL control loop
    
      // Worst-case settling time for the DCO when the DCO range bits have been
      // changed is n x 32 x 32 x f_MCLK / f_FLL_reference. See UCS chapter in 5xx
      // UG for optimization.
      // 32 x 32 x 25 MHz / 32,768 Hz ~ 780k MCLK cycles for DCO to settle
      __delay_cycles(782000);
    
      // Loop until XT1,XT2 & DCO stabilizes - In this case only DCO has to stabilize
      do
      {
        UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
                                                // Clear XT2,XT1,DCO fault flags
        SFRIFG1 &= ~OFIFG;                      // Clear fault flags
      }while (SFRIFG1&OFIFG);                   // Test oscillator fault flag
      
    	
      while(1)
      {
        P1OUT ^= BIT1;                          // Toggle P1.1
        __delay_cycles(600000);                 // Delay
      }
    }
    
    void SetVcoreUp (unsigned int level)
    {
      // Open PMM registers for write
      PMMCTL0_H = PMMPW_H;              
      // Set SVS/SVM high side new level
      SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level;
      // Set SVM low side to new level
      SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level;
      // Wait till SVM is settled
      while ((PMMIFG & SVSMLDLYIFG) == 0);
      // Clear already set flags
      PMMIFG &= ~(SVMLVLRIFG + SVMLIFG);
      // Set VCore to new level
      PMMCTL0_L = PMMCOREV0 * level;
      // Wait till new level reached
      if ((PMMIFG & SVMLIFG))
        while ((PMMIFG & SVMLVLRIFG) == 0);
      // Set SVS/SVM low side to new level
      SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level;
      // Lock PMM registers for write access
      PMMCTL0_H = 0x00;
    }

    I hope this helps.

    Regards,

    James

**Attention** This is a public forum