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:
- 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 <[email protected]>
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.
- I should run a minimal program. I got to the
make
step, included <msp430.h>
instead of <io.h> because the compiler suggested it. Then I got another error:
rumtscho@simak:~/Projects/had_launchpad-blink-master$ make
msp430-gcc -Os -Wall -g -mmcu=msp430x2012 -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 <signal.h> deprecated, using
<legacymsp430.h> [-Wcpp]
In file included from /usr/lib/gcc/msp430/4.6.3/../../../../msp430/include/legacymsp430.h:34:0,
from /usr/lib/gcc/msp430/4.6.3/../../../../msp430/include/signal.h:45,
from main.c:32:
/usr/lib/gcc/msp430/4.6.3/../../../../msp430/include/msp430.h:813:2:
warning: #warning Unable to identify and include MCU header, use
-mmcu=MCU [-Wcpp]
main.c: In function ‘initLEDs’:
main.c:43:3: error: ‘P1DIR’ undeclared (first use in this function)
main.c:43:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:43:14: error: ‘BIT0’ undeclared (first use in this function)
main.c:43:21: error: ‘BIT6’ undeclared (first use in this function)
main.c:44:3: error: ‘P1OUT’ undeclared (first use in this function)
main.c: In function ‘main’:
main.c:50:3: error: ‘WDTCTL’ undeclared (first use in this function)
main.c:50:12: error: ‘WDTPW’ undeclared (first use in this function)
main.c:50:20: error: ‘WDTHOLD’ undeclared (first use in this function)
main.c:63:3: error: ‘BCSCTL3’ undeclared (first use in this function)
main.c:63:14: error: ‘LFXT1S_2’ undeclared (first use in this function)
main.c:65:3: error: ‘TACTL’ undeclared (first use in this function)
main.c:65:11: error: ‘TASSEL__ACLK’ undeclared (first use in this function)
main.c:65:26: error: ‘MC__UP’ undeclared (first use in this function)
main.c:66:3: error: ‘TACCTL0’ undeclared (first use in this function)
main.c:66:13: error: ‘CCIE’ undeclared (first use in this function)
main.c:67:3: error: ‘TACCR0’ undeclared (first use in this function)
main.c:72:3: error: ‘GIE’ 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
main.c:80:3: error: ‘P1OUT’ undeclared (first use in this function)
main.c:80:15: error: ‘BIT0’ undeclared (first use in this function)
main.c:80:22: error: ‘BIT6’ undeclared (first use in this function)
make: *** [main.o] Error 1
If I understand it correctly, the included library is deprecated, but I have no idea how to find which is the correct library to include instead. I also don't know what a MCU is, so don't know if the warning about the -mmcu
flag is important, and how to correct the problem.
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.