Tuesday, August 23, 2011

Running Contiki on MSPSIM simulator

Running with lack of hardware is a big issue for people who are working in wireless sensor network related areas. Before burning a program into real hardware it is necessary to test the programs we write whether everything is OK. This is where hardware simulators are useful.

MSPSIM is a tool which can emulate Texas Instruments MSP430 micro-controller based sensor motes from the instruction level. It can be used independently or with the Contiki operating system. When writing programs for Contiki operating system and hopes to run these programs in MSP430 based sensor motes like MSB430, Tmote Sky, ESB, etc we can use MSPSIM simulator.

Running your Contiki programs on MSPSIM is really easy. Goto the examples directory of the Contiki operating system from the terminal and issue the following commands. (If you don't have Contiki source yet, download it first from here)

cd contiki-2.x/examples/hello-world/

make TARGET=sky hello-world.mspsim

By the second command, the hello-world program will be compiled into Tmote Sky motes platform and will run that executable code on MSPSIM simulator. These images shows what you will see in newly opened windows.

In the USART Port Output window you will see the hello-world programs output. It prints Hello, world! To exit the program type
on the command line prompt.

You can even compile the program into ESB motes platform. For that, you have to issue the command as,

make TARGET=esb hello-world.mspsim

This is the ESB motes window that you will see.

There are lot of things that you can do with the MSPSIM simulator. You can learn more things in the web. This is a good resource to learn about MSPSIM.

1 comment: