From a637ddaf4e0195404833f6320fef2826f5714cdd Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Sat, 3 Apr 2010 16:01:00 +0000 Subject: [PATCH] Flush the rxfifo when turning off the radio instead of when turning it on. This seems to fix a bug that was seen in mspsim and seemed to appear on real hardware too. --- core/dev/cc2420.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/dev/cc2420.c b/core/dev/cc2420.c index 11fafa610..4c991f409 100644 --- a/core/dev/cc2420.c +++ b/core/dev/cc2420.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: cc2420.c,v 1.48 2010/03/31 19:08:56 adamdunkels Exp $ + * @(#)$Id: cc2420.c,v 1.49 2010/04/03 16:01:00 adamdunkels Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -189,7 +189,7 @@ on(void) ENABLE_FIFOP_INT(); strobe(CC2420_SRXON); - flushrx(); + } static void off(void) @@ -201,6 +201,7 @@ off(void) /* Wait for transmission to end before turning radio off. */ while(status() & BV(CC2420_TX_ACTIVE)); + flushrx(); strobe(CC2420_SRFOFF); DISABLE_FIFOP_INT(); ENERGEST_OFF(ENERGEST_TYPE_LISTEN); @@ -215,6 +216,7 @@ static void RELEASE_LOCK(void) { lock_on = 0; } if(lock_off) { + leds_off(LEDS_BLUE); off(); lock_off = 0; }