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.

[Launchpad, MSP430G2553]: No echo using UART

Other Parts Discussed in Thread: MSP430G2553

Hello Group,

   I am new to MSP430. I am trying to work with the launch pad with MSP430G2553 and trying to run the code in the C file: msp430g2xx3_uscia0_uart_01_9600.c

 

#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

}

 

I have not connected any crystal as yet to the board. Still i am getting no response on the UART when I send a byte. 

How should I make it work?

I am sending the byte over the "MSP430 Application UART" port.

 

Regards,

Vineet.

 

 

 

  • Vineet,

    if you have the current revision of LaunchPad (Rev.1.4), make sure the TXD & RXD pins are swapped. By default, the jumpers connect P1.1 to TXD and P1.2 to RXD. But on the G2553 device, the USCI-UART uses P1.1 for RXD & P1.2 for TXD.

    In the new revision of the LaunchPad (REv.1.5), the jumpers are re-positioned so that you can easily flip between TimerA UART and USCI UART.

    Additionally, make sure your serial configuration on the PC is correct. (9600 8N1)

    Regards,

    Dung

     

  • Hi,

      I was able to get the loop back working wit your comments. Thank You.

    I have another issue though, please refer the pic attached.

    The bottom window shows the tx data and the top window shows rx data. I noted that the data gets corrupted a couple of times. Mind you, I am not using any crystal on the lanuchpad with 2553. 

     

    My concern: I need to parse the data coming from a distance of 1 km over 485 bus with bauds 300, 600, 1200, 2400, 4800 and 9600. Could you help in suggesting a crystal value so that I can get minimum error with this distance. I intend to provide a DIP switch for baud settings so no need of baud detection.

     

    Many thanks,

    Vineet.

     

     

     

  • Hi Vineet,

    I saw this issue in the docs, that the 1.4 boards are set up with the configuration for TX & RX different than that seen in the G2553 device. You advise

    "if you have the current revision of LaunchPad (Rev.1.4), make sure the TXD & RXD pins are swapped"

    How is this swap performed ? Does one use the PMAP library to do so ?

    Best Regards,

    Gary

  • Hello Again,

    My apologies, but I did find the answer in the following post

    http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/181343.aspx

    which explains that the rev4 boards just need the Rx and Tx jumpers moved from the vertical, to the horizontal position when working with the G2553 devices.

    Best Regards,

    Gary

  • Changing the jumpers resolves the problem while working on the LaunchPad.  If you tansfer the G2553 to a bread board the hardware UART code that worked  on the Launcpad with horizontal jumpers fails.  Viewing  the  the Lauchpad PCB in the Users Guide reveals  an  obfiscated configuartion to accomdate the horizontal jumper configuration. I am working with REV  1.5. It seems there a fundamental design issue.

    PS: I am using a FTDI    C232HM  USB cable

  • Hello, 

    I am looking for the same echo results as you using the same g2553 and the same example code. I noticed that Dung Dang helped you to fix your problem but I'm not sure I understand the issue. What exactly did you have to change to fix it?

    Thanks,

    Teshaun Francis

    (Also I'm using RealTerm but I've heard its also very good so I assume that's not the problem)

  • Hi Teshaun,

    RealTerm should be fine.

    You stated that you are using the g2553, which is useful and informative, but are you communicating to the msp430g2553 within a launchpad or are you using it in a stand-alone circuit ?

  • I am using it within a launchpad; straight out of the box, I haven't made any changes

    EDIT: I found your post about the jumpers (I don't know how I missed it) that links to an explanation of how the jumpers are supposed to be oriented. 

    http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/181343.aspx

    Switched them from horizontal to vertical and the echo is successful on RealTerm. Thanks for your help! I've been trying to get this project going for the longest time and finally I'm making progress :D

  • Good to hear it, clearly, I had the same sense of relief when my own launchpad jumped to life.

    cheers,

    Gary

**Attention** This is a public forum