[Tinyos-help] CC2420 behaviour regarding CRC error

Damien O'Rourke orourked at eeng.dcu.ie
Thu May 8 03:46:14 PDT 2008


The event at the top layer would be the receive event that you wire this
module to.  I'm assuming what you want to do is allow corrupt packets to
pass up the stack?

 

This will require some changes to the TinyOS system files.  The following
should work but there may be other issues to consider (remember to make a
copy of the files you want to change and place them in your application
directory so you are not messing with the main TinyOS files - you can revert
back then if things go wrong):

 

CC2420ReceiveP (modified):

 

if ( rx_buf ) {

   uint8_t type = ( header->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7;

   signal CC2420Receive.receive( type, m_p_rx_buf );

   post receiveDone_task();

   return;

 }

 

CC2420ActiveMessageP (This is the way it is normally. However, if the
message type is corrupt it won't get through so I leave it to you to decide
what you want to do):

 

/* Receiving a packet */

 

event message_t* SubReceive.receive(message_t* msg, void* payload, uint8_t
len) {

    if (call AMPacket.isForMe(msg)) {

      return signal Receive.receive[call AMPacket.type(msg)](msg, payload,
len - CC2420_SIZE);

   }

   else {

      return signal Snoop.receive[call AMPacket.type(msg)](msg, payload, len
- CC2420_SIZE);

    }

 }

 

Also you will need to turn off address recognition (which is set by default
in CC2420ControlP).

 

Regards,

Damien.

  _____  

From: tinyos-help-bounces at millennium.berkeley.edu
[mailto:tinyos-help-bounces at millennium.berkeley.edu] On Behalf Of Paolo
Sent: 07 May 2008 15:53
To: tinyos-help at millennium.berkeley.edu
Subject: Re: [Tinyos-help] CC2420 behaviour regarding CRC error

 

Hi Damien and thanks, 




If the value is 0 then it just waits for the next packet overwriting the
original once it arrives.

There is no event launched at the top layer ?

Suppose that I should copy the wrong message (with CRC=0) before the next
arrival. I have to capture the event RXFIFO.readDone(uint8_t* rx_buf,
uint8_t rx_len, error_t error ) and make a copy of the message: its right ?

thanks

 



Damien O'Rourke wrote: 

In CC2420ReceiveP you will find the following comment and code:
 
// pass packet up if crc is good
if ( ( buf[ length ] >> 7 ) && rx_buf ) {
        uint8_t type = ( header->fcf >> IEEE154_FCF_FRAME_TYPE ) & 7;
        signal CC2420Receive.receive( type, m_p_rx_buf );
        if ( type == IEEE154_TYPE_DATA ) {
          post receiveDone_task();
          return;
        }
     }
      
waitForNextPacket();
 
 
(buf[length] >> 7) is the 1 or 0 from the CRC test.
 
If the value is 0 then it just waits for the next packet overwriting the
original once it arrives. If it is a 1 and the data type is of the format
IEEE154_TYPE_DATA then it posts a receiveDone_task which signals upper
layers:
 
m_p_rx_buf = signal Receive.receive( m_p_rx_buf, m_p_rx_buf->data, 
                                       length );
 
The code "signal CC2420Receive.receive( type, m_p_rx_buf );" is for
acknowledgements and the event for this is defined in CC2420TransmitP.
 
Regards,
Damien.
 
-----Original Message-----
From: tinyos-help-bounces at millennium.berkeley.edu
[mailto:tinyos-help-bounces at millennium.berkeley.edu] On Behalf Of Paolo
Sent: 07 May 2008 11:37
To: tinyos-help at millennium.berkeley.edu
Subject: [Tinyos-help] CC2420 behaviour regarding CRC error
 
when the cc2420 radio receives a packet, it checks whether the CRC bytes
in the packet are correct or not (via HW). and then it replaces the two 
CRC bytes at the
end of the packet with RSSI information and some correlation values, and 
only
one bit to tell whether the recieved packet had valid CRC or not.
 
At this point my question is: if the bit of CRC is 0 (CRC-Error) which 
is the behaviour of the radio stack ?
is launched an event ? which module launch/catch the event ? the message 
is deleted from RX queue immediatly ?
 
 
thanks
 
Paolo.
 
 
_______________________________________________
Tinyos-help mailing list
Tinyos-help at millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
 
 
 
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080508/39422169/attachment-0001.htm 


More information about the Tinyos-help mailing list