Wednesday, July 31, 2013

MSP430 Serial communication with LInux

In addition to hacking on Arduino, I am interested in other hobbyist microcontroller boards. One of the more promising ones is the MSP430 Launchpad by Texas Instruments. It is a tiny kit with interchangeable microcontrollers, and it runs great on Linux with an IDE called Energia.  Energia is a fork of the Arduino IDE so it should be familiar to most microcontroller hackers.

One downside to the Launchpad is that serial communication for the board don't work on Linux. The problem seems to be that the USB-serial emulation on the launchpad has a bug.  A person on the forums found that the Launchpad device is requesting a disconnect shortly after connecting. Gerald Stanje has an updated cdc-acm kernel module that ignores these disconnects.  That option works in case you don't mind installing a new kernel module. Also, remember to use the normal cdc-acm kernel when using devices other than the Launchpad.

External USB-serial device

A second solution is to purchase an external USB-serial translation device. There is a glut of cheap USB-serial converters available on online sites. Here is one such device based on the PL2303 chipset that costs less than $3, including shipping. If you buy such a device, you can bypass the USB-serial translation on the launchpad and use the PL2303 (or FTDI) based chip.

To use this method, disconnect the jumpers RXD and TXD jumpers that cross the Emulation - MSP-EXP430 line. Then, connect the lines as follows:

  1. GND on USB device to GND on Launchpad
  2. TXD on the USB device to RXD on the Launchpad
  3. RXD on the USB device to TXD on the Launchpad
  4. 5v on the USB device to a solder pad TP1 on the Launchpad near the Launchpad USB connector. This will power on the entire Launchpad device.
Using this, you should be able to communicate with the launchpad. To program it, connect the USB connector to your desktop as before.

This method doesn't require a new kernel module. In addition, this method works with any microcontroller board that can do serial communication: either through hardware UARTs, or through software.