I apologize if I have missed something very basic.

The problem is when sending a packet directly from the 
SplitControl.startDone (SplitControl wired to ActiveMessageC). If the 
PERIODIC Timer is used in SplitControl.startDone() and the packet is sent 
from the corresponding fired() routine, everything works fine. However, 
with the Timer.oneShot(), the problem persists.

The program is simple, the sender node (TOS_NODE_ID=1) sends a single 
packet and the receiver (TOS_NODE_ID=2) receives the packet and toggles 
green LED. Once the program is loaded onto the sender and receiver motes, 
the problem can be reproduced as follows.

1) Power-up the receiver node.

2) Power-up the sender node. On the Power-up, the sender transmits a 
packet and it is successfully received by the receiver.

3) PROBLEM arises once you restart the sender or power-down and power it 
up again (please do not power-down/restart the receiver). The packet that 
the sender transmits now on the restart is not received by the application 
handler at the receiver (green LED does not toggle). However, if you use 
PacketAcknowledgemnts at the sender, the second packet is actually 
acknowledged (wasAcked() returns SUCCESS).

I am using latest checkout from the CVS. I also tested the code in older 
versions too but without luck.

FOLLOWING is the CODE: to test with the Timer, please uncomment the line 
"Timer.startPeriodic" and comment "AMSend.send" below this line (in the 
event SplitControl.startDone()).


CONFIGURATION:

configuration AcksC
{
}

implementation {
   components AcksP as App, MainC, LedsC, ActiveMessageC as Radio;
   components new TimerMilliC() as Timer;

   App.Boot -> MainC.Boot;
   App.Leds -> LedsC;
   App.RadioControl -> Radio;
   App.Receive -> Radio.Receive[240];
   App.AMSend -> Radio.AMSend[240];
   App.Timer -> Timer;
}

MODULE:

module AcksP
{
   uses {
     // general
     interface Boot;
     interface Leds;
     interface Timer<TMilli> as Timer;

     // Radio
     interface SplitControl as RadioControl;
     interface Receive;
     interface AMSend;
   }
}

implementation
{
   message_t testPkt;

   event void Timer.fired()
   {
       call AMSend.send(2, &testPkt, 1);
   }

   event void Boot.booted()
   {
     call RadioControl.start();
   }

   event void RadioControl.startDone(error_t err)
   {
     if(err == SUCCESS) {
       if(TOS_NODE_ID == 1) {
         //call Timer.startPeriodic(2000);
         //call Timer.startOneShot(2000);
         call AMSend.send(2, &testPkt, 1);
       }
     }
     return;
   }
   event void RadioControl.stopDone(error_t err) {return;}

   event void AMSend.sendDone(message_t* msg, error_t error)
   {
     if(error == SUCCESS) {
       call Leds.led0Toggle();
     }
     return;
   }
  event message_t* Receive.receive(message_t* msg, void* payload, uint8_t 
len)
   {
     call Leds.led1Toggle();
     return msg;
   }
} // END


Manjunath D

################################################################################################################
***************************************************************************************************************
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to