Hello,
Platform: CrossbowTelos (Rev B 2004/09/27)
Operating system: TinyOS 2.0.2 (downloaded from CVS 2008.04.23)
Is it possible, that after calling "call Send.send(&packet, sizeof(data_t))"
that resulted in SUCCESS the event "event void Send.sendDone(message_t* m,
error_t err)" is not signaled?
I have an application, based on EasyCollection, that takes data form
integrated sensors and sends it 4 times per second. There is three motes:
base (packet sniffer), root and sender.
When mote executes SendMsgTask() and finds flag radioSendBusy TRUE, it
toggles red led (it means, packet will not be send). When mote successfully
calls Send.send(&packet, sizeof(data_t)), it toggles green led. When there
is event void Send.sendDone(message_t* m, error_t err) signaled without
SUCCESS in err, mote turns on blue led.
Normally the green led is blinking and data is received at PC. If I turn off
the root, sending mote starts retransmitting data. During this time I can
see red diode blinking few times, this indicates that there is radioSendBusy
set to TRUE. So, during this blinking, event Send.sendDone(message_t* m,
error_t err) fires and because there was no ACK from root, the blue led is
turn on. This is also normal behavior.
But I can find a place in my office (about 10 meter away from a root and
there is no walls between) when I see something strange: the green led is
constantly on or off, the red led is toggling meaning that mote wants to
send data but finds radioSendBusy set to TRUE, and the blue one never comes
to on state. So, I think that event void Send.sendDone(message_t* m, error_t
err) is never fired. Why?
Interesting source code:
data_t data; // for storing data from sensors
bool radioSendBusy; // shows if radio is busy or not
// Data sending rate: 4 times per second.
//--------------------------------------------------------------------------------
event void SamplingTimer.fired() {
post sendMsgTask();
}
//--------------------------------------------------------------------------------
task void sendMsgTask() {
data_t* msg;
am_addr_t parent;
if (!radioSendBusy) {
if (call Info.getParent(&parent) == SUCCESS)
data.parent = parent;
else
data.parent = 0xffff;
msg = (data_t*)call Send.getPayload(&packet, sizeof(data_t));
memcpy(msg, &data, sizeof data);
if (call Send.send(&packet, sizeof(data_t)) == SUCCESS) {
radioSendBusy = TRUE;
call Leds.led1Toggle();
}
else {
call Leds.led0On(); // turn on RED led; Failed to send data!
}
}
else {
call Leds.led0Toggle(); // turn on RED led; Failed to send data!
}
}
//--------------------------------------------------------------------------------
event void Send.sendDone(message_t* m, error_t err) {
if (err != SUCCESS)
call Leds.led2On(); // turn on BLUE led; Failed to send data or
to get ACK!
radioSendBusy = FALSE;
}
//--------------------------------------------------------------------------------
Linas Ramanauskas
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help