[Tinyos-help] A possible bug in BaseStation application, TinyOS 2.1.0
Dongzhen Piao
parkurm at gmail.com
Wed Jun 17 22:58:34 PDT 2009
Hi all,
I was writing a simple program to send commands from a base station to
sensor motes. I defined several fields in the command packet, and set them
to predefined command value before sending the packet.
But when the sensor motes received the command message, all the fields are
0. After a long period of debugging, I finally found that the problem
happens in the standard BaseStation application shipped with TinyOS 2.1.0.
Here's the function in BaseStationP.nc file, where the problem occurs:
task void radioSendTask() {
uint8_t len;
am_id_t id;
am_addr_t addr,source;
message_t* msg;
atomic
if (radioIn == radioOut && !radioFull)
{
radioBusy = FALSE;
return;
}
msg = radioQueue[radioOut];
len = call UartPacket.payloadLength(msg);
addr = call UartAMPacket.destination(msg);
source = call UartAMPacket.source(msg);
id = call UartAMPacket.type(msg);
* call RadioPacket.clear(msg);*
call RadioAMPacket.setSource(msg, source);
if (call RadioSend.send[id](addr, msg, len) == SUCCESS)
call Leds.led0Toggle();
else
{
failBlink();
post radioSendTask();
}
}
In the line bolded, the function clears all fields in the packet received
from UART, and forwards it to the radio. *The behaviour is strangely set to
clear the packet, which is not desirable in such a "bridging" application.*
After commenting out the line, my program worked just fine.
Does anybody have some idea about this? Is this a bug, or is this some
behaviour desired by the application author?
Thanks.
Dongzhen Piao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090618/e6af12f7/attachment.htm
More information about the Tinyos-help
mailing list