Example-Shell Guide
From ContikiWiki
TODO: Cross-check for contiki 2.5 release
The following is an extract from the Contiki tutorial given at the ACM/IEEE conference on Information Processing in Sensor Networks (IPSN) in April 2009.
[edit] Contiki Mote Shell
The Contiki shell is an interactive on-mote shell that provides a set of commands for interacting with the system. The shell can be accessed either over a serial USB connection or over a network using Telnet. In this tutorial, we first run the shell over a USB serial connection.
First, compile and upload the shell:
cd cd contiki/examples/sky-shell make sky-shell.upload
For 2.x Verion do this:
cd cd contiki-2.x cd examples cd sky-shell make sky-shell.upload
Wait for the compilation and uploading to finish. To connect to the shell over the USB port, run:
make login
Press the return key to get a prompt. (We have found that with Instant Contiki running in VMWare, garbage characters are sometimes printed out when connecting. They can be safely ignored.) Next, we try a few shell commands. To get a list of available commands, run:
help
Try a bunch of other commands:
help
sense | senseconv
power | powerconv
ls
format
echo test | write file
ls
read file
nodeid
blink 10
reboot
repeat 2 2 { echo again } &
ps
The power command prints out the current power profile from Contiki's software-based power profiler. To print out the power profile in decimal digits, run:
power | binprint
The output will look something like: 12 236 0 37421 0 4 0 380 0 0 0 380 0
The numbers that the power command outputs are:
- The number of data items that follow, to make automatic parsing of the output easier
- CPU low-power mode time, least significant 16 bits
- CPU low-power mode time, most significant 16 bits
- CPU active mode time, least significant 16 bits
- CPU active mode time, most significant 16 bits
- Radio transmission time, least significant 16 bits
- Radio transmission time, most significant 16 bits
- Radio listen time, least significant 16 bits
- Radio listen time, most significant 16 bits
- Radio transmission time in idle listening, least significant 16 bits
- Radio transmission time in idle listening, most significant 16 bits
- Radio listen time in idle listening, least significant 16 bits
- Radio listen time in idle listening, most significant 16 bits
The output of the power command can be used to compute an estimate of the mote's power consumption by multiplying the time with pre-measured current draw metrics [11]. Because the power command only measures the time during which the peripherals are switched on, the power consumption estimate is not affected by environmental noise such as temperature differences nor by noise due to subtle differences between different versions of hardware.