sloso 0 Posted December 7, 2010 Share Posted December 7, 2010 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 Quote Link to post Share on other sites
NatureTM 100 Posted December 7, 2010 Share Posted December 7, 2010 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. NJC 1 Quote Link to post Share on other sites
sloso 0 Posted December 8, 2010 Author Share Posted December 8, 2010 Thanks for to welcome me. What is the different between USI and UART? 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 Quote Link to post Share on other sites
GeekDoc 226 Posted December 8, 2010 Share Posted December 8, 2010 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. NJC 1 Quote Link to post Share on other sites
bluehash 1,581 Posted December 8, 2010 Share Posted December 8, 2010 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. Quote Link to post Share on other sites
NJC 17 Posted December 9, 2010 Share Posted December 9, 2010 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. Quote Link to post Share on other sites
jbremnant 17 Posted December 14, 2010 Share Posted December 14, 2010 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? @simpleavr I know you work under linux, so you might have encountered these issues? If anyone has any suggestions, please let me know. Thanks! Quote Link to post Share on other sites
bluehash 1,581 Posted December 14, 2010 Share Posted December 14, 2010 Probably of some help till savr replies: http://groups.google.com/group/ti-launc ... c8a4f00ab6 jbremnant 1 Quote Link to post Share on other sites
simpleavr 399 Posted December 14, 2010 Share Posted December 14, 2010 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. jbremnant 1 Quote Link to post Share on other sites
jbremnant 17 Posted December 14, 2010 Share Posted December 14, 2010 Hmm.. thanks for the response guys. The LP forum on google confirmed my hunch on this uart behavior under linux. I'll take simpleavr's suggestion and control clean flush/exit from the host. But I might as well take the easy road and use ftdi breakout. :roll: Quote Link to post Share on other sites
simpleavr 399 Posted December 14, 2010 Share Posted December 14, 2010 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 and echo 1 > /sys/bus/hid/drivers_autoprobe good luck w/ your projects. bluehash, losgann and jbremnant 3 Quote Link to post Share on other sites
jbremnant 17 Posted December 15, 2010 Share Posted December 15, 2010 dang dude, thanks for being so helpful and instructive. Where do you find the time to answer so many questions? I'll post here if I find any other useful tricks and tips with regards to Launchpad uart on linux. Quote Link to post Share on other sites
simpleavr 399 Posted December 15, 2010 Share Posted December 15, 2010 Where do you find the time to answer so many questions? . i always have one of my ez430 at work, now i also got the launchpad from doc and i kept the original one at work. that's my lunch time entertainment. [EDIT] only when work is not busy. NJC 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.