Posts

Showing posts from 2008

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<---- span=""> DbgOut_P20_ON; r = logf((float)v / 10000.0); // takes up about 10 ms (!!) DbgOut_P20_OFF; ----8<---- span=""> and a ----8<---- span=""> DbgOut_P20_ON; r = powf (10,(float)v / 10000.0); // takes up about 32 ms (!!!!!!) DbgOut_P20_OFF; ----8<---- span=""> [/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). (

File Sharing between to PCs under Windows

Several times I badly needed the connection between to PCs and I never actually managed to make it working :( One thing I always forget to set is that both PCs have the same Workgroup, besides the part where you set your folder to be shared among PCs in the network.

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.