Skip to content

Commit

Permalink
[LR1121] apply TX HP adjustment for HPD-16E radio module
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Feb 1, 2025
1 parent 078b8fd commit ab872ab
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 22 deletions.
23 changes: 9 additions & 14 deletions software/firmware/source/SoftRF/src/driver/radio/radiolib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,9 @@ static void lr11xx_setup()
state = radio_semtech->begin(); // start LoRa mode (and disable FSK)
#endif
#if USE_LR11XX
#if RADIOLIB_VERSION_MAJOR == 6
state = radio_semtech->begin(125.0, 9, 7,
RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE,
10, 8, Vtcxo);
#else
state = radio_semtech->begin(125.0, 9, 7,
RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE,
8, Vtcxo);
#endif /* RADIOLIB_VERSION_MAJOR */
#endif

switch (RF_FreqPlan.Bandwidth)
Expand Down Expand Up @@ -629,11 +623,7 @@ static void lr11xx_setup()
state = radio_semtech->beginFSK(); // start FSK mode (and disable LoRa)
#endif
#if USE_LR11XX
#if RADIOLIB_VERSION_MAJOR == 6
state = radio_semtech->beginGFSK(4.8, 5.0, 156.2, 10, 16, Vtcxo);
#else
state = radio_semtech->beginGFSK(4.8, 5.0, 156.2, 16, Vtcxo);
#endif /* RADIOLIB_VERSION_MAJOR */
#endif

switch (rl_protocol->bitrate)
Expand Down Expand Up @@ -779,8 +769,6 @@ static void lr11xx_setup()
break;
}

state = radio_semtech->setOutputPower(txpow);

#if USE_SX1262
uint32_t rxe = lmic_pins.rxe == LMIC_UNUSED_PIN ? RADIOLIB_NC : lmic_pins.rxe;
uint32_t txe = lmic_pins.txe == LMIC_UNUSED_PIN ? RADIOLIB_NC : lmic_pins.txe;
Expand All @@ -791,6 +779,8 @@ static void lr11xx_setup()
}

state = radio_semtech->setCurrentLimit(100.0);

state = radio_semtech->setOutputPower(txpow);
#endif

#if USE_LR11XX
Expand All @@ -802,26 +792,31 @@ static void lr11xx_setup()
#else
radio_semtech->setRfSwitchTable(rfswitch_dio_pins_seeed, rfswitch_table_seeed);
#endif
state = radio_semtech->setOutputPower(txpow, false);
break;

case SOFTRF_MODEL_STANDALONE:
case SOFTRF_MODEL_ACADEMY:
if (eui_le == 0x0016c001f047ac30)
if (eui_le == 0x0016c001f047ac30) {
/* Ebyte E80-900M2213S */
#if 1
radio_semtech->setDioAsRfSwitch(0x07, 0x0, 0x02, 0x03, 0x01, 0x0, 0x4, 0x0);
#else
radio_semtech->setRfSwitchTable(rfswitch_dio_pins_ebyte, rfswitch_table_ebyte);
#endif
else
state = radio_semtech->setOutputPower(txpow, false);
} else {
radio_semtech->setRfSwitchTable(rfswitch_dio_pins_hpdtek, rfswitch_table_hpdtek);
state = radio_semtech->setOutputPower(txpow, true);
}
break;

case SOFTRF_MODEL_NEO:
case SOFTRF_MODEL_BADGE:
case SOFTRF_MODEL_PRIME_MK3:
default:
radio_semtech->setRfSwitchTable(rfswitch_dio_pins_hpdtek, rfswitch_table_hpdtek);
state = radio_semtech->setOutputPower(txpow, true);
break;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class LR1110: public LR11x0 {
based on configured output power, preferring the low-power PA. If set to true, only high-power PA will be used.
\returns \ref status_codes
*/
int16_t setOutputPower(int8_t power, bool forceHighPower);
int16_t setOutputPower(int8_t power, bool forceHighPower) override;

/*!
\brief Check if output power is configurable.
Expand All @@ -124,7 +124,7 @@ class LR1110: public LR11x0 {
based on configured output power, preferring the low-power PA. If set to true, only high-power PA will be used.
\returns \ref status_codes
*/
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower) override;

