File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ extern "C" {
4141#define CC2538_AUTOCRC_LEN (2)
4242#define CC2538_RF_FIFO_SIZE (128)
4343#define CC2538_PACKET_LENGTH_SIZE (1)
44+ #define CC2538_LENGTH_BYTE_MASK (0x7F) /**< Mask for the length byte in the packet */
4445
4546#define CC2538_RF_MAX_DATA_LEN (CC2538_RF_FIFO_SIZE - CC2538_PACKET_LENGTH_SIZE)
4647
Original file line number Diff line number Diff line change @@ -412,9 +412,11 @@ void cc2538_irq_handler(void)
412412
413413 if (flags_f0 & RXPKTDONE ) {
414414 handled_f0 |= RXPKTDONE ;
415- /* CRC_OK bit is in the last byte in the RX FIFO */
416- uint8_t crc_loc = RFCORE_XREG_RXFIFOCNT - 1 ;
417- if (rfcore_peek_rx_fifo (crc_loc ) & CC2538_CRC_BIT_MASK ) {
415+ /* CRC_OK bit is located in the last byte of the packet.
416+ * The radio masks the length byte before filling the FIFO with the
417+ * corresponding number of bytes. */
418+ uint8_t pkt_len = (rfcore_peek_rx_fifo (0 ) & CC2538_LENGTH_BYTE_MASK );
419+ if (rfcore_peek_rx_fifo (pkt_len ) & CC2538_CRC_BIT_MASK ) {
418420 /* Disable RX while the frame has not been processed */
419421 _disable_rx ();
420422 /* If AUTOACK is disabled or the ACK request bit is not set */
You can’t perform that action at this time.
0 commit comments