Skip to content

Commit

Permalink
Implemented SX126x radio workarounds provided on DS_SX1261-2_V1.2 dat…
Browse files Browse the repository at this point in the history
…asheet (not publicly available yet)
  • Loading branch information
mluis1 committed Jul 16, 2019
1 parent b5d7ff0 commit ed819b0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/radio/sx126x/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,19 @@ void RadioSetRxConfig( RadioModems_t modem, uint32_t bandwidth,
SX126xSetModulationParams( &SX126x.ModulationParams );
SX126xSetPacketParams( &SX126x.PacketParams );

// WORKAROUND - Optimizing the Inverted IQ Operation, see DS_SX1261-2_V1.2 datasheet chapter 15.4
if( SX126x.PacketParams.Params.LoRa.InvertIQ == LORA_IQ_INVERTED )
{
// RegIqPolaritySetup = @address 0x0736
SX126xWriteRegister( 0x0736, SX126xReadRegister( 0x0736 ) & ~( 1 << 2 ) );
}
else
{
// RegIqPolaritySetup @address 0x0736
SX126xWriteRegister( 0x0736, SX126xReadRegister( 0x0736 ) | ( 1 << 2 ) );
}
// WORKAROUND END

// Timeout Max, Timeout handled directly in SetRx function
RxTimeout = 0xFFFF;

Expand Down Expand Up @@ -820,6 +833,20 @@ void RadioSetTxConfig( RadioModems_t modem, int8_t power, uint32_t fdev,
SX126xSetPacketParams( &SX126x.PacketParams );
break;
}

// WORKAROUND - Modulation Quality with 500 kHz LoRa® Bandwidth, see DS_SX1261-2_V1.2 datasheet chapter 15.1
if( ( modem == MODEM_LORA ) && ( SX126x.ModulationParams.Params.LoRa.Bandwidth == LORA_BW_500 ) )
{
// RegTxModulation = @address 0x0889
SX126xWriteRegister( 0x0889, SX126xReadRegister( 0x0889 ) & ~( 1 << 2 ) );
}
else
{
// RegTxModulation = @address 0x0889
SX126xWriteRegister( 0x0889, SX126xReadRegister( 0x0889 ) | ( 1 << 2 ) );
}
// WORKAROUND END

SX126xSetRfTxPower( power );
TxTimeout = timeout;
}
Expand Down Expand Up @@ -1106,6 +1133,13 @@ void RadioIrqProcess( void )
{
//!< 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 );
Expand Down
5 changes: 5 additions & 0 deletions src/radio/sx126x/sx126x.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,11 @@ void SX126xSetTxParams( int8_t power, RadioRampTimes_t rampTime )
}
else // sx1262
{
// WORKAROUND - Better Resistance of the SX1262 Tx to Antenna Mismatch, see DS_SX1261-2_V1.2 datasheet chapter 15.2
// RegTxClampConfig = @address 0x08D8
SX126xWriteRegister( 0x08D8, SX126xReadRegister( 0x08D8 ) | ( 0x0F << 1 ) );
// WORKAROUND END

SX126xSetPaConfig( 0x04, 0x07, 0x00, 0x01 );
if( power > 22 )
{
Expand Down

0 comments on commit ed819b0

Please sign in to comment.