[Tinyos-help] odd problem on message_t
BAI LI
libai0915 at gmail.com
Tue Mar 3 20:03:27 PST 2009
Hi All,
I am currenting doing a very simple network test. I designed the message
structure in ****.h file and some sending functions in the following.
typedef nx_struct HashMsg {
nx_uint16_t nodeid;
nx_uint8_t flag;
nx_uint32_t payload_MD1;
nx_uint32_t payload_MD2;
nx_uint64_t payload_M;
nx_uint64_t payload_R;
nx_uint16_t payload_ID;
} HashMsg;
Part of the sending code is as folows:
event void Timer0.fired() {
uint16_t destinationMote=0x0002;
if (!busy) {
HashMsg* hmpkt =
(HashMsg*)(call Packet.getPayload(&pkt, sizeof(HashMsg)));
if (hmpkt == NULL) {
return;
}
hmpkt->flag=1;
hmpkt->nodeid = TOS_NODE_ID;
hmpkt->payload_MD1 = 0x12345678;
hmpkt->payload_MD2 = 0x90ABCDEF; // disable this line, it will work
hmpkt->payload_M=0x0000000000000000;
hmpkt->payload_R=0x0000000000000000;
hmpkt->payload_ID=0x0000000000000000;
if (call AMSend.send(destinationMote,
&pkt, sizeof(HashMsg)) == SUCCESS) {
call Leds.led0On();
busy = TRUE;
}
}
}
When the program loads the data to send. The program is dead with one more
line "hmpkt->payload_MD2 = 0x90ABCDEF";. I don't know what the problem is as
I have changed the #define TOSH_DATA_LENGTH to 35 in message.h which is
enough to handle the data. However it didn't work still. I suspect that it
could be message size problem. But I can't work it out. THanks.
Regards,
Bai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090304/ec2ec453/attachment.htm
More information about the Tinyos-help
mailing list