TinyOS programming for Tmote Zigbee radio
- . Installing TinyOS 2.1 on Ubuntu 9.10:
Install Ubuntu 9.10 and run full updates.
Add the TinyOS repository to your list of packages start by opening sources.list
sudo gedit /etc/apt/sources.list
Add the following line at the bottom of sources.list
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main
Update sources.list by typing
sudo apt-get update
Install TinyOS 2.1
sudo apt-get install tinyos-2.1.0
You should get two questions answer yes to both. During the install you will have to say OK
and Yes to EULA information
Edit your ~/.bashrc file in your home directory to set up the environment for TinyOS
development at login
sudo gedit ~/.bashrc
Add the following two lines:
source /opt/tinyos-2.1.0/tinyos.sh export CLASSPATH=$TOSROOT/support/sdk/
java/tinyos.jar:.
(NOTE: the . at the end is intentional)
Save and exit the .bashrc file Next run the command
source ~/.bashrc
Run the following to prevent errors with java apps
sudo tos-install-jni
If you are getting any errors running make on the nesC files run the following...
sudo apt-get install g++ sudo apt-get install python2.5-dev
-. Setting up for CC2420 (disable CRC):
1. Modify CC2420ActiveMessageP.nc in /opt/tinyos-2.1.0/tos/chips/CC2420
remove line 173-175:
//if(!(call CC2420PacketBody.getMetadata(msg))->crc) {
// return msg;
//}
2. Modify CC2420ReceiveP.nc in /opt/tinyos-2.1.0/tos/chips/CC2420/receive
modify line 294-303:
// We may have received an ack that should be processed by Transmit
// buf[rxFrameLength] >> 7 checks the CRC
if (rx_buf ) {
uint8_t type = ( header->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7;
signal CC2420Receive.receive( type, m_p_rx_buf );
post receiveDone_task();
return;
}
-. Compile the codes into the Tmote chip
3. install code to Base Station:
$ cd RssiBase
$ make tmote clear
$ make tmote
$ make tmote install,0 mib510,/dev/ttyUSB0
Note that: ttyUSBX is determined by running the command of “motelist”
4. install code to Sending Station:
$ cd SendingMote
$ make tmote clear
$ make tmote
$ make tmote install,1 mib510,/dev/ttyUSB0
4. Compile C code (for processing the data in Base Station):
$ gcc main.c libmote.a -o main -lm
5. Execute
$ ./main /dev/ttyUSB0 115200