Skip to content

Commit

Permalink
Merge pull request #15017 from hallard/STM32WL_HP_optimal
Browse files Browse the repository at this point in the history
STM32WL fixed current consumption for mode RBI_CONF_RFO_HP
  • Loading branch information
0xc0170 authored Aug 30, 2021
2 parents d2a88f4 + 6d07477 commit 539d1c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
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

0 comments on commit 539d1c7

Please sign in to comment.