[CC1101] Fix discarded packets triggering data read (#1484)

pull/1557/head
jgromes 2025-07-06 14:44:31 +02:00
rodzic 6bc37af47f
commit f6239d01c1
2 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -261,7 +261,6 @@ int16_t CC1101::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
// data put on FIFO
uint8_t dataSent = 0;
uint8_t filter = SPIgetRegValue(RADIOLIB_CC1101_REG_PKTCTRL1, 1, 0);
// optionally write packet length
@ -274,7 +273,6 @@ int16_t CC1101::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
}
// check address filtering
//uint8_t filter = SPIgetRegValue(RADIOLIB_CC1101_REG_PKTCTRL1, 1, 0);
if(filter != RADIOLIB_CC1101_ADR_CHK_NONE) {
SPIwriteRegister(RADIOLIB_CC1101_REG_FIFO, addr);
dataSent += 1;
@ -343,8 +341,14 @@ int16_t CC1101::startReceive() {
SPIsendCommand(RADIOLIB_CC1101_CMD_FLUSH_RX);
// set GDO0 mapping
// GDO0 is de-asserted at packet end, hence it is inverted here
state = SPIsetRegValue(RADIOLIB_CC1101_REG_IOCFG0, RADIOLIB_CC1101_GDO0_INV | RADIOLIB_CC1101_GDOX_SYNC_WORD_SENT_OR_PKT_RECEIVED, 6, 0);
// this is the only interrupt source that works reliably
// RADIOLIB_CC1101_GDOX_SYNC_WORD_SENT_OR_PKT_RECEIVED gets triggered by both packet received as well as packet discarded,
// RADIOLIB_CC1101_GDOX_PKT_RECEIVED_CRC_OK does not get triggered with CRC disabled
state = SPIsetRegValue(RADIOLIB_CC1101_REG_IOCFG0, RADIOLIB_CC1101_GDOX_RX_FIFO_FULL_OR_PKT_END, 6, 0);
RADIOLIB_ASSERT(state);
// set Rx FIFO threshold to the maximum Rx size
state = SPIsetRegValue(RADIOLIB_CC1101_REG_FIFOTHR, RADIOLIB_CC1101_FIFO_THR_TX_1_RX_64, 3, 0);
RADIOLIB_ASSERT(state);
// set RF switch (if present)

Wyświetl plik

@ -183,6 +183,7 @@
#define RADIOLIB_CC1101_RX_ATTEN_18_DB 0b00110000 // 5 4 18 dB
#define RADIOLIB_CC1101_FIFO_THR_TX_61_RX_4 0b00000000 // 3 0 TX fifo threshold: 61, RX fifo threshold: 4
#define RADIOLIB_CC1101_FIFO_THR_TX_33_RX_32 0b00000111 // 3 0 TX fifo threshold: 33, RX fifo threshold: 32
#define RADIOLIB_CC1101_FIFO_THR_TX_1_RX_64 0b00001111 // 3 0 TX fifo threshold: 1, RX fifo threshold: 64
#define RADIOLIB_CC1101_FIFO_THRESH_TX 33
#define RADIOLIB_CC1101_FIFO_THRESH_RX 32