[Tinyos-help] Crc Interface in BlinkToRadio application
Dinesh Koya
dinesh_eric03 at yahoo.co.in
Wed Aug 27 02:48:38 PDT 2008
Hi all
I tried to use the Crc interface in the BlinkToRadio application
to calculate the crc for the packets.
For this I modified the BlinkToRadio.h as below
#ifndef BLINKTORADIO_H
#define BLINKTORADIO_H
enum
{
TIMER_PERIOD_MILLI = 250,
AM_BLINKTORADIOMSG = 6
};
typedef nx_struct BlinkToRadioMsg
{
nx_uint16_t nodeid;
nx_uint16_t counter;
nx_uint16_t crc; // this was included
}
BlinkToRadioMsg;
#endif
Then I modified the event void Timer0.fired(); block of
BlinkToRadioC file as below
#include <crc.h> // this was included
uses interface Crc; // this was included
event void Timer0.fired()
{
counter++;
//call Leds.set(counter);
if (!busy)
{
BlinkToRadioMsg* btrpkt =
(BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL));
btrpkt -> nodeid = TOS_NODE_ID;
btrpkt -> counter = counter;
btrpkt -> crc = crc; // this was included
/* command uint16_t crc16(void* buf, uint8_t len); */
crc = call Crc.crc16(&pkt,4); // this was included
if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof(BlinkToRadioMsg)) == SUCCESS)
{
busy = TRUE;
}
}
}
Here I did not get rightly what to pass as the 2nd parameter
which is uint8_t len for crc16 command, so I just tried out with 4
and then I got the following result when two tmotes were running
BlinkToRadio with node id's 1 and 2 and one tmote with
BaseStation running with node id as 0.
(nodeid)(counter)(crc16)
00 FF FF FF FF 06 00 06 00 01 00 01 00 00
00 FF FF FF FF 06 00 06 00 02 00 01 00 00
00 FF FF FF FF 06 00 06 00 01 00 02 00 00
00 FF FF FF FF 06 00 06 00 02 00 02 00 00
00 FF FF FF FF 06 00 06 00 01 00 03 4E 63
00 FF FF FF FF 06 00 06 00 02 00 03 4E 63
00 FF FF FF FF 06 00 06 00 01 00 04 5E 42
00 FF FF FF FF 06 00 06 00 02 00 04 5E 42
00 FF FF FF FF 06 00 06 00 01 00 05 6E 21
00 FF FF FF FF 06 00 06 00 02 00 05 6E 21
00 FF FF FF FF 06 00 06 00 01 00 06 7E 00
00 FF FF FF FF 06 00 06 00 02 00 06 7E 00
00 FF FF FF FF 06 00 06 00 01 00 07 0E E7
00 FF FF FF FF 06 00 06 00 02 00 07 0E E7
00 FF FF FF FF 06 00 06 00 01 00 08 1E C6
00 FF FF FF FF 06 00 06 00 02 00 08 1E C6
00 FF FF FF FF 06 00 06 00 01 00 09 2E A5
00 FF FF FF FF 06 00 06 00 02 00 09 2E A5
00 FF FF FF FF 06 00 06 00 01 00 0A 3E 84
00 FF FF FF FF 06 00 06 00 02 00 0A 3E 84
I would like to know what exactly is to be passed to 2nd
parameter of crc16 command and also based on the parameter
how is the crc calculated, i.e for what lenght of the packet?
I also included the wiring in BlinkToRadioAppC as
components CrcC; //this was included
App.Crc -> CrcC; //this was included
Could some one help me with this
Thanks for any help
Regads
Dinesh
Download prohibited? No problem. CHAT from any browser, without download. Go to http://in.webmessenger.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080827/ba818cf5/attachment.htm
More information about the Tinyos-help
mailing list