MSP430 / eZ430-RF2500 Linux support Guide

Texas Instruments MSP430 eZ430 is officially not supported in their Linux version of IDE – CodeComposerStudio (See comment here).

But what exactly is unsupported is CCS’s ability to program the device. Coding and compiling is possible.

The following guide describes how to bypass the above limitation.

This guide is based on a more comprehensive guide: Linux development environment for ez430-RF2500

Compile code using Code Composer Studio (CCS)

  • Download CCS for Linux.
  • Create a new CCS project with a Custom MSP430 Device or any other.
  • Compile the code. The result binary image will be in the workspace. The workspace path can be found in “File” / “Switch workspace”.
  • The file that should be programmed to the device is the project-name.out file.

Program and run device using mspdebug

  • Download and Install mspdebug
  • From the directory with the file project-name.out run:
    $ sudo mspdebug rf2500
    
  • Now you are in mspdebug's command line shell. Run the following to program and run the device:
    (mspdebug) prog <project-name>.out
    (mspdebug) run
    

    Use Ctrl+c to pause run and get command line back.

Fix a Linux Kernel bug that prevents Minicom to communicate with device

The device path in /dev is /dev/ttyACM0. Currently, connecting to it serially using utilities such as minicom is not possible, and you get the message "/dev/ttyACM0: No such file or directory".

The bug is in Kernel module "cdc_acm". The solution is to fix the bug in the source code, recompile the module and plug it instead of the existing one.

  • Find out Linux version:
    $ uname -r
    
  • cdc_acm's source is the files cdc-acm.c and cdc-acm.h. They are under the Linux path drivers/usb/class/. Download these two files from a repository that matches your Linux version. Examples are Free electrons and www.kernel.org.
  • Create a new directory and move the files to it.There are two code segments need to be removed or commented out:
    • The next lines appear in function "acm_port_activate()" on newer versions and in "acm_tty_open()" in older ones:
      // if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS) &&
      // (acm->ctrl_caps & USB_CDC_CAP_LINE))
      // goto bail_out
      
    • The next line appears in function "acm_port_shutdown()" on newer versions "acm_port_down()" in older ones:
      // acm_set_control(acm, acm->ctrlout = 0);
      
  • Create a Makefile and compile:
    $ echo 'obj-m += cdc-acm.o' > Makefile
    $ make -C /lib/modules/`uname -r`/build M=$PWD modules
    

    You should have a new cdc-acm.ko file in the directory

  • Replace the existing module (This change will be discarded after boot):
    $ sudo rmmod cdc-acm
    $ sudo insmod ./cdc-acm.ko
    

Communicate via the serial port using Minicom

  • Launch minicom setup from command line:
    $ minicom -s
    
  • In the menu, choose:
    Serial port setup
    
  • Press 'A' (for "Serial Device").
  • Replace Current device path with:
    /dev/ttyACM0
    
  • Press 'E' (for "Bps/Par/Bits").
  • Set the correct data rate for your device.To lower the rate (to 1200, for instance), keep pressing 'B' (for "previous") until the top line shows:
    Current: 1200 8N1
    
  • Press "Enter" until returning to main menu, there, press "Exit".This will exit the setup menu and start running on the device. From now on you should see messages over the serial connection: It is up to you to program the device with such messages.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: