Hi,
I have a simple program that sends messages requesting an ack. On
tmotes, this program works as expected, but on Iris motes the first
message after turning the application on is not acknowledged. Using a
sniffer shows that the ack is not sent. Further investigation showed
that the ack does not seem to be requested. In particular, when the mote
acknowledging messages is a Tmote and the mote sending the messages is
an Iris mote, the first message does not get an ack, but if the roles
are inversed, the first message gets acknowledged.
The program code for the test application is below. If the node id is 0,
the mote will not do anything special but just acknowledge the messages
it receives (implicitly). If the node id is not 0, then the mote will
periodically send messages and check for acknowledgments. The expected
behavior is that both LEDs (red and green) turn on simultaneously at the
very beginning (red toggles when sending messages and green is turned on
if an ack is received, and off otherwise).
Is there a bug with the Iris radio implementation that the first message
is not acknowledged? Or did I implement something wrong?
Thanks,
Urs
------------------------
#include "test.h"
module TestC {
uses interface Leds;
uses interface Boot;
uses interface SplitControl as RadioControl;
uses interface AMSend as Send;
uses interface Timer<TMilli> as Timer;
uses interface PacketAcknowledgements as Ack;
}
implementation {
message_t rpacket;
event void Boot.booted() {
call RadioControl.start();
}
event void Timer.fired() {
error_t error;
TestMsg* msg;
call Leds.led0Toggle();
msg = (TestMsg*)call Send.getPayload(&rpacket, sizeof(TestMsg));
if(msg == NULL) {
call Leds.led2On();
return;
}
msg->data = TOS_NODE_ID;
error = call Ack.requestAck(&rpacket);
if(error != SUCCESS) {
call Leds.led2On();
return;
}
error = call Send.send(0, &rpacket, sizeof(TestMsg));
if(error != SUCCESS) {
call Leds.led2On();
}
}
event void RadioControl.startDone(error_t error) {
if(error == SUCCESS) {
if(TOS_NODE_ID > 0) {
call Timer.startPeriodic(1024);
}
} else {
call Leds.led2On();
}
}
event void Send.sendDone(message_t* msg, error_t error) {
if(error != SUCCESS) {
call Leds.led2On();
}
if(call Ack.wasAcked(msg)) {
call Leds.led1On();
} else {
call Leds.led1Off();
}
}
event void RadioControl.stopDone(error_t error) {
if(error != SUCCESS) {
call Leds.led2On();
}
}
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help