Hi,
    I am running tinyos on micaz with Hardware ack(open packetlink layer to 
retransmit) .
   I find a a problem.
  When CC2420 transmit a packet, m_state turns  S_SFD  and  then break. When 
node receive a new packet m_state turns to S_EFD   and S_ACK_WAIT. In this way 
As node is not in ACK_WAIT state, it can receive a ack packet but cannot really 
handle the ack packet. Thus I see the node retransmit the packet all the time.
  I do not know whether it is a bug.

 BUT when I comment   
  if ( call SFD.get() ) {

          break;
the node works normally.
 Do you meet such problem?
 Thank you.
                                                                                
                                                                                
                                                                                
                                                                                
                         Napoleon


source code of CC2420TransmitP:
      case S_SFD:
        m_state = S_EFD;
        sfdHigh = TRUE;
        // in case we got stuck in the receive SFD interrupts, we can reset
        // the state here since we know that we are not receiving anymore
        m_receiving = FALSE;
        call CaptureSFD.captureFallingEdge();
        call PacketTimeStamp.set(m_msg, time32);
        if (call PacketTimeSyncOffset.isSet(m_msg)) {
           uint8_t absOffset = 
sizeof(message_header_t)-sizeof(cc2420_header_t)+call 
PacketTimeSyncOffset.get(m_msg);
           timesync_radio_t *timesync = (timesync_radio_t 
*)((nx_uint8_t*)m_msg+absOffset);
           // set timesync event time as the offset between the event time and 
the SFD interrupt time (TEP  133)
           *timesync  -= time32;
           call CSN.clr();
           call TXFIFO_RAM.write( absOffset, (uint8_t*)timesync, 
sizeof(timesync_radio_t) );
           call CSN.set();
           //restoring the event time to the original value
           *timesync  += time32;
        }

        if ( (call CC2420PacketBody.getHeader( m_msg ))->fcf & ( 1 << 
IEEE154_FCF_ACK_REQ ) ) {
          // This is an ack packet, don't release the chip's SPI bus lock.
          abortSpiRelease = TRUE;
        }
        releaseSpiResource();
        call BackoffTimer.stop();

        if ( call SFD.get() ) {
          break;
        }
        /** Fall Through because the next interrupt was already received */

      case S_EFD:
        sfdHigh = FALSE;
        call CaptureSFD.captureRisingEdge();
        //xiangwei
        if ( (call CC2420PacketBody.getHeader( m_msg ))->fcf & ( 1 << 
IEEE154_FCF_ACK_REQ ) ) {
         m_state = S_ACK_WAIT;
         call BackoffTimer.start( CC2420_ACK_WAIT_DELAY );
        } else {
          signalDone(SUCCESS);
        }
        
        if ( !call SFD.get() ) {
          break;
        }
        /** Fall Through because the next interrupt was already received */
                                          
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to