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.

2553 UART 19200 problem

Other Parts Discussed in Thread: MSP430G2553, MSP430G2231, MAX3232

I have Launchpad v1.5, 2553 on it.

I try to start examples from slac485a.zip

When the speed is 9600 or lower it is Ok.

I start terminal, use 9600-n-1 and it works fine.

However when I try to change speed to 19200 or more (or if I use examples with such speeds) I have communication problems.

Some chars are echoing ok, but most chars are not.

When 9600 is set all chars are echoing right.

Example:

//******************************************************************************
//   MSP430G2xx3 Demo - USCI_A0, 19200 UART Echo ISR, DCO SMCLK
//
//   Description: Echo a received character, RX ISR used. Normal mode is LPM0.
//   USCI_A0 RX interrupt triggers TX Echo.
//   Baud rate divider with 1MHz = 1MHz/19200 = ~52.1
//   ACLK = n/a, MCLK = SMCLK = CALxxx_1MHZ = 1MHz
//
//                MSP430G2xx3
//             -----------------
//         /|\|              XIN|-
//          | |                 |
//          --|RST          XOUT|-
//            |                 |
//            |     P1.2/UCA0TXD|------------>
//            |                 | 19200 - 8N1
//            |     P1.1/UCA0RXD|<------------
//
//   D. Dang
//   Texas Instruments Inc.
//   February 2011
//   Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10
//******************************************************************************
#include  "msp430g2553.h"

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  BCSCTL1 = CALBC1_1MHZ;                    // Set DCO
  DCOCTL = CALDCO_1MHZ;
  P1SEL = BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD
  P1SEL2 = BIT1 + BIT2 ;                    // P1.1 = RXD, P1.2=TXD
  UCA0CTL1 |= UCSSEL_2;                     // SMCLK
  UCA0BR0 = 52;                             // 1MHz 19200
  UCA0BR1 = 0;                              // 1MHz 19200
  UCA0MCTL = UCBRS0;                        // Modulation UCBRSx = 1
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

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

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

- is not working normal

//******************************************************************************
//   MSP430G2xx3 Demo - USCI_A0, 9600 UART Echo ISR, DCO SMCLK
//
//   Description: Echo a received character, RX ISR used. Normal mode is LPM0.
//   USCI_A0 RX interrupt triggers TX Echo.
//   Baud rate divider with 1MHz = 1MHz/9600 = ~104.2
//   ACLK = n/a, MCLK = SMCLK = CALxxx_1MHZ = 1MHz
//
//                MSP430G2xx3
//             -----------------
//         /|\|              XIN|-
//          | |                 |
//          --|RST          XOUT|-
//            |                 |
//            |     P1.2/UCA0TXD|------------>
//            |                 | 9600 - 8N1
//            |     P1.1/UCA0RXD|<------------
//
//   D. Dang
//   Texas Instruments Inc.
//   February 2011
//   Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10
//******************************************************************************
#include  "msp430g2553.h"

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  BCSCTL1 = CALBC1_1MHZ;                    // Set DCO
  DCOCTL = CALDCO_1MHZ;
  P1SEL = BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD
  P1SEL2 = BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD
  UCA0CTL1 |= UCSSEL_2;                     // SMCLK
  UCA0BR0 = 104;                            // 1MHz 9600
  UCA0BR1 = 0;                              // 1MHz 9600
  UCA0MCTL = UCBRS0;                        // Modulation UCBRSx = 1
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

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

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

