diff --git a/cpu/cc2538/radio/cc2538_rf_radio_ops.c b/cpu/cc2538/radio/cc2538_rf_radio_ops.c index 0ca37c48f9..8852e5538b 100644 --- a/cpu/cc2538/radio/cc2538_rf_radio_ops.c +++ b/cpu/cc2538/radio/cc2538_rf_radio_ops.c @@ -348,8 +348,10 @@ void cc2538_irq_handler(void) cc2538_rf_dev.cb(&cc2538_rf_dev, IEEE802154_RADIO_INDICATION_RX_DONE); } else { + /* Disable RX while the frame has not been processed */ + RFCORE_XREG_RXMASKCLR = 0xFF; /* CRC failed; discard packet */ - RFCORE_SFR_RFST = ISFLUSHRX; + cc2538_rf_dev.cb(&cc2538_rf_dev, IEEE802154_RADIO_INDICATION_CRC_ERROR); } } @@ -391,11 +393,12 @@ static bool _get_cap(ieee802154_dev_t *dev, ieee802154_rf_caps_t cap) (void) dev; switch (cap) { case IEEE802154_CAP_24_GHZ: + case IEEE802154_CAP_AUTO_CSMA: + case IEEE802154_CAP_IRQ_CRC_ERROR: case IEEE802154_CAP_IRQ_TX_DONE: case IEEE802154_CAP_IRQ_CCA_DONE: case IEEE802154_CAP_IRQ_RX_START: case IEEE802154_CAP_IRQ_TX_START: - case IEEE802154_CAP_AUTO_CSMA: return true; default: return false; diff --git a/cpu/nrf52/radio/nrf802154/nrf802154_radio.c b/cpu/nrf52/radio/nrf802154/nrf802154_radio.c index 3b36f397f2..b442913bb6 100644 --- a/cpu/nrf52/radio/nrf802154/nrf802154_radio.c +++ b/cpu/nrf52/radio/nrf802154/nrf802154_radio.c @@ -544,7 +544,7 @@ void isr_radio(void) } else { DEBUG("[nrf802154] CRC fail.\n"); - NRF_RADIO->TASKS_START = 1; + dev->cb(dev, IEEE802154_RADIO_INDICATION_CRC_ERROR); } break; case STATE_ACK: @@ -645,6 +645,7 @@ static bool _get_cap(ieee802154_dev_t *dev, ieee802154_rf_caps_t cap) (void) dev; switch (cap) { case IEEE802154_CAP_24_GHZ: + case IEEE802154_CAP_IRQ_CRC_ERROR: case IEEE802154_CAP_IRQ_RX_START: case IEEE802154_CAP_IRQ_TX_START: case IEEE802154_CAP_IRQ_TX_DONE: diff --git a/sys/include/net/ieee802154/radio.h b/sys/include/net/ieee802154/radio.h index 44066927a1..721703e871 100644 --- a/sys/include/net/ieee802154/radio.h +++ b/sys/include/net/ieee802154/radio.h @@ -92,6 +92,10 @@ typedef enum { * @brief the device support the IEEE802.15.4 Sub GHz band */ IEEE802154_CAP_SUB_GHZ, + /** + * @brief the device reports reception off frames with invalid CRC. + */ + IEEE802154_CAP_IRQ_CRC_ERROR, /** * @brief the device reports when the transmission is done */ @@ -190,6 +194,18 @@ typedef enum { */ IEEE802154_RADIO_INDICATION_RX_START, + /** + * @brief the transceiver received a frame with an invalid crc. + * + * The transceiver might not stay in @ref IEEE802154_TRX_STATE_RX_ON + * after receiving an invalid CRC. Therefore the upper layer must + * set the transceiver state (@ref ieee802154_radio_ops::request_set_trx_state). + * e.g.: @ref IEEE802154_TRX_STATE_TRX_OFF or @ref IEEE802154_TRX_STATE_TX_ON + * to stop listening or @ref IEEE802154_TRX_STATE_RX_ON to keep + * listening. + */ + IEEE802154_RADIO_INDICATION_CRC_ERROR, + /** * @brief the transceiver sent out a valid SFD *