[Tinyos-help] Can I use PacketAcknowledgments in TinyOS Testbed ? (It works well in Tossim, but doesn't work in Testbed).

Philip Levis pal at cs.stanford.edu
Sun Feb 3 22:48:57 PST 2008


On Feb 3, 2008, at 3:13 PM, DAE HEE KIM wrote:

> Hi.
>
> PacketAcknowledgements worked very well in Tossim. However, in  
> motes. it doesn't work.
> Do I have to change some other parameter in order to use  
> PacketAcknowledgement in motes ?
>
> Following is my snippet that I added PacketAcknowledgements in  
> BlinkToRadio..
>
>   /***************************
>    * Send Packet
>    **************************/
>   // send data when timer expires
>   event void Timer0.fired()
>   {
>     counter++;
>
>     if (!busy) {
>
>       // create new packet
>       BlinkToRadioMsg *btrpkt = (BlinkToRadioMsg*)(call  
> Packet.getPayload(&pkt, NULL));
>
>       // insert data into packet
>       btrpkt->nodeid  = TOS_NODE_ID;
>       btrpkt->counter = counter;
>
>       // send packet (broadcast)
>
>       call Acks.requestAck(&pkt);
>       if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof 
> (BlinkToRadioMsg)) == SUCCESS) {
>         dbg("BlinkToRadioC","Send %d packet\n", counter);
>         busy = TRUE;
>
>         // send success : Blink
>         call Leds.led0Toggle();
>       }
>     }
>   }
>
>   // finish sending
>   event void AMSend.sendDone(message_t *msg, error_t error) {
>     if (&pkt == msg) {
>       if (call Acks.wasAcked(msg)) {
>         call Leds.led2Toggle();
>       }
>       else {
>         call Leds.led1Toggle();    <-- led1 toggles which means not  
> acked.
>       }
>       busy = FALSE;
>     }
>   }
>
> Thanks in advance


You need to call PacketAcknowledgements to enable acks in the send  
path. TOSSIM might have them enabled by default.

Phil


More information about the Tinyos-help mailing list