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.

Problem on UART demo on MSP-EXP430G2 LaunchPad Experimenter Board?

Other Parts Discussed in Thread: MAX3232

I just bought MSP-EXP430G2 LaunchPad Experimenter Board and tried to use the demo codes in CCS:

#include <msp430.h>

int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
if (CALBC1_1MHZ==0xFF) // If calibration constant erased
{
while(1); // do not load, trap CPU!!
}
DCOCTL = 0; // Select lowest DCOx and MODx settings
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
}

Connection: I connect P1.1, P1.2, GND to UART port on computer by wires. N81, 9600 baud rate.

Problem:  I run demo codes in CCS. But when I send data (such as simple 'a'), I didn't receive any echo from MSP430.

Any solutions? Some posts say I need to set TXD, RXD of J3 to horizon, still no luck. I also tried to twist P1.1, P1.2, but same problem.

  • Hi.

    Can you give more info about the following?

    1) The revision of the launchpad you bought

    2) How are you 'connecting' the wires to your computer?

    3) When you are connecting the wires to your computer, are you removing the jumpers at the emulator-controller connector junction?

    Regards,

    Shashank

  • Hi, I upload the picture. I soldered two connectors to this board.

    The board is v1.5, RXD,TXD of JP3 are set horizon. I also tried to remove these two jumpers, still no luck.

    Serial cable are connected to Launchpad as in the picture. I tested this cable with Beaglebone also by these wires, no problem.

    Thank you.

  • Shiwei,

    That is good info.

    I have some more questions to ask:

    1) Is the DB9 connector is the other end of a USB-to-UART converter or is it a typical RS232 cable whose other end goes into a CPU having RS232 port?

    2) Have you tried any code example after removing the connections to the DB9 connector and using the UART link established by keeping the jumpers intact? This will help establish if the soldered connectors are properly soldered.

    Regards,

    Shashank

  • Hi  Shashank,

    1) I use DB9 USB to UART cable converter. To make sure the cable is good, I connect pin2 and pin3 of this cable, so it will echo what it send out. And it did receive what it send out. So the cable is pretty good.

    2)I tested the solder by multimeter, no problem. I even put RX, TX two wires directly on the MSP4302553 pins.

    Still no luck. I probably need to check code details and set some breakpoints to debug.

    Thank you.

  • Shiwei,

    Did you try removing the DB9 connection from launchpad and using the UART link back through the USB port? You will need to keep the jumpers in horizontal position.

    USB to UART converter works.

    Connections to soldered connectors are good.

    Soldered connectors are good.

    If the same code does not work for the UART link, software can be the only culprit (I am assuming you have taken care of keeping the UART settings same on both sides - 9600 8N1).

    Regards,

    Shashank

  • Hi Shashank, 

    Thank you again for your reply.

    I am sure the UART setting are both 9600 8N1. 

    But I don't quite understand your reply. Do you mean I can run codes in CCS and open Launchpad Serial Port on computer(COM3 in my case)? This connection confuses me since the USB connector of launchpad is actually serial-to-usb, but it's used to debug codes.

    Also, after running codes in CCS, the codes are programmed into MSP430? If I plug Launchpad by USB cable into computer without  CCS, the codes will start automatically? (Or how to program codes into Launchpad?)

    Thank you again.

  • Shiwei,

    Yes, you can open Launchpad serial port on your computer with only the USB cable connected to the launchpad. It is one of the nice features of the launchpad. Download a simple loopback example into the G2553 and open your terminal. MSP430 UART will be available as one of the COM ports - open it. It should work directly. The COM driver is installed automatically the first time you connected your launchpad to the laptop/PC. Try it out and let us know.

    I assumed you wanted to use the pins in a later project and hence wished to do it using a separate USB to UART converter. 

    Best of luck!

    Regards,

    Shashank

  • shiwei luan said:
    Hi, I upload the picture. I soldered two connectors to this board.

    From the picture, I can see that you have three peers on the RX/TX lines: the FET's application UART, the MSP and your RS232 cable. That's of course one too much.

    The two pins marked in your picture connect the MSP to the USB chip on the FET side of the LaunchPad. Through this, you already have a serial connection to the PC (it appears as 'MSP430 application UART' in the device manager.

    If you want to build a separate connection, to later use the MSP without the LaunchPad and its FET, or for higher baudrates than 9600Bd, then you have to remove these two horizontal jumpers.

    Another thing to consider: RS232, as it usually appears on those DB9 connectors, uses +-3 to +-12V signals. Also, these signals are inverted to the TTL UART signals. So a TTL-High (Vcc) is -3V while a TTL-Low (GND) is +3V. The negative voltage levels may damage the MSP and the inversion makes a communication impossible.
    You either need a level shifter on the MSP side (like the MAX3232) or the otehr side of the cable has to be connected to a signal source (e.g. an usb/ser converter) that outputs TTL-level signals rather than RS232 signals.

  • Finally, the codes problem. 

    PIDIR = oxFF; is missing.

    I am surprised that codes from TI resources should be totally correct..

  • Shiwei,

    Can you give me the name of the example code you are using? Also give links if any.

    Regards,

    Shashank

**Attention** This is a public forum