Skip to content

Why calling OnRxDone if CRC error? #771

@ARAradtec

Description

@ARAradtec

from the DS_SX1261-2_V1.1.pdf:

Note:
The IRQ RxDone means that a packet has been received but the CRC could be wrong: the user must check the CRC before
validating the packet.

from RadioOnDioIrq function in Radio.c: :

Rx done is checked first and RxDone handler is called regardless of the IRQ_CRC_ERROR bit.
LoRa packet will be discarded eventually because of bad mic ,
But that is a lot of unnecessary process:

   if( ( irqRegs & IRQ_RX_DONE ) == IRQ_RX_DONE )
    {
        uint8_t size;

        TimerStop( &RxTimeoutTimer );
        if( RxContinuous == false )
        {
            //!< Update operating mode state to a value lower than \ref MODE_STDBY_XOSC
            SX126xSetOperatingMode( MODE_STDBY_RC );

            // WORKAROUND - Implicit Header Mode Timeout Behavior, see DS_SX1261-2_V1.2 datasheet chapter 15.3
            // RegRtcControl = @address 0x0902
            SX126xWriteRegister( 0x0902, 0x00 );
            // RegEventMask = @address 0x0944
            SX126xWriteRegister( 0x0944, SX126xReadRegister( 0x0944 ) | ( 1 << 1 ) );
            // WORKAROUND END
        }
        SX126xGetPayload( RadioRxPayload, &size , 255 );
        SX126xGetPacketStatus( &RadioPktStatus );
        if( ( RadioEvents != NULL ) && ( RadioEvents->RxDone != NULL ) )
        {
            RadioEvents->RxDone( RadioRxPayload, size, RadioPktStatus.Params.LoRa.RssiPkt,   RadioPktStatus.Params.LoRa.SnrPkt );
        }
    }

    if( ( irqRegs & IRQ_CRC_ERROR ) == IRQ_CRC_ERROR )
    {
        if( RxContinuous == false )
        {
            //!< Update operating mode state to a value lower than \ref MODE_STDBY_XOSC
            SX126xSetOperatingMode( MODE_STDBY_RC );
        }
        if( ( RadioEvents != NULL ) && ( RadioEvents->RxError ) )
        {
            RadioEvents->RxError( );
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions