Linux – How to troubleshoot a TI launchpad not running under Linux

launchpadlinux

I have no experience with microcontrollers, except for a project a friend started with me and then abandoned midway. I still have the hardware and the code, want to complete the project, but I have forgotten most of the things we did two years ago, and I have reinstalled my OS, so I no longer have my dev environment set up. I also don't know C, but I can program in other languages.

My code does not do anything when I try to run it. To check if the microcontroller is communicating with the computer properly, I looked around for tutorials. This is what I found:

  1. I should start mspdebug. I don't even know what I should expect to happen, but what I get is an error.
rumtscho@simak:~/Projects/sovfor$ sudo mspdebug -d /dev/ttyACM0 uif
[sudo] password for rumtscho: 
MSPDebug version 0.19 - debugging tool for MSP430 MCUs
Copyright (C) 2009-2012 Daniel Beer <dlbeer@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Trying to open UIF on /dev/ttyACM0...
Initializing FET...
uif: read error: Connection timed out
fet: open failed
Trying again...
Initializing FET...
uif: read error: Connection timed out
fet: open failed

I saw a question about a similar problem here, but as you see, the OP admits that he has no idea why it started working for him.

  1. I should run a minimal program. I got to the make step, included <msp430.h> instead of because the compiler suggested it. Then I got another error:

rumtscho@simak:~/Projects/had_launchpad-blink-master$ make msp430-gcc
-Os -Wall -g -mmcu=msp430g2553 -c main.c In file included from main.c:32:0:
/usr/lib/gcc/msp430/4.6.3/../../../../msp430/include/signal.h:43:2:
warning: #warning msp430-libc deprecated, using
[-Wcpp] main.c: In function ‘main’: main.c:65:11:
error: ‘TASSEL__ACLK’ undeclared (first use in this function)
main.c:65:11: note: each undeclared identifier is reported only once
for each function it appears in main.c:65:26: error: ‘MC__UP’
undeclared (first use in this function) main.c: In function
‘TIMERA0_ISR’: main.c:79:27: error: interrupt vector offset
‘TIMERA0_VECTOR’ is not an integer constant make: *** [main.o] Error 1

If I understand it correctly, the included library is deprecated, and so the variables it should contain are not found and the compiler thinks they are undeclared. But I don't know if this is the correct interpretation, and how to find the correct library to use.

As you can see, I'm quite over my head here. Can you suggest what next steps I could try? How do I start talking to the controller?

I am developing on Debian Wheezy, and installed all the packages suggested in various tutorials (everything with msp430 in the name, and a few others). I took the versions available in the Debian repository, did not compile from source.

Best Answer

Some things to look for that are common pitfalls under linux:

  • Check that there is nothing else using the serial port

On Ubuntu the program modem-manager tends to grab serial ports and break access to them from other programs. Remove it with sudo apt-get remove modemmanager.

On Debian brltty does a similar thing. It breaks all access to serial ports. Remove it with sudo apt-get remove brltty.

  • Remove the need for sudo by granting access to your normal user to the serial device

Adding a udev rules file will allow you to set the permissions on the /dev/ttyACM0 device automatically. Add the file /etc/udev/rules.d/50-launchpad.rules with the following in it:

ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0660", GROUP="plugdev"
ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f430", MODE="0660", GROUP="plugdev"

Then restart udev with: /etc/init.d/udev restart