From 65862dac9bba3f724208ca1b83e75385961418e9 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Thu, 20 Jun 2013 20:52:55 +0200 Subject: [PATCH] don't get confused when more than one packet is received disable receiver after receiving one packet and reenable it after reading it from the fifo --- culfw/culfw-asksin-fix.diff | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/culfw/culfw-asksin-fix.diff b/culfw/culfw-asksin-fix.diff index 04dab92..b17fd05 100644 --- a/culfw/culfw-asksin-fix.diff +++ b/culfw/culfw-asksin-fix.diff @@ -16,7 +16,7 @@ Index: clib/rf_asksin.c 0x12, 0x03, 0x15, 0x34, - 0x17, 0x30, // always go into IDLE -+ 0x17, 0x3F, // always go into RX, CCA, ELV uses 0x03 ++ 0x17, 0x33, // always go into RX after TX, CCA, ELV uses 0x03 0x18, 0x18, 0x19, 0x16, 0x1B, 0x43, @@ -55,23 +55,26 @@ Index: clib/rf_asksin.c } void -@@ -97,14 +96,10 @@ +@@ -97,13 +96,13 @@ } rssi = cc1100_sendbyte( 0 ); -+ /* LQI = */ cc1100_sendbyte( 0 ); - +- ++ CC1100_DEASSERT; - ccStrobe( CC1100_SFRX ); - ccStrobe( CC1100_SIDLE ); - ccStrobe( CC1100_SNOP ); - ccStrobe( CC1100_SRX ); -- ++ while(cc1100_readReg(CC1100_RXBYTES) & 0x7f) ++ cc1100_readReg( CC1100_RXFIFO ); ++ ++ ccRX(); + dec[0] = enc[0]; dec[1] = (~enc[1]) ^ 0x89; - -@@ -113,7 +108,6 @@ +@@ -113,7 +112,6 @@ dec[l] = enc[l] ^ dec[2]; @@ -79,7 +82,7 @@ Index: clib/rf_asksin.c if (tx_report & REP_BINTIME) { DC('a'); -@@ -133,24 +127,14 @@ +@@ -133,24 +131,17 @@ } return; @@ -101,16 +104,19 @@ Index: clib/rf_asksin.c - - } -+ if (cc1100_readReg( CC1100_MARCSTATE ) == MARCSTATE_RXFIFO_OVERFLOW) { ++ switch(cc1100_readReg( CC1100_MARCSTATE )) { ++ case MARCSTATE_RXFIFO_OVERFLOW: + ccStrobe( CC1100_SFRX ); ++ case MARCSTATE_IDLE: + ccStrobe( CC1100_SIDLE ); + ccStrobe( CC1100_SNOP ); + ccStrobe( CC1100_SRX ); ++ break; + } } void -@@ -173,20 +157,7 @@ +@@ -173,20 +164,7 @@ my_delay_ms(3); // 3ms: Found by trial and error } @@ -131,7 +137,7 @@ Index: clib/rf_asksin.c enc[0] = dec[0]; enc[1] = (~dec[1]) ^ 0x89; -@@ -195,6 +166,15 @@ +@@ -195,6 +173,15 @@ enc[l] = dec[l] ^ dec[2]; @@ -147,7 +153,7 @@ Index: clib/rf_asksin.c // send CC1100_ASSERT; cc1100_sendbyte(CC1100_WRITE_BURST | CC1100_TXFIFO); -@@ -205,12 +185,17 @@ +@@ -205,12 +192,17 @@ CC1100_DEASSERT; -- 2.39.5