Software UART example for MSP430G2231 using mps430-gcc on Linux
This example shows how to use software UART on the TI Launchpad with a MSP430G2231 MCU (which does NOT have a hardware UART). With the code from Nicholas J. Conn, Joby Taffey and Colin Funnell I was able to create a half-way-decent software UART. Thanks Nicholas, Joby and Colin! So basically my job only was puzzeling things togehter and wrap them in a msp460-gcc project.
Update: I made a second example based on the one TI has in it’s examples. It is based on Timer_A for RX and TX. You can find that example in the “timer-a-uart” branch. Regarding transmission of the first byte this works smoother for me (the other example eats the first byte). I also used a user defined callback for echoing the inputted chars, and made the main loop just blink the green LED. Feels a little like multitasking
(Anyway, softuart sucks)
I am not going into detail about how it works, since Nicholas already did a great job doing so .
Note: If you have an MSP430 MCU which does support hardware UART (e.g. the MSP430G2553), have a look at this example.
1. Get the sources
You can download the sources on github:
git clone http://github.com/wendlers/msp430-softuart.git
Note: If you like to use the “timer-a-uart” based example, switch to that branch by issuing:
git checkout timer-a-uart
Note: This project is written for msp430-gcc on Linux (I used v4.5.3 which is available as package on ubuntu). For flashing the “mspdebug” tool was used (also from the Ubuntu package).
To compile the source just issue a:
This builds the firmware in the “bin” subdirectory in various formats.
3. Doxygen Docs
If you installed doxygen on your system, you could generate the HTML-based documentation by calling:
This will create the documentation under “doc/gen/html”.
To flash the firmware to your Launchpad you could use the “flash-target” make target:
Connecting your Launchpad should give you a new serial device “/dev/ttyACM0″. Connect to this port at 9600 bauds – e.g. by using screen:
screen /dev/ttyACM0 9600
Every character you type will be echoed then, surrounded by square brackets.