/*!
\brief Set modem for the radio to use. Will perform full reset and reconfigure the radio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class LR1120: public LR11x0 {
Ignored when operating in 2.4 GHz band.
\returns \ref status_codes
*/
int16_t setOutputPower(int8_t power, bool forceHighPower);
int16_t setOutputPower(int8_t power, bool forceHighPower) override;

/*!
\brief Check if output power is configurable.
Expand All @@ -134,7 +134,7 @@ class LR1120: public LR11x0 {
Ignored when operating in 2.4 GHz band.
\returns \ref status_codes
*/
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower) override;

/*!
\brief Set modem for the radio to use. Will perform full reset and reconfigure the radio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class SX1272: public SX127x {
\param useRfo Whether to use the RFO (true) or the PA_BOOST (false) pin for the RF output.
\returns \ref status_codes
*/
int16_t setOutputPower(int8_t power, bool useRfo);
int16_t setOutputPower(int8_t power, bool useRfo) override;

/*!
\brief Check if output power is configurable.
Expand All @@ -222,7 +222,7 @@ class SX1272: public SX127x {
\param useRfo Whether to use the RFO (true) or the PA_BOOST (false) pin for the RF output.
\returns \ref status_codes
*/
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool useRfo);
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool useRfo) override;

/*!
\brief Sets gain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest gain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class SX1278: public SX127x {
\param useRfo Whether to use the RFO (true) or the PA_BOOST (false) pin for the RF output.
\returns \ref status_codes
*/
int16_t setOutputPower(int8_t power, bool useRfo);
int16_t setOutputPower(int8_t power, bool useRfo) override;

/*!
\brief Check if output power is configurable.
Expand All @@ -234,7 +234,7 @@ class SX1278: public SX127x {
\param useRfo Whether to use the RFO (true) or the PA_BOOST (false) pin for the RF output.
\returns \ref status_codes
*/
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool useRfo);
int16_t checkOutputPower(int8_t power, int8_t* clipped, bool useRfo) override;

/*!
\brief Sets gain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest gain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,25 @@ int16_t PhysicalLayer::setOutputPower(int8_t power) {
return(RADIOLIB_ERR_UNSUPPORTED);
}

int16_t PhysicalLayer::setOutputPower(int8_t power, bool forceHighPower) {
(void)power;
(void)forceHighPower;
return(RADIOLIB_ERR_UNSUPPORTED);
}

int16_t PhysicalLayer::checkOutputPower(int8_t power, int8_t* clipped) {
(void)power;
(void)clipped;
return(RADIOLIB_ERR_UNSUPPORTED);
}

int16_t PhysicalLayer::checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower) {
(void)power;
(void)clipped;
(void)forceHighPower;
return(RADIOLIB_ERR_UNSUPPORTED);
}

int16_t PhysicalLayer::setSyncWord(uint8_t* sync, size_t len) {
(void)sync;
(void)len;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ class PhysicalLayer {
\returns \ref status_codes
*/
virtual int16_t setOutputPower(int8_t power);
virtual int16_t setOutputPower(int8_t power, bool forceHighPower);

/*!
\brief Check if output power is configurable. Must be implemented in module class if the module supports it.
Expand All @@ -380,6 +381,7 @@ class PhysicalLayer {
\returns \ref status_codes
*/
virtual int16_t checkOutputPower(int8_t power, int8_t* clipped);
virtual int16_t checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPower);

/*!
\brief Set sync word. Must be implemented in module class if the module supports it.
Expand Down

0 comments on commit ab872ab

Please sign in to comment.