Jump to content

Hardware UART Skeleton in C

Recommended Posts

My first forum post, i'd like to help out anyone trying to use the USCI module for hardware UART.


First, some background:

I'm running the Launchpad with a msp430g2553. This chip is very full featured, comes in PDIP-20 compatible with the Launchpad, and if you're lucky, TI will send you a sample. See the datasheet:



I'm running uniarch msp430-gcc-4.5.2, which is the awesome alpha release.

For a nice how-to-compile link, try:


This worked well for me on Fedora, as does the new gcc.

Check out the bleeding edge mspdebug from git for full debugger support as well:


With the right devel packages, this guy works like a charm with the g2553.


Well, the g2553 has the TX/RX pins for the USCI module flipped from the Launchpad TX/RX headers!

So how can that be fixed? I didn't have any tools or hardware to correct the problem. Just some wire and a soldering pencil.

Why not just the hardware from the Launchpad? It has extra jumpers for the LED's and a strip of male pin headers. (i used the female headers). See the attached image.


I plan on using HW UART to act a transceiver. For my next project, i'd like to be able to send/receive data to/from the Launchpad so that it can use it in a second stage of sending/receiving. Since i've gotten the code for the first stage working, i think the place i am at could serve as a big leg up to anyone working on a project that needs to be "remote controlled" in a complex way.


Now for the code:

The flow of the program is as follows

1. Setup the button on the launchpad. i do this, because otherwise the LP will start spewing characters over serial and this breaks my ttyACM0. Im not sure why, but the driver doesn't seem to like

2. After the button is pressed, setup the USCI module.

I'm using 32.768 kHz ACLK as the clock source, UART mode, at 9600 baud

3. Spew out the alphabet in a loop.

3.1. During the main loop, the receive interrupt will write down what it got into a variable, conveniently named 'variable'.


Hopefully this will help someone out.

There's a lot more to be done. This is just a nice guidepost on the way.




EDIT: Found a bug




Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...