Jump to content

MSP430 LaunchPad, basic uart

Recommended Posts

Hi, Im really beginner with MSP430 LaunchPad and uP programing as well. I'd like to know how to works UART communication. I have read the family guide, but anyway I don't understand. Could u provide me some easy code example...for example HT will read char from keyboard. Thank u a lot...is really important form me to understand it. thanks

Link to post
Share on other sites

The USI has hardware support for SPI and I2C, but not UART. Some of the nicer MSP430's have UART capability. It looks like NJC was able to implement UART with the Launchpad using an ftdi breakout board from sparkfun.

http://www.msp430launchpad.com/2010/08/ ... -uart.html


EDIT: By the way, welcome to the forums! Be sure to check out the code section for some project ideas.

Link to post
Share on other sites

sloso: Welcome again!


UART can be done in software. NJC has been the leader in implementing this. Check for UART posts in these forums (search for "UART"), and see NJC's blog at http://www.msp430launchpad.com/ . You should have no trouble adapting the code, NJC's really good at commenting.

Link to post
Share on other sites
What is the different between USI and UART?

The USI is knows as the "Universal Serial Interface", which means it can do UART, SPI or any serial based communication - its flexible hardware.


Can I make UART applications because of I will need to communication with a GSM module via UART....is the any possibility to do it? thanks

Yes, follow the above link which NatureTM gave you.

Link to post
Share on other sites
You should have no trouble adapting the code, NJC's really good at commenting.


Thanks Doc! I still have trouble getting the motivation to comment things. But it is amazing how important comments can be.


sloso, a big difference between a software UART and hardware UART, it is important to keep this in mind. Also, I have a few articles which are on UART, one day I might make an index sort of thing, for now you can just search my site for UART and find any related posts. The links above that NatureTM and Doc mentioned should be a great place to start.

Link to post
Share on other sites

Hi guys


I've been playing with NJC's software UART code as well.

Well, technically I am using simpleavr's cut of it since I am working under linux.


I got it to work, but noticed a weird behavior under linux.

I use either of these following commands to display debug msg my launchpad is sending via uart to my linux box.


1) screen /dev/ttyACM0 9600

2) minicom -D /dev/ttyACM0


I get intermittent input/output errors like this:


$ minicom -D /dev/ttyACM0
minicom: cannot open /dev/ttyACM0: No such file or directory


My guess is that the line doesn't get reset and there are some resident buffers that still contain data to be read?



I know you work under linux, so you might have encountered these issues?


If anyone has any suggestions, please let me know.



Link to post
Share on other sites

the most detailed findings were on the google group thread bluehash mentioned, there is even a temporary patch u can try. all things points to the linux cdc-acm driver's way working w/ the ti 3410 chip. not that i am saying the cdc-acm driver is bad, but the device class is really designed for modems (use almost exclusively to talk to cell phones), there may be control logics that are like dtr signals, xon/xoff protocols and such, etc that doesn't apply to the launchpad's application.


My guess is that the line doesn't get reset and there are some resident buffers that still contain data to be read?


i can only speculate. the ti 3410 may have a limited size buffer and if it can't talk to the host very often, it can fill up and got stuck. most of the problems i saw is the port seems "hung" and i had to kill it one way or the other.


the things that i did to "avoid" (not solving) the problem is (starting from the most important one)

. never start sending from launchpad when host is not ready to receive. i only initiate comms from the host script.

. signal the launchpad (from host script) to stop sending before exiting host script, otherwise u will have problem on your next session.

. your host script should flush everything before closing device. i.e. write_flush().

. turn off hid probing on the linux side, linux periodically probes the hid interface (there are two interfaces in the launchpad usb device), when probing happens, the ti 3410 has to response to it and if u are at the same time communicating via the cdc-acm driver, u may get timeouts / drops, etc.


the software uart is good and reliable (thanks njc / joby, etc), u can do 57600+ with a faster dco and a nokia cable. if the problem is intermittent (i.e. need re-plug cable after each session), i would live w/ it while debugging and switch to a nokia cable for production.

Link to post
Share on other sites

just tried again the spectrum analyzer comm. and has more info for u.


during development, i alternatively do flashing (via mspdebug) and running the perl script (host comm.). and when i do that, i always need to unplug / replug the usb cable when i do the firmware flashing. looks to me that the launchpad usb controller have to be reset and clear some status when i use the two interfaces (hid and serial) alternatively.


if i am not flashing and just run the host script, i can reliably start a session (host script sends start comm. and end comm. at each session), ends it and start a new session consecutively.


the linux hid probing can have an effect. it can mess up the launchpad usb controller's status (i suspect) and get your comm. hung.


i use two one line "sudo" scripts to turn it off / on (turn it off after the 1st time u plug in launchpad)

echo 0 > /sys/bus/hid/drivers_autoprobe
echo 1 > /sys/bus/hid/drivers_autoprobe


good luck w/ your projects.

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...