[Tinyos-devel] CC2420 Radio Stack Bug

David Moss dmm at rincon.com
Tue Jun 12 10:44:52 PDT 2007


Great, thanks for the bug catch.  I'll add this fix in with the next version
of the CC2420 stack.

-David


-----Original Message-----
From: tinyos-devel-bounces at Millennium.Berkeley.EDU
[mailto:tinyos-devel-bounces at Millennium.Berkeley.EDU] On Behalf Of Jon Green
Sent: Tuesday, June 12, 2007 10:24 AM
To: tinyos-devel at Millennium.Berkeley.EDU
Subject: [Tinyos-devel] CC2420 Radio Stack Bug

I've been designing a secure radio stack around the CC2420 radio and the
TinyOS CC2420 Active Message stack. While I was doing development I
found a bug in the existing stack that I thought I would bring to your
attention. 

Behaviour: 
The receive functionality works fine until you send a message. After
sending a message the interrupt event InterruptFIFOP.fired() in
ReceiveP.nc begins to fire rapidly because the radio is receiving a
large number of packets malformed packets. To give an idea of volume, I
was seeing a packet being received every half second or so. 

This does not affect the upper level functionality of the radio stack,
as the bad packets are tossed out and regular packets are able to send
and receive fine. However, having the microprocessor deal with this
large volume of malformed packets slows down computations, reduces
bandwidth and reduces battery life. 

Fix: 
The root cause of this problem is that the datasheet for the CC2420
gives a incorrect initial value for MDMCTRL1.CORR_THR. The datasheet
specifies that the reset value is 0, however if you read the value of
the register after a reset MDMCTRL1.CORR_THR is 20. This is the value it
should be as noted on pg36 and pg66 of the datasheet (v1.3). 

When transmitting this initial value of 20 is overwritten by zero in the
MDMCTRL1 register statements in CC2420TransmitP.nc for LPL. If we make
sure that when we set MDMCTRL1 that we set CORR_THR to 20 this bug is
fixed and the microcontroller doesn't need to deal with the malformed
packets. This diff does that:

Index: CC2420TransmitP.nc
===================================================================
RCS
file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc2420/CC2420TransmitP.nc,v
retrieving revision 1.5
diff -u -p -r1.5 CC2420TransmitP.nc
--- CC2420TransmitP.nc  12 Apr 2007 17:11:12 -0000      1.5
+++ CC2420TransmitP.nc  12 Jun 2007 17:16:48 -0000
@@ -648,9 +648,11 @@ implementation {
           return;
         }
         
-        call MDMCTRL1.write(2 << CC2420_MDMCTRL1_TX_MODE);
+        call MDMCTRL1.write(   (20 << CC2420_MDMCTRL1_CORR_THR) |
+
( 2 << CC2420_MDMCTRL1_TX_MODE) );
       } else {
-        call MDMCTRL1.write(0 << CC2420_MDMCTRL1_TX_MODE);
+        call MDMCTRL1.write(   (20 << CC2420_MDMCTRL1_CORR_THR) |
+
( 0 << CC2420_MDMCTRL1_TX_MODE) );
       }
 
       status = m_cca ? call STXONCCA.strobe() : call STXON.strobe();
===================================================================

Cheers, 
Jon

_______________________________________________
Tinyos-devel mailing list
Tinyos-devel at Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel




More information about the Tinyos-devel mailing list