void
rf_asksin_task(void)
{
-@@ -77,18 +108,51 @@
+@@ -77,18 +108,57 @@
uint8_t dec[MAX_ASKSIN_MSG];
uint8_t rssi;
uint8_t l;
+ break;
+
+ rxfifo_cnt &= 0x7f;
++
++ // We must not read the last byte from the RX fifo while RX is in progress (Errata 1)
++ while ((rxfifo_cnt == 1) && (cc1100_readReg(CC1100_PKTSTATUS) & (1 << 3))) {
++ my_delay_ms(1);
++ rxfifo_cnt = read_cc1100_rxbytes() & 0x7f;
++ }
+
enc[0] = cc1100_readReg( CC1100_RXFIFO ) & 0x7f; // read len
+ rxfifo_cnt--;
CC1100_ASSERT;
cc1100_sendbyte( CC1100_READ_BURST | CC1100_RXFIFO );
-@@ -97,14 +161,19 @@
+@@ -97,14 +167,19 @@
}
rssi = cc1100_sendbyte( 0 );
dec[0] = enc[0];
dec[1] = (~enc[1]) ^ 0x89;
-@@ -113,7 +182,6 @@
+@@ -113,7 +188,6 @@
dec[l] = enc[l] ^ dec[2];
if (tx_report & REP_BINTIME) {
DC('a');
-@@ -131,26 +199,17 @@
+@@ -131,26 +205,17 @@
DNL();
}
}
void
-@@ -173,20 +232,7 @@
+@@ -173,20 +238,7 @@
my_delay_ms(3); // 3ms: Found by trial and error
}
enc[0] = dec[0];
enc[1] = (~dec[1]) ^ 0x89;
-@@ -195,6 +241,15 @@
+@@ -195,6 +247,15 @@
enc[l] = dec[l] ^ dec[2];
// send
CC1100_ASSERT;
cc1100_sendbyte(CC1100_WRITE_BURST | CC1100_TXFIFO);
-@@ -205,12 +260,17 @@
+@@ -205,12 +266,17 @@
CC1100_DEASSERT;