Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,25 @@ void STM32WL_LoRaRadio::SUBGRF_SetTxParams(uint8_t paSelect, int8_t power, radio
// RegTxClampConfig = @address 0x08D8
write_to_register(REG_TX_CLAMP, read_register(REG_TX_CLAMP) | (0x0F << 1));

set_pa_config(0x04, 0x07, 0x00, 0x01);
// if in mbed_app.json we have configured rf_switch_config in rfo_hp ONLY
// so "stm32wl-lora-driver.rf_switch_config": "RBI_CONF_RFO_HP"
// in this particular case it's not optimal settings for power<=20dBm
if (board_rf_switch_config == RBI_CONF_RFO_HP) {
// See Section 5.1.2 of the following Application Note
// https://www.st.com/resource/en/application_note/an5457-rf-matching-network-design-guide-for-stm32wl-series-stmicroelectronics.pdf
if (power > 20) {
set_pa_config(0x04, 0x07, 0x00, 0x01);
} else if (power > 17) {
set_pa_config(0x03, 0x05, 0x00, 0x01);
} else if (power > 14) {
set_pa_config(0x02, 0x03, 0x00, 0x01);
} else {
set_pa_config(0x02, 0x02, 0x00, 0x01);
}
} else {
set_pa_config(0x04, 0x07, 0x00, 0x01);
}

if (power > 22) {
power = 22;
} else if (power < -9) {
Expand Down
2 changes: 1 addition & 1 deletion connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"value": "IS_TCXO_SUPPORTED"
},
"rf_switch_config": {
"help": "Default: CONF_RFO_LP_HP = 0, CONF_RFO_LP = 1, CONF_RFO_HP = 2",
"help": "Default: RBI_CONF_RFO_LP_HP = 0, RBI_CONF_RFO_LP = 1, RBI_CONF_RFO_HP = 2",
"value": "RBI_CONF_RFO_LP_HP"
},
"rf_wakeup_time": {
Expand Down