MSP Programming

From Glacsweb Wiki
Revision as of 12:30, 15 July 2014 by Djap1g11 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MSP family msp430family and Sleep power

To use the MSP-FET430UIF under linux follow the instructions from http://mspdebug.sourceforge.net/download.html reprinted here for ease of use

Download source from http://sourceforge.net/projects/mspdebug/files

sudo apt-get install libusb-dev

extract tar ball

make WITHOUT_READLINE=1
sudo make install

To connect to the device using the MSP-FET programmer

mspdebug uif -d /dev/ttyUSB0 -j

you then do a "load progfile" if in this interactive mode or add that to the command line:

mspdebug uif -d /dev/ttyUSB0 -j "load progfile.glacsweb"

will load the binary - you need to reset after to run it (I think)


To get msp430-gcc working follow instructions from http://geeknews.me/tag/mspgcc/ (although with repo changed to git)

sudo apt-get install subversion gcc-4.4 texinfo patch \
libncurses5-dev zlibc zlib1g-dev libx11-dev libusb-dev \
libreadline6-dev git-core
git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4
cd mspgcc4 && sudo perl buildgcc.pl (Make sure you select a libc with the TI prefix in order to have support for the chipset)
echo "export PATH=${PATH}:/opt/msp430-gcc-4.4.4/bin" >> /etc/profile (as root

MSP430F5529

http://old.nabble.com/MSPGCC-and-MSP430F5529-td29587122.html

when building the tool chain select option 2 or 4 inorder (they have ti prefix) to have support for the chipset included

==Green dev boards== EM-CC430

Test code

#include <io.h>
void main(void)
{
   volatile unsigned int i;
   WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
   P1DIR |= BIT0;                            // P1.0 set as output 
   while(1)                                  // continuous loop
   {
     P1OUT ^= BIT0;                          // XOR P1.0
     for(i=50000;i>0;i--);                   // Delay
   }
}

Debugging

To setup and run with gdb: in your home dir you need a file .gdbinit

set remoteaddresssize 64
set remotetimeout 999
target remote localhost:2000
monitor erase all

in one terminal start the link:

mspdebug uif -d /dev/ttyUSB0 -j "gdb"

in another terminal:

msp430-gdb

LaunchPad programing

In order to use the launch pad to program devices download and install msp430-gcc and mspdebug as shown above

Then add

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

to

 /etc/udev/rules.d/46-TI_launchpad.rules

and restart udev (sudo restart udev)

Then to connect to programmer use

 mspdebug rf2500

and treat as normal, instructions adapted from [1]

20-bit addressing

Some devices in the MSP430 family have more than 64k RAM+ROM, meaning that 20-bit addressing is required. The MSP430X 20-bit extention allows up to 1MB of addressing. MSP430X is supported with msp430-gcc 4.7.0 20120322 or later.

Contiki

20-bit support was added to Contiki's master branch on Jun 17 2014.

"... will not fit in region ..."

This error suggests either 20-bit support has not be enabled, or that the code will not fit in 1 region. By default

 -mcode-region=far

is set. Attempting to place all the code in the far region of the ROM, causing the error should it not fit in only the far region. This can be fixed by removing the flag. If using Contiki, this can be done by removing it from the CFLAGS in

 cpu/msp430/Makefile.msp430