First I have to setup the MicaZ motes with the MIB510CA programmer board. The images below shows the Both instruments.
|MIB510 programmer board|
Preparing the compilation environment
To be able to compile TikiriDB application with the Contiki OS to the MicaZ motes platform, I have to prepare the development environment for it. I did this in a Ubuntu PC. We need the compiler tool chain for AVR microcontrollers. For that install these packages from a terminal.
sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc avrdude
Then we need a tool called uisp which helps to upload the compiled code to the MicaZ mote. I did some thing wrong here. First I apt-get installed the uisp package. But when I tried to compile Contiki, it terminated with an error saying,
"Direct Parallel Access not defined". So, I searched the web for this error and finally found this helpful page.
Somewhere in that page has mentioned that the official version of uisp tool which I installed doesn't work with MIB510 programmer boards. The modified version for TinyOS should be used according to it. So, I apt-get removed the installed uisp package and downloaded the TinyOS version of it from here. To install it, issue the commands showed below.
# tar -xvzf uisp.tar.gz # cd uisp # ./bootstrap # ./configure # make # sudo make installNow, the development environment is ready.
Setting up the hardware
I found this video useful to understand how to setup the hardware platform for programming a MicaZ mote. Follow the steps written below.
1. Put the mib510 programmer board's power switch in off position.
2. Plug power to the mib510 programmer board. The a green LED lights now.
Keep the power button off position.
3. Put a MicaZ mote switched off and plug it onto the mib510 programmer board.
4. Connect the mib510 programmer board to the PC with the provided serial to USB cable.
Now hardware is ready for our task.
Compiling and writing tikiriDB to MicaZ
Now I hope you have the source codes of both TikiriDB and Contiki OS. This article which I have written some time back may be helpful to understand something about TikiriDB. Follow these steps for compilation.
1. From a terminal goto test app directory of tikiridb source code and issue the command,
make TARGET=micaz test-app.upload PORT=/dev/ttyUSB0
If every things fine, the mote in the programmer board will get programmed with the compiled code of Contiki with the TikiriDB application.
2. From above way, burn 2 or more motes with tikiridb. Then keep one mote on the mib510 programmer board. Switch that mote and all the other motes on.
But the mib510 programmer board must remain switched off.
2. From another termianl goto serial forwarder directory and issue command,
./sf -s /dev/ttyUSB1 -b 115200 -p 10000
3. From another terminal goto tikirisql directory and issue command,
./tikirisql -H localhost -P 10000
Now TikiriDB is running. You can put queries in the terminal prompt of the third instruction above and get data.