- is working good.

  • The baud rate for the Launchpad USB virtual COM port is limited to 9600 baud.  If you need higher baud rates, you will need to connect an external USB to serial device that can support higher baud rates to the UART interface.

  • I can not to agree with you.

    I use this launchpad as a virtual COM-port with GPS module at 19200 and it works fine.

    When I try to run example at 19200 I see it is not working,

    When I try to communicate with GPS module using my 2553 inserted in launchpad I have the same problem.

    May be launchpad's virtual COM-port can not work fine with 2553 at 19200, but it definitely works with others.

  • Fascinating.

    The MSP-EXP430G2 LaunchPad Experimenter Board User's Guide indicates in Chapter 1, section 1.1 that the USB debugging and programming interface featuring a driverless installation and application UART serial communication with up to 9600 baud.

     

  • So, you have the G2553 operating as a USB host for the GPS module to get the 19200? Confusing...

    You can get the 19200 and faster if you bypass the USB and connect directly to the hardware UART but you will need an interface for that. Maybe a FTDI?

    The USB virtual com-port is hardware limited to 9600, which is well documented everywhere.

  • :)

    Ok.

    9600 bps is maximum for launchpad vusb.

    19200 is not possible when I use launchpad with GPS module.

    I have 19200 when GPS module is connected to launchpad vusb AND have no 19200 when msp430g2553 in launchpad is connected to the same GPS module.

    May be I have errors in my program and it is the reason. But how can it be that 9600 bps is maximum AND is working fine at 19200? :)

    I can make video if needed.

  • If it were working fine at 19200 would we be here?

    Yes, video, please.

  • Really? What are we looking at? Can't tell what you've connected where or what exactly you are doing. What happens at the end of the video? Next time, please youtube the video.

    edit: also can you give us specs on the gps? I have several and they need to have settings adjusted to communicate at different speeds. 9600bps is the default for all but 1.

  • Greg Whitmore said:
    Really? What are we looking at? Can't tell what you've connected where or what exactly you are doing. What happens at the end of the video?

    As I read in documentation on it, it has default uart speed 115200 (!)

    Somewhere in the forum I heard about 9600 bps by default.

    My module default speed is 19200, I tried to work with it using msp430g2231, it has no uart.

    Writing sowtware uart was not so simple, I still don't know why I had sync problems.

    Now I have 2553, UART... Using hw UART I should get it easier.

    But launchpad's 9600 is broking my dreams... :)

    GPS TX is connected to P1.2 of launchpad, jumpers are set to "SW UART" position. (LP v1.4 can be also used in the same manner)

    On the video I connect LP, then I show it's UART appearing in my devices list.

    Then I enable GPS out. It starts to send data.

    In the end I disable it to show that data flow is also stopping.

    Greg Whitmore said:
    also can you give us specs on the gps?

    TSI EB-270

  • Well... all I can offer is that you're lucky it works for you this way at all. My Launchpads are all version 1.4. I tested the same type of connection with speeds other than 9600 and all I get is gibberish. 

    So, I guess technically, it's operating out of spec and could be considered a hack if you get it running. :)

  • Eugene Riabov said:
    Then I enable GPS out. It starts to send data.

    And the data is valid data? Or are you just seeing 'something' coming in?
    Sending with 19200 or more to the TUSB chip will cause it to see 'something' with 9600Bd. However, the bits will be garbled.

    The backchannel UART of the LaunchPad is just an add-on for debug output, not for high-speed data communication.

    The hardware UART in the 2553 supports up to 1MBd. However, the bit-banging software UART implemented into the TUSB chip (the real hardware UART of this chip is going to the FET) simply isn't that fast. 9600 is the maximum.

    You can remove the RX ad TX jumpers of the LaunchPad and connect the lines to a separate USB/Serial converter (use one with TTL compatible output or you'll need an additional level-shifter like the MAX3232). Then up to 1MBd are doable with the MSP.

  • Jens-Michael Gross said:
    And the data is valid data? Or are you just seeing 'something' coming in?
    Sending with 19200 or more to the TUSB chip will cause it to see 'something' with 9600Bd. However, the bits will be garbled.

    Data is ok, it is very strange if 9600 is maximum.

    I need msp430 <-> GPS exchange. What I had in past were strings from GPS which contained some useful info but a lot a garbage in the end. I thought then that there is a trick to work with uart and stopped with this idea. Now 2553 has uart, and I try to reach 19200 between GPS and MSP.

    What I think now is that I forgot that RX and TX of MSP430g2553 are "flipped". May be I should check cable... But not now.

  • Eugene Riabov said:
    Now 2553 has uart, and I try to reach 19200 between GPS and MSP.

    Well, GPS and MSP is not the problem. But anything-to-PC through the LaunchPad bacchannel sierial->USB bridge is the problem.
    As I said, the MSPs USCI module itself supports up to 1MBd.

    And yes, the hardware UART RX and TX pins are twisted compared to the software UART pins.

**Attention** This is a public forum