Wednesday, November 30, 2011

MSPSIM to the rescue

I had a very difficult time getting the MSP-FET430UIF to work with the telosB platform. Fortunately, I found mspsim while doing my research on finding a solution to resetting the flash memory on the telosB platform. 

mspsim is a java based simulator for the tmote sky platform. The good news is that the tmote sky platform is almost identical to the telosB platform. Sentilla, the manufacturer of tmote sky, outlined the differences between tmote sky and telosB in the following document.

I can now finally run my nanoRK program on the simulator instead of physically downloading it to the telosB platform.

mspsim. Image taken from http://sourceforge.net/projects/mspsim/screenshots/151017

According to the mspsim website, "MSPsim is a Java-based instruction level emulator of the MSP430 series microprocessor and emulation of some sensor networking platforms. Supports loading of IHEX and ELF firmware files, and has some tools for monitoring stack, setting breakpoints, and profiling."



Sunday, November 27, 2011

Building a JTAG Circuit

The TI MSP430F1611 processor comes with JTAG pins that can be used for programming or debugging.

It is unfortunate that the telosB platform do not have a ready made JTAG connector onboard. Therefore, I had to resort to soldering male pins onto the telosB platform in order to connect a TI MSP430 USB Debugging Interface (MSP-FET430UIF) to the telosB platform.


The picture on the left shows the telosB platform with the soldered male headers.


MSP-FET430UIF that enables debugging on the MSP430F1611 chip via USB

Pin output from the MSP-FET430UIF does not match the male pin headers on the TelosB platform

I encountered another problem after soldering the male pin headers on the telosB platform. The JTAG connector on the telosB platform requires another circuit before it can be connected to the MSP-FET430UIF.

Instructions to build this circuit are given on Page 25 of MSP Hardware Tools User's Guide

In a desperate attempt to reset the flash memory on the telosB platform, I quickly built the circuit to connect  the MSP-FET430UIF to telosB.



In comparison, the Firefly board has a custom made debugger board that enables a developer to debug as well as program the Firefly board.

Firefly Debugger Board





Thursday, November 17, 2011

Pin Mappings Fiasco

The TelosB platform can be programmed using the bootstrap loader (msp430-bsl). This is the method that TinyOS uses in order to download a program onto the telosB platform.

During my course of changing the pin mappings in nanoRK to fit the telosB platform, I accidentally changed the pin mappings that are responsible for the boot strap loader (BSL) and uploaded a copy of this faulty program onto the telosB platform.

Programming via the BSL stopped working after I uploaded the faulty program. The telosB mote timeouts whenever I tried to program it using the BSL.


user@user-Vostro-1400:~$ motelist
Reference  Device           Description
---------- ---------------- ---------------------------------------------
XBTO6HS3   /dev/ttyUSB0     XBOW Crossbow Telos Rev.B

     
user@user-Vostro-1400:/opt/tinyos-2.1.1/apps/Blink$ make telosb install
mkdir -p build/telosb
   compiling BlinkAppC to a telosb binary
ncc -o build/telosb/main.exe  -Os -O -mdisable-hwmul -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"tleong\" -DIDENT_HOSTNAME=\"tleong-Vostro-1\" -DIDENT_USERHASH=0xf6d09153L -DIDENT_TIMESTAMP=0x4ed53eceL -DIDENT_UIDHASH=0x3c06c8f9L  BlinkAppC.nc -lm
   compiled BlinkAppC to build/telosb/main.exe
           2648 bytes in ROM
             54 bytes in RAM
msp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex
   writing TOS image
cp build/telosb/main.ihex build/telosb/main.ihex.out
   found mote on /dev/ttyUSB0 (using bsl,auto)
   installing telosb binary using bsl
tos-bsl --telosb -c /dev/ttyUSB0 -r -e -I -p build/telosb/main.ihex.out
MSP430 Bootstrap Loader Version: 1.39-telos-8
Mass Erase...

An error occurred:
Timeout
make: *** [program] Error 1

      
It actually took me a while to figure out that the pin mappings of the BSL was causing this problem. I first thought the mote was faulty but my the second telosB mote also showed the same symptom after being reprogrammed with the faulty program.

Therefore, programming via the BSL was not a viable option anymore. I had to resort to using the JTAG debugger/programmer to do so. I will talk more about this in my next posting.

Friday, November 11, 2011

First Program, Blink.nc

Before attempting to port nanoRK directly onto telosB, I would like to test my telosB motes by running a sample TinyOS program.

Blink.nc is a TinyOS program that instructs each of the LED on the telosB platform to blink.

The following command builds the executable for the Blink.nc program
>> make telosb install


Image taken from: http://openwsn.berkeley.edu/wiki/OpenHardwareSoftware


http://www.tinyos.net/

This simple program compiled successfully and runs without problems on the TelosB platform.





Saturday, November 5, 2011

Learning the telosB platform

The telosB platform consists of:
TI MSP430F1611 Processor
CC2420 Radio
LEDs
Humidity Sensor

The TI MSP430F1611 processor is a 8MHz 16 bit RISC processor with sixteen 16 bits registers, 12 of which are general multipurpose registers. It has 48KB of Flash Memory and 10KB of RAM. In addition, it has support for:
Watchdog timer
16-bit Timer A with 3 capture/compare registers
16-bit Timer B with 3 capture/compare registers
UART
JTAG
Direct Memory Access (DMA)
Bootstrap Loader (BSL)
Analog to Digital Converter (ADC)
Digitally Controlled Oscillator (DCO)

Hardware Multiplier

More information can be found on TI's website

There are currently a few RTOS in the market that supports the telosB platform. They are:
TinyOS
Contiki
MantisOS

My goal is to port the nanoRK RTOS over to the telosB platform so that nanoRK programs can run on the telosB platform.