{Notes to self, programming, technology, linux, windows, git} U {Papers, reviews, games, coffee, tabletennis, ramblings} = {things worth saving}

Friday, May 22, 2009

Flash spine network of shimmer nodes + simple test app

* make shimmer install bsl, /dev/ttyUSB0 (/apps/BaseStation, /contrib/apps/SpineApp - as many sensors as required)

synchronize channel in makefiles:

#radio channel for TX-RX (spine default so change in BS)
PFLAGS += -DCC2420_DEF_CHANNEL=12


* Run tinyos software listener manually:
$ java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:shimmer

(you need to build libgetenv and libtoscomm from your tinyos before you can install and run any SPINE application.
cd $TOSROOT/support/sdk/java && make (if its not already built?)
sudo tos-install-jni ) - what spine doc means is that tos-install-jni will do the above for you, install libtoscomm in your java JRE

sometimes lobtoscomm-32.so and libgetenv.so aren't build.

If you have not installed the tools RPM and are working directly from the TinyOS CVS repository, you can manually install the tos-locate-jre script. Go to tinyos-2.x/tools/tinyos/java. If the directory has a Makefile in it, type make and (again, on Linux, as superuser) make install. If the directory does not have a Makefile, go to tinyos-2.x/tools and type:

$ ./Bootstrap
$ ./configure
$ make
$ make install

notice where the .so files get copied, and notice how they're named, and where the tos-install-jni script expects them to be. (search and edit)

finally do --- tos-install-jni

Now you can start the listeners

http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder#Cannot_find_JNI_error

)

tells Listen to use the serial port /dev/ttyS0 (on a UNIX machine) at the correct speed for a shimmer mote.

in general:   serial@*PORT*:*SPEED*

PORT depends on your platform and where you have plugged the mote in. For Windows/Cygwin platforms, it is COMN, where N is the port number. For Linux/UNIX machines, it is /dev/ttySN for a built-in serial port, or one of /dev/ttyUSBN or /dev/usb/tts/N for a serial-over-USB port. Additionally as we saw in lesson 1, on Linux you will typically need to make this serial port world writeable. As superuser, execute the following command:

chmod 666 serialport

*

One problem with directly using the serial port is that only one PC program can interact with the mote. Additionally, it requires you to run the application on the PC which is physically connected to the mote. The SerialForwarder tool is a simple way to remove both of these limitations.

Most generally, the SerialForwarder program opens a packet source and lets many applications connect to it over a TCP/IP stream in order to use that source. For example, you can run a SerialForwarder whose packet source is the serial port; instead of connecting to the serial port directly, applications connect to the SerialForwarder, which acts as a proxy to read and write packets. Since applications connect to SerialForwarder over TCP/IP, applications can connect over the Internet.

SerialForwarder is the second kind of packet source. A SerialForwarder source has this syntax:

sf@HOST:PORT

The first step is to run a SerialForwarder; since it takes one packet source and exports it as an sf source, it takes a packet source parameter just like the other tools we've used so far: you can pass a -comm parameter, use MOTECOM, or just rely on the default. Close your MsgReader application so that it no longer uses the serial port, and run a SerialForwarder:

java net.tinyos.sf.SerialForwarder (GUI)
set motecom to serial@/dev/ttyUSB0:shimmer

or

java net.tinyos.sf.SerialForwarder -port 9003 -comm sf@localhost:9002 (this last part is the source)
This command opens a second SerialForwarder, whose source is the first SerialForwarder. You'll see that the client count of the first one has increased to one. It's rare that you'd ever want to do this, but it demonstrates that in the message support libraries you can use a variety of packet sources.


(http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder)
* Spine_serverSide/defaults.properties :
MOTECOM=sf@127.0.0.1:9002 (supply this to tinyos )
LocalNodeAdapter_ClassName=spine.communication.tinyos.SFLocalNodeAdapter

* Run Spine_serverSide/test/SPINETest.java to test!


* VMWARE player - dhcp router? then set Ethernet to NAT and enable network. (eth1)


* Installation tips: http://docs.tinyos.net/index.php/Boomerang_Tmote_Linux_install

No comments:

Followers