Skip to content

Commit 6d07477

Browse files
committed
added optimal settings for RFO_HP only
fixed wrong help values name added detailled comments fix style-check fix style-check
1 parent f6e165f commit 6d07477

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,25 @@ void STM32WL_LoRaRadio::SUBGRF_SetTxParams(uint8_t paSelect, int8_t power, radio
452452
// RegTxClampConfig = @address 0x08D8
453453
write_to_register(REG_TX_CLAMP, read_register(REG_TX_CLAMP) | (0x0F << 1));
454454

455-
set_pa_config(0x04, 0x07, 0x00, 0x01);
455+
// if in mbed_app.json we have configured rf_switch_config in rfo_hp ONLY
456+
// so "stm32wl-lora-driver.rf_switch_config": "RBI_CONF_RFO_HP"
457+
// in this particular case it's not optimal settings for power<=20dBm
458+
if (board_rf_switch_config == RBI_CONF_RFO_HP) {
459+
// See Section 5.1.2 of the following Application Note
460+
// https://www.st.com/resource/en/application_note/an5457-rf-matching-network-design-guide-for-stm32wl-series-stmicroelectronics.pdf
461+
if (power > 20) {
462+
set_pa_config(0x04, 0x07, 0x00, 0x01);
463+
} else if (power > 17) {
464+
set_pa_config(0x03, 0x05, 0x00, 0x01);
465+
} else if (power > 14) {
466+
set_pa_config(0x02, 0x03, 0x00, 0x01);
467+
} else {
468+
set_pa_config(0x02, 0x02, 0x00, 0x01);
469+
}
470+
} else {
471+
set_pa_config(0x04, 0x07, 0x00, 0x01);
472+
}
473+
456474
if (power > 22) {
457475
power = 22;
458476
} else if (power < -9) {

connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"value": "IS_TCXO_SUPPORTED"
2727
},
2828
"rf_switch_config": {
29-
"help": "Default: CONF_RFO_LP_HP = 0, CONF_RFO_LP = 1, CONF_RFO_HP = 2",
29+
"help": "Default: RBI_CONF_RFO_LP_HP = 0, RBI_CONF_RFO_LP = 1, RBI_CONF_RFO_HP = 2",
3030
"value": "RBI_CONF_RFO_LP_HP"
3131
},
3232
"rf_wakeup_time": {

0 commit comments

Comments
 (0)