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

Sunday, May 10, 2009

SHIMMER sensors in SPINE 1.2 on TinyOS

Quicknotes for Cygwin installation:
(TODO: Edit to be something remotely usable in the near future!)

* install cygwin

* install appropriate tinyOS rpm's ($ cd /cygdrive/*drive*/*packageloc* )
* tinyos-tools-1.3.0-1.cygwin.i386.rpm seems to install and compile javatooling for TinyOS including running "tos-install-jni"which installs 32-bit java JNI code into the appropriate JRE.
* The SHIMMER platform requires the TI MSP430 Tool packages. install them with the command 'rpm -ivh --ignoreos '. Without --ignoreos rpm tells you that the package was intended for a cygwin_nt5.1 OS. Warning: installing the gcc package on cygwin, you'll get an error if the current user isn't "TinyOS", and it'll revert to using "root". Unsure of the effect of this sofar.

* Setup permissions and environment
$chown -R /opt/tinyos-2.x
$chmod 666 /dev/ for all necessary devices

* Add to ~/.bashrc:
export TOSROOT=/opt/tinyos-2.x
export TOSDIR=$TOSROOT/tos
export CLASSPATH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar`
#export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:. (linux)
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:$PATH
export CLASSPATH="$CLASSPATH;."

* Check environment setup:
$ tos-check-env *

* Create a /contrib/ folder in $TOSHOME. Copy Spine_nodes from the Spine 1.2 dist into tinyos-2.x-contrib folder
* Compile application through a-d. (SENSORBOARD=*boardtype* make *platform*)

At this time, platforms supported by SPINE1.2 are
a. Telosb motes with spine sensor board
SENSORBOARD=spine make telosb
b. Telosb motes with biosensor sensor board
SENSORBOARD=biosensor make telosb
c. Micaz motes with mts300 board
SENSORBOARD=mts300 make micaz
d. shimmer motes
SENSORBOARD=shimmer make shimmer

Without SENSORBOARD defined, make gives you "error: SENSORBOARD not defined"

* Appropriate compilation units are compiled to "contrib\apps\SPINEApp\build\shimmer"
* app.c
* ident_flags.txt
* main.exe
* main.ihex
* tos_image.xml

* Spine app is defined by the following interface / module:
(detailed information about the tinyos app files http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS)


configuration SPINEApp_AppC {
}

implementation {
components MainC, SPINEApp_C;

components RadioControllerC;
components PacketManagerC;
components SpineStartPktC;
components SpineSetupSensorPktC;
components SpineFunctionReqPktC;
components SpineSetupFunctionPktC;

components new TimerMilliC() as Annce_timer;

components SensorsRegistryC;
components SensorBoardControllerC;

components FunctionManagerC;

SPINEApp_C.Boot -> MainC.Boot;

SPINEApp_C.RadioController -> RadioControllerC;
SPINEApp_C.PacketManager -> PacketManagerC;
SPINEApp_C.SpineStartPkt -> SpineStartPktC;
SPINEApp_C.SpineSetupSensorPkt -> SpineSetupSensorPktC;
SPINEApp_C.SpineFunctionReqPkt -> SpineFunctionReqPktC;
SPINEApp_C.SpineSetupFunctionPkt -> SpineSetupFunctionPktC;

SPINEApp_C.SensorsRegistry -> SensorsRegistryC;
SPINEApp_C.SensorBoardController -> SensorBoardControllerC;

SPINEApp_C.FunctionManager -> FunctionManagerC;

SPINEApp_C.Annce_timer -> Annce_timer;

}



* SERVER SIDE (JAva)

java coordinator applicationss implement the SPINEListener interface. Contains:

void dataReceived(int nodeID, Data data)
void discoveryCompleted(java.util.Vector activeNodes)
void newNodeDiscovered(Node newNode)
void serviceMessageReceived(int nodeID, ServiceMessage msg)


Then, the application can use any APIs exposed by the SPINEManager (see some doc somewhere!)


* Create documentation : SENSORBOARD=shimmer make shimmer docs
* docs will be placed in : contrib\doc\nesdoc\shimmer as html documentation
* docs makes use of Graphviz for generating a componentgraph. If it's not found "sh: dot : command not found". Install package from (http://www.graphviz.org/Download..php). But which one?


Compiling SPINE_ServerApp:
Copy $TOSROOT/support/sdk/java/tinyos.jar to /SPINE_ServerApp/ext-lib/
run "Ant"

If appropriate COMport isn't defined, following error is produced:

run:
[java] serial@COM65:115200 died - exiting (java.io.IOException: Could not open COM65: TOSComm JNI library runtime error: Error 2.
[java] The system cannot find the file specified.
[java] in NativeSerialPort.CreateFile)
[java] Exception in thread "Thread-1" org.apache.tools.ant.ExitException: Permission (java.lang.RuntimePermission exitVM) was not granted.
[java] at org.apache.tools.ant.types.Permissions$MySM.checkExit(Permissions.java:196)
[java] at java.lang.Runtime.exit(Runtime.java:88)
[java] at java.lang.System.exit(System.java:906)
[java] at net.tinyos.packet.PhoenixSource.error(PhoenixSource.java:221)
[java] at net.tinyos.packet.PhoenixSource.run(PhoenixSource.java:174)

* SIMULATION (TOSSIM)

* run "make micaz sim" from tinyos /apps folders (like Blink) (micaz is the only platform supported by TOSSIM currently). Might requires some of the other native compilers. and definately JAVA (1.5). Exports a python interface.

Links:

http://www.physionet.org/physiotools/cygwin/
http://docs.tinyos.net/index.php/Installing_TinyOS_2.1#Manual_installation_on_your_host_OS_with_RPMs (2.1.0)
http://www.tinyos.net/tinyos-2.x/doc/html/install-tinyos.html (2.0.2)
http://ragemaster.livejournal.com/112000.html
http://docs.tinyos.net/index.php/Getting_Started_with_TinyOS
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2007-February/022355.html
https://www.millennium.berkeley.edu/pipermail/tinyos-help/
http://docs.tinyos.net/index.php/TOSSIM

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

No comments:

Followers