arduino-LoRa icon indicating copy to clipboard operation
arduino-LoRa copied to clipboard

Corrupted header may let corrupted packets to go through even CRC is enable?

Open IoTThinks opened this issue 4 years ago • 1 comments

I realized even I enableCrc(), visibble corrupted packets are still received. Possible reason is due to corrupted header.

    // check packet header integrity
    if(_crcEnabled && (_mod->SPIgetRegValue(SX127X_REG_HOP_CHANNEL, 6, 6)) == 0) {
      // CRC is disabled according to packet header and enabled according to user
      // most likely damaged packet header
      clearIRQFlags();
      return(ERR_LORA_HEADER_DAMAGED);
    }

Ref: https://github.com/jgromes/RadioLib/pull/111#issuecomment-725713815 https://github.com/jgromes/RadioLib/issues/200

IoTThinks avatar Mar 01 '21 05:03 IoTThinks

Nice find! However, how do we implement this in the current LoRa.cpp? Can we add another condition on line 237?

if ((irqFlags & IRQ_RX_DONE_MASK) && (irqFlags & IRQ_PAYLOAD_CRC_ERROR_MASK) == 0) {
    // received a packet

engeen-nl avatar Jul 29 '21 15:07 engeen-nl