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.

Sending data from MSP430 Launchpad to Computer to be used in software program

Other Parts Discussed in Thread: MSP430G2553, MAX3232

Hi all,

I am currently using the TI Launchpad MSP-EX430G2 (MSP430G2553) and want to send 32b unsigned ints to my computer to be used in a software program of its own. I know that there is a software UART and a hardware UART based on how the jumpers on the launchpad are connected, but I am unsure which one to use and how I would go about doing it.

I want to just have the launchpad connected to the computer via the USB cable and I read that for hardware, this setup would only allow me to go at a baud rate of 9600. Can I go at a faster baud rate using software or would the same limit apply? Other than that, are there any other reasons to use software UART vs hardware UART. Which would be easier to implement and which would perform better (if that makes any sense)?

Also, is it even possible to use the data in a different software program on the computer, because a lot of the times, I just see people printing the data in their terminal, which is not what I want to do. Any help would be greatly appreciated.

Thanks,

Matt

  • Hi Matthew,

    The baud rate limitation isn't on the MSP430 side but rather is a limitation of the USB to UART interface chip that is on the Launchpad, connected to the MSP430. So the restriction will apply whether using hardware or software UART, unless you decide to use some other hardware than the Launchpad to interface with your PC.

    The Hardware UART will be easier to implement and perform better, as the software UART is essentially bit-banging using a timer. The hardware UART implementation is using the USCI module in the MSP430, which is designed to support UART communication. The only reason there is a software UART option is that there are older/smaller value line parts that don't have the USCI module, or for if you need to have more UART interfaces configured than you have USCI modules to support.

    It is possible to use the data in a different program, but you'd have to write that program yourself probably. You can definitely communicate with the Launchpad with any terminal program, but if you want to do something fancier you could write a GUI using something like Processing that opens the COM port that the MSP430 Launchpad UART is connected to and then do whatever you want with the data. You might want to define some simple communication protocol layer on top of the UART (with header/data/footer fields for example) but that's entirely up to you - with that method you control both ends of the communication (the GUI and the MSP) and so can do whatever you want with it.

    Regards,

    Katie

  • Thanks for the reply,

    Do I need to physically connect P1.1 and P1.2 (the two pins corresponding to UART) to anything? I'm kind of confused how the actual data is being transferred form launchpad to computer and if the USB cable alone will do the trick (USB to UART interface chip).

    Also, is there an easy way to read what I send to the computer from on the terminal, just to verify basic functionality before I go into writing software for the computer?

    Thanks,

    Matt

  • Hi Matt,

    P1.1 and P1.2 are connected with the RXD and TXD jumpers on J3 to the eZ430 emulator section of the Launchpad, which includes already a USB to UART interface chip. So the data you send on these pins will go through this interface and up through the USB interface to the PC.

    In more detail, you can follow the path on the schematic that's in the Launchpad User's Guide. You can see that P1.1 and P1.2 connect to J3, then become BRXD/BTXD, go through a resistor becoming BRXDI/BTXDI and go into a UART interface on U1 (an MSP430F16x device that is part of the emulator) as well as to U3, the TUSB chip which is a USB to UART interface device which then passes the data up to the PC.

    Regards,

    Katie

  • Thanks Katie,

    I am just one unsure of one more thing, and that is how to actually verify proper receiving and trasmitting from PC to microcontroller back to PC. There is example code for "echoing" using USCI_A0, however, I am unsure how the computer end of UART is working. Could you explain to me how to set up this example program? From the launchpad side, after the receive flag goes high, it takes a received byte and then transmits it back to the sender, but how is the sender doing this? Is there code I have to write for this? Or is there something pre-programmed that I can use to get this basic functionality working? Once I can get that running, I can focus on what I specifically need to do with the MSP430.

    Thanks,

    Matt

  • Hi Matt,

    You can use any terminal program to do this (Hyperterminal, HTerm, Docklight, etc) there are a variety of them out there. You can even open a terminal window within CCS.

    I'll walk you through opening a ternminal in CCS (though for more advanced terminal features you may want to upgrade to using some other terminal program - the process and settings will be the same).

    In CCS go to View > Other... then in the Show View window that pops up go to Terminal > Terminal and click OK. A terminal window will appear somewhere (for me at the bottom as a tab where Console normally is). Click the connect symbol on the right (green symbol of two circles with a zig-zag connection) and a Terminal Settings window will pop up.

    In Terminal Settings set Connection Type to Serial, then set Port to match whatever COM port your MSP430 Application UART has enumerated as when you look in windows Device Manager, Baud Rate: 9600, Data Bits: 8, Stop Bits: 1, Parity: None, Flow Control: None (most of this will be default settings, you'll probably just need to set the COM port).

    Now you can connect and type in the terminal. If the program is working correctly, the characters will be echoed back by the MSP430 and appear as you type them. If there is no echo going on, no characters will appear in the window even though you are typing them.

    Hope this helps get you started.

    Regards,

    Katie

     

     

     

  • Matthew Wasko said:
    Do I need to physically connect P1.1 and P1.2 (the two pins corresponding to UART) to anything?

    As Katie explained, these pins are by defauilt connected the the USB/SER bridge chip in the programming part of the LaunchPad. However, this way is limited to 9600Bd (the 'real' serial connection of the bridge is between USB and the programming controller, for the JTAG communication with the debugger - the 9600Bd applicaiton UART is just a hack to use remaining CPU capacity on two spare I/O pins)

    If you want to use mroe than 9600Bd with the MSP, you'll have to connect these two pins to an external USB/serial chip (e.g. teh FTDI chhips with 3.3V TTL output) or a TTL/RS232 level shifter like the MAX3232, so you can directly connect a real COM port on the PC.

    In all cases, the data arrives on the PC through a (real or virtual) COM port and can be accessed with any software that accesses the PCs COM port. (Hyperterm, PUTTY, the serial port component of VisualC++, even the COMx: device 'letter' on the DOS box, but here the baudrat needs to be configured externally)

  • "Hope this helps get you started."

    Sure helped me.

    Thanks Katie

    Surprisingly Hyperterm or Putty did not show the echo characters, but the CCS Terminal window did.

    Regards

    Rajeev

  • Rajeev Kohli said:
    Surprisingly Hyperterm or Putty did not show the echo characters, but the CCS Terminal window did.

    Because HyperTerm and Putty receive and send through serial connection, while the CCS terminal fetches the data from an (otherwise empty) putchar/getchar function through JTAG.

    If the CCS terminal works, then you haven't implemented a proper serial transfer at all.

  • Dears


    Your posts are very helpful

    I did sent data "hello world message" from the MSP430 launchpad to the PC, and I saw this message via putty. Now I would like to do it the other war, i.e. I want to send data from the PC to the MSP430 and I would like to see what is send (let us say, if I press the letter A on the keyboard then I got it displayed on the putty screen). Do you have an example for doing this?

    Thank you

    Murtadha

  • The simplest way would be to turn on the local echo feature on PUTTY. But I guess it's not what you want. :)

    I'm not sure whether PUTTY will send keyboard input by default in line mode (sendign it only after pressing enter) or the moment when you press the key. It might be configurable.
    Now once the letter gets sent, the MSP should receive it in RXBUF and set RXIFG. Now the code has to read the incoming character from RXBUF and act on it, either sending it back (be sure to not interfere with an ongoing send operation) or do some action and send a proper response back.
    There is a loopback example available in teh demo codes, but I don't recommend using it. While indeed providing an echo, it would rather be a step backwarts, now that you already have a working send function.
  • Hi Matt,

    you have told there is a example code for "echoing" using USCI_A0, can you please tell me how to get it?

    Thanks

    Sara

  • AFAIK, it was the default sample code that is provided for using the USCI RX interrupt. In the ISR, the data is simply read from UCA0RXBUF and put into UCA0TXBUF.
    But the organization of sample code has been changed a few times since I last looked at this sample code (and found it rather worthless for any educational purpose, hence the comments in my last post in this thread), so I can't tell where it can be found now (or whether it has been removed).
  • Hi Jens,

    thank your for answering me, I've alrealdy got it in Resource Explorer from Texas Instruments home page. There are many others too.

**Attention** This is a public forum