Index: clib/rf_asksin.c
===================================================================
---- clib/rf_asksin.c (revision 377)
+--- clib/rf_asksin.c (revision 378)
+++ clib/rf_asksin.c (working copy)
@@ -9,15 +9,18 @@
static void rf_asksin_reset_rx(void);
void
-@@ -71,12 +75,29 @@
- ccRX();
+@@ -74,12 +78,29 @@
+ } while (cc1100_readReg(CC1100_MARCSTATE) != MARCSTATE_RX);
}
+// Workaround for CC1101 Errata 3
ccStrobe( CC1100_SRX );
}
-@@ -87,13 +108,29 @@
+@@ -90,13 +111,29 @@
uint8_t dec[MAX_ASKSIN_MSG];
uint8_t rssi;
uint8_t l;
if (enc[0] >= MAX_ASKSIN_MSG) {
// Something went horribly wrong, out of sync?
-@@ -101,6 +138,27 @@
+@@ -104,6 +141,27 @@
return;
}
CC1100_ASSERT;
cc1100_sendbyte( CC1100_READ_BURST | CC1100_RXFIFO );
-@@ -109,12 +167,19 @@
+@@ -112,14 +170,19 @@
}
rssi = cc1100_sendbyte( 0 );
CC1100_DEASSERT;
-- ccStrobe( CC1100_SRX );
+- do {
+- ccStrobe(CC1100_SRX);
+- } while (cc1100_readReg(CC1100_MARCSTATE) != MARCSTATE_RX);
+ // We must not read the last byte from the RX fifo while RX is in progress (Errata 1)
+ while (((read_cc1100_rxbytes() & 0x7f) < 2) && (cc1100_readReg(CC1100_PKTSTATUS) & (1 << 3))) {
+ my_delay_ms(1);