Hardware UART example for MSP430G2553 using mps430-gcc on Linux
This example shows how to use hardware UART through USCI_A on the TI Launchpad with a MSP430G2553 MCU. Receiving is done through interrupts.
Note: If you have an MSP430 MCU which does not support hardware UART (e.g. the MSP430G2231), have a look at this example.
1. Hardware Setup
The wiring for this example is as follows:
|RXD P1.1||TXD serial line|
|TXD P1.2||RXD serial line|
Note: When using the TI Launchpad with a rev. before 1.5 (the once which shipped with the MSP430G2553 should all be >= 1.5 though) , „/dev/ttyACM0“ could be used as serial port at 9600 Bauds, but RX/TX must be crossed on the jumper bridge of the Launchpad.
2. Get the sources
You can download the sources on github:
git clone http://github.com/wendlers/msp430-harduart.git
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.
To flash the firmware to your Launchpad you could use the „flash-target“ make target:
5. 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“.
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
A greeter is shown on the serial line, and you are prompted to press any key to start the echo demo. After the first keypress, „OK“ is printed, and from then on, every character you type is echoed back. Every time, a character is received, the red LED on the launchpad is toggled. The green LED stadily blinks.
Note: to actually see the greeter in your screen session, you either need to start the screen before flashing the target, or just press reset on the Launchpad after you started your screen session.