[Tinyos-help] CRC in CC2420

Razvan Musaloiu-E. razvanm at cs.jhu.edu
Mon Feb 16 15:16:25 PST 2009


Hi!

On Mon, 16 Feb 2009, Jordi Pérez wrote:

> Hi Razvan!
>
> I tryed to understand the code to disable the filtering you said, but I
> can't. Do you mind explaining me the things I have to change?
>
> In RXFIFO.readDone event when I modify something, the program doesn't work.
> So I don't know how disable it.
>
> In the SubReceive.receive event I changed the word Snoop to Receive, but I
> don't really know if it is correct.
>
> Can you help me please?

I attached a patch that takes out the parts that discards the packets with 
bad CRC. It's against the latest CVS and you can apply it with this 
requence of commands:
 	cd $TOSROOT
 	patch -p1 < cc2420-ignore-crc-patch.diff

Warning: I didn't have time to test this! I only made sure that it 
compiles fine. :-) Give it a try and if it doesn't work at it should I'll 
look more into it.

--
Razvan ME

> 2009/2/12 Razvan Musaloiu-E. <razvanm at cs.jhu.edu>
>
>> Hi!
>>
>>
>> On Wed, 11 Feb 2009, Jordi Pérez wrote:
>>
>>  Dear all,
>>>
>>> For CC2420, if AUTOCRC is set, will the hardware reject CRC-error packet automatically?
>>> If true, then is it possible to receive those packets but with AUTOCRC still
>>> being set? I want to receive this packets and rebuild them.
>>>
>>>
>> The CC2420 is not discarding the packets with bad CRC. What does is to
>> indicate using a bit that the packet was bad (page 38, section 16.4 from
>> [1]). The TinyOS driver for CC2420 inspects this bit and discards the
>> packets if that bit is not 1. You can see this happening in the
>> RXFIFO.readDone event from CC2420ReceiveP.nc. The switch branch of interest
>> is 'case S_RX_PAYLOAD:'.
>>
>> The other filtering that you'll have to disable is in the
>> SubReceive.receive event from CC2420ActiveMessageP.nc.
>>
>> [1] http://focus.ti.com/lit/ds/symlink/cc2420.pdf
>>
>> --
>> Razvan ME
>
-------------- next part --------------
diff --git a/tos/chips/cc2420/CC2420ActiveMessageP.nc b/tos/chips/cc2420/CC2420ActiveMessageP.nc
index 0db2423..b058f72 100644
--- a/tos/chips/cc2420/CC2420ActiveMessageP.nc
+++ b/tos/chips/cc2420/CC2420ActiveMessageP.nc
@@ -63,10 +63,6 @@ implementation {
 					  uint8_t len) {
     cc2420_header_t* header = call CC2420PacketBody.getHeader( msg );
     
-    if (len > call Packet.maxPayloadLength()) {
-      return ESIZE;
-    }
-    
     header->type = id;
     header->dest = addr;
     header->destpan = call CC2420Config.getPanAddr();
diff --git a/tos/chips/cc2420/receive/CC2420ReceiveP.nc b/tos/chips/cc2420/receive/CC2420ReceiveP.nc
index 5bd4e85..3f32ce6 100644
--- a/tos/chips/cc2420/receive/CC2420ReceiveP.nc
+++ b/tos/chips/cc2420/receive/CC2420ReceiveP.nc
@@ -306,7 +306,7 @@ implementation {
 
       // We may have received an ack that should be processed by Transmit
       // buf[rxFrameLength] >> 7 checks the CRC
-      if ( ( buf[ rxFrameLength ] >> 7 ) && rx_buf ) {
+      if ( 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 ) {


More information about the Tinyos-help mailing list