2011年6月7日星期二

make tinyos by guanbo

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

2011年4月21日星期四

2011年3月17日星期四

install usrp2 version bbn in ubuntu10.10

Why I use usrp2 version bbn code? Because I need help guanbo debug a problem.

I use GNU radio 3.2.2 + usrp2 version bbn code + ubuntu 10.10.
The install procedure is the same as install bbn in ubuntu10.04.
I download through
svn co https://www.cgran.org/cgran/projects/bbn_80211

I run bbn_80211_test.py, but fail.
I try the packet guanbo emailed me. This works! I only chmod some script to make it installed.
I try to diff the two package, but the difference is too much. I can not figure out the key difference.

2010年11月28日星期日

install bbn and gr3.2.2 in ubuntu10.04

building bbn needs omnithread.h. However, this file is obsolete in gr3.3.
I'd better use gr3.2.2, as guanbo and many discussions suggest.

I download gr3.2.2 from http://ftp.gnu.org/gnu/gnuradio/
first, building 3.2.2 ends with error.

libtool: Version mismatch error.  This is libtool 2.2.6b Debian-2.2.6b-2ubuntu1, but the
libtool: definition of this LT_INIT comes from libtool 2.2.6.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6b Debian-2.2.6b-2ubuntu1
libtool: and run autoconf again.
make[4]: *** [realtime.lo] 错误 63

I try to understand autoconf. I delete aclocal.m4 and run ./bootstrap again.
This time, it passes the "mismatch" error, but ends with another error.
this error is also found at http://www.ruby-forum.com/topic/213656
I delete all the ./gnuradio-3.2.2/gr-qtgui/src/lib/*moc.cc file and run ./configure and make again.
 finally, gr3.2.2 is built successfully in ubuntu10.04

Then, I try to build bbn. when building bbn_tap.cc, it ends with some error. It indicates some functions missed, including "memset", "stderr", ...

Man command will indicate what header files I should include, such as "man memset". Thus, I add these two lines to bbn_tap.h.
#include "stdio.h"
#include "string.h"
bbn building is OK too.
now let me solve the hier_block2 issue.

With a little patience, I transfer the hier_block to hier_block2. Now, I have better understanding of hier_block2.

sudo ./bbn_80211b_rx.py -d 8 -f 2472e6 -b -p -v -R A:0
I read the README file in bbn package.
this command will start receiver. I configure my wireless router to work in 802.11b only mode with 1000ms beacon interval.

and it prints
PKT: len=10, rssi=-13, src=UNKNOWN, time=61218432, rate=1 Mbps
PKT: len=26, rssi=-39, src=00:27:13:e4:9C:C5, time=61219032, rate=1 Mbps
PKT: len=10, rssi=-15, src=UNKNOWN, time=61219464, rate=1 Mbps
PKT: len=129, rssi=-43, src=94:0c:6d:56:B7:8A, time=61433040, rate=1 Mbps
PKT: len=141, rssi=-13, src=74:ea:3a:b9:7E:6A, time=61475656, rate=1 Mbps
PKT: len=129, rssi=-42, src=94:0c:6d:56:B7:8A, time=61944976, rate=1 Mbps
...

2010年11月25日星期四

grub trouble

this morning, I did an upgrade of ubuntu. During upgrading, I clicked a "grub xx hard disk...". Then, my computer is stuck after restart, directly entering "grub rescue“。

solved in this way:
create an ubuntu startup disk

start from "usb hard disk"
#sudo apt-get install lilo
#sudo lilo -M /dev/sda mbr
it seems grub and lilo are contradictory.

2010年11月23日星期二

usage of scrambler_bb in gnuradio

from this page
http://gnuradio.org/doc/doxygen/gri__lfsr_8h-source.html
I know

00029 /*!
00030  * \brief Fibonacci Linear Feedback Shift Register using specified polynomial mask
00031  * \ingroup misc
00032  *
00033  * Generates a maximal length pseudo-random sequence of length 2^degree-1
00034  * 
00035  * Constructor: gri_lfsr(int mask, int seed, int reg_len);
00036  *  
00037  *      mask - polynomial coefficients representing the locations
00038  *             of feedback taps from a shift register which are xor'ed
00039  *             together to form the new high order bit.
00040  *
00041  *             Some common masks might be:
00042  *              x^4 + x^3 + x^0 = 0x19
00043  *              x^5 + x^3 + x^0 = 0x29
00044  *              x^6 + x^5 + x^0 = 0x61
00045  *
00046  *      seed - the initialization vector placed into the register
00047  *             durring initialization.   Low order bit corresponds
00048  *             to x^0 coefficient -- the first to be shifted as output.
00049  *
00050  *   reg_len - specifies the length of the feedback shift register 
00051  *             to be used.   Durring each iteration, the register
00052  *             is rightshifted one and the new bit is placed in bit reg_len.
00053  *             reg_len should generally be at least order(mask) + 1
00054  *
00055  *
00056  * see http://en.wikipedia.org/wiki/Linear_feedback_shift_register 
00057  * for more explanation.
 
However, in this page, a different view is introduced. 
http://www.mail-archive.com/patch-gnuradio@gnu.org/msg00180.html
For Gal', one only has to use the binary representation (e.g. x^4+x^3+1 => 
2^4+2^3+1 = 0x19) and shift it one bit left ( 0x13>>1 = 0x9).
For Fib, the following has to be done: Reverse the binary representation (0x19 
= 11001 => 10011), strip the highest bit. The resulting parameters for the 
lfsr are (mask=0x3, len=(degree-1)=3). (Yes, this is somewhat contrary to the 
comments in gri_lfsr.h. IMHO, the documentation is wrong/misleading. Most 
noteworthy, the len paramater is not the register len, but the bitshift).
- Internal state of the two types differs. For self synchronizing 
applications, this is a non issue, for synchronous operation, either use the 
same type, or calculate the corresponding seed values for both types.