Posts

Showing posts with the label tinyos

TOSSIM Python compiling problem

When you use TOSSIM in TinyOS, you come up to this error: In function ‘void SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, swig_type_info**)’ error: invalid conversion from ‘const char*’ to ‘char*’ (overall there are two errors like this one) First check whether the error can be solved using solution on TinyOS wiki website on TOSSIM . If even than, it doesn't work, go to $TOSROOT/tos/lib/tossim and run ./generate-swig.bash In my case, it shows you some warnings, but that is ok. afterwards, it worked fine for me. If you still have troubles, check also: python and python-dev should be on the same version, swig should be installed. If all this didnt solve your problems, good luck finding it, and I hope you put the solution somewhere on internet as well.

Same useful links while learning TinyOS

http://www.eecs.iu-bremen.de/wiki/index.php/TinyOS

Changing parameters in TinyOS via Makefile

Changing the Radio channel - Radio channel numbers have range between 11 to 26 - Add the following line in the Makefile before the Makerules CC2420_CHANNEL=x where x = [11 26] Changing the Radio Transmit power - Transmit power valid levels are 1 to 31 with power 1 equals to -25dBm and 31 equals to max (0dBm) - add the following line in the Makefile before the Makerules CFlags = -DCC2420_DEF_RFPower= x where x = [1 31] Changing the Active message group ID Add DEFAULT_LOCAL_GROUP = X to the makefile where X = [0×10 0×50]

Working with floating point in TinyOS

There are two ways to represent float in nesc. One way, is to do it through by convention using the exponent and mantissa, where you need to use 2^exponent. The function that does that is called powf(). The problem with using that function is that it is reaaaaallly slow. [QUOTE] ----8 DbgOut_P20_ON; r = logf((float)v / 10000.0); // takes up about 10 ms (!!) DbgOut_P20_OFF; ----8 and a ----8 DbgOut_P20_ON; r = powf (10,(float)v / 10000.0); // takes up about 32 ms (!!!!!!) DbgOut_P20_OFF; ----8 [/QUOTE] In case you need to have fast response, this function might not be your choice. One way to optimize the speed of those operations are: "I'd like to mention that pow (a,b) is MUCH harder to implement than exp(b). Use the latter whenever possible. In particular, if a is fixed, use exp(b * log(a)) rather than pow (a,b). ( In fact, that's a common low-precision implementation technique even when a is not fixed.) Also note that keeping ...

Finally, clear explanation of TinyOS 2.x serial packet structure

Image
TinyOS 2.x A message sent through serial ports from motes to PC will typically look like this: 00 FF FF 00 00 08 00 09 19 77 02 07 00 13 00 00 The first byte 00 is the leading zero. After that, the whole packet is of the type " serial_packet_t ", defined in tinyos-2.x/tos/lib/serial/Serial.h . Inside the serial_packet_t structure, the first 7 bytes are of the type " serial_header_t" , which is also defined in tinyos-2.x/tos/lib/serial/Serial.h . In the case above, it would be FF FF 00 00 08 00 09 . Within the "serial_header_t", the following structure takes place: nx_am_addr_t dest // Destination (2 bytes) nx_am_addr_t src // Source (2 bytes) nx_uint8_t length // Payload Length (1 byte) nx_am_group_t group // Group ID (1 byte) nx_am_id_t type // Active Message Handler Type (1 byte), some enum value that you can def...

XUBUNTOS

Some really nice people has made cool Linux Live CD which has TinyOS installed. Really cool for people who need the TinyOS fast! This is the version with TinyOS 2.x http://toilers.mines.edu/Public/XubunTOS

Changing communication channel and RF Power

To change default communication channel and RF Power you can either: 1) edit opt/tinyos-1.x/tos/lib/CC2420Radio/CC2420Const.h CC2420_DEF_CHANNEL 11 (this is default value) CC2420_DEF_RFPOWER 0x1f (31, maximum, if you for example want to test multihop routing easiest way is to make RFPOWER smaller) 2) add line in Makefile CC2420_DEF_CHANNEL = 11 CC2420_DEF_RFPOWER= 0x1f 3) change it in program by colling function from CC2420Control interface, called: SetRFPower(uint8_t power);

TinyOS little help

Last 2 months I was actively working in TinyOS, and since there's no better place than internet to put solutions to problems which most likely you will forget in near future, I will write here some little things about TinyOS. In general, that was the main idea of this blog. Quite recently I started with Linux, which have as usual, a lot of difficulties with drivers; you find a number of solutions which maybe one or maybe none is working. Yes this is also public cause I support idea of helping people with similar problems over internet. That is just my gratitude for all those nice people who helped me simply by posting their solutions on forums and other public places.