Hy Lee Ee Foong,
 
I never tried to read the ack element in my message before sending, but I successfully checked the
fcfhi element (after sending) from a received messages.
fcfhi is the high byte of the FrameControlField (IEEE 802.15.4), if this is equal to 0x21 your message
requests ACK.
 
You could make a check (on a receiving mote) like:
 
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr _msg) {
    if (_msg->fcfhi & (1 << CC2420_DEF_FCF_BIT_ACK))    // with ACK
        call Leds.redToggle();
    else                                                // without ACK
        call Leds.greenToggle();
}
 
 
The condition of the if statement (_msg->fcfhi & (1 << CC2420_DEF_FCF_BIT_ACK))
checks bit number 5 of fcfhi, because this indicates a requested ACK (2^5=32=0x20).
 
The following defines can be found in CC2420Const.h:
CC2420_DEF_FCF_BIT_ACK 0x05  // bitposition in fcfhi
CC2420_DEF_FCF_HI      0x01  // without ACK
CC2420_DEF_FCF_HI_ACK  0x21  // with ACK
 
 
Regards,
            OLE
 
----- Original Message -----
Sent: Friday, November 03, 2006 5:11 AM
Subject: [Tinyos-help] How to enableACK on tmote

I'm trying to test the ack in the sendDone( ) but the ack field always set to zero. I call MacControl.enableACK( ) in the StdControl.start( ).  Is there something that I did wrong or missing?
 
I wired the components as following:
 
 Main.StdControl -> CC2420RadioC;
 MultiHopEngineM.MacControl -> CC2420RadioC;
 command result_t StdControl.start()
  {
     call MacControl.enableAck();
     return SUCCESS;
  }
 
 
 event result_t SendMsg.sendDone[uint8_t id](TOS_MsgPtr pMsg, result_t success)
 {
    dbg(DBG_TEMP, "ack is %d \n", pMsg->ack);
 
    if (pMsg->ack == 1)
      call Leds.redToggle();
    else
      call Leds.greenToggle();
   
    return SUCCESS;
  }
 
 
 
 Thank you.
 
Andre


We have the perfect Group for you. Check out the handy changes to Yahoo! Groups.


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

Reply via email to