@@ -55,6 +55,8 @@ uint8_t crystal_select = MBED_CONF_STM32WL_LORA_DRIVER_CRYSTAL_SELECT;
55
55
56
56
uint8_t board_rf_switch_config = MBED_CONF_STM32WL_LORA_DRIVER_RF_SWITCH_CONFIG;
57
57
58
+ radio_TCXO_ctrl_voltage_t tcxo_ctrl = MBED_CONF_STM32WL_LORA_DRIVER_TCXO_CTRL;
59
+
58
60
59
61
static void SUBGHZ_Radio_IRQHandler (void );
60
62
@@ -80,7 +82,7 @@ using namespace mbed;
80
82
/* *
81
83
* @brief voltage of vdd tcxo.
82
84
*/
83
- #define TCXO_CTRL_VOLTAGE TCXO_CTRL_1_7V
85
+ // #define TCXO_CTRL_VOLTAGE TCXO_CTRL_1_7V
84
86
85
87
/* !
86
88
* FSK bandwidth definition
@@ -466,7 +468,9 @@ void STM32WL_LoRaRadio::SUBGRF_SetTxParams(uint8_t paSelect, int8_t power, radio
466
468
// if in mbed_app.json we have configured rf_switch_config in rfo_hp ONLY
467
469
// so "stm32wl-lora-driver.rf_switch_config": "RBI_CONF_RFO_HP"
468
470
// in this particular case it's not optimal settings for power<=20dBm
469
- if (board_rf_switch_config == RBI_CONF_RFO_HP) {
471
+ // So if we set also rfo_hp_lpfix to 1 then optimize power
472
+ // See https://github.com/ARMmbed/mbed-os/pull/15017#issuecomment-1173455762
473
+ if (board_rf_switch_config == RBI_CONF_RFO_HP && MBED_CONF_STM32WL_LORA_DRIVER_RF_RFO_HP_LPFIX == 1 ) {
470
474
// See Section 5.1.2 of the following Application Note
471
475
// https://www.st.com/resource/en/application_note/an5457-rf-matching-network-design-guide-for-stm32wl-series-stmicroelectronics.pdf
472
476
if (power > 20 ) {
@@ -633,7 +637,7 @@ void STM32WL_LoRaRadio::cold_start_wakeup()
633
637
if (crystal_select == 1 ) {
634
638
calibration_params_t calib_param;
635
639
636
- SUBGRF_SetTcxoMode (TCXO_CTRL_VOLTAGE , MBED_CONF_STM32WL_LORA_DRIVER_RF_WAKEUP_TIME << 6 ); // 100 ms
640
+ SUBGRF_SetTcxoMode (tcxo_ctrl , MBED_CONF_STM32WL_LORA_DRIVER_RF_WAKEUP_TIME << 6 ); // 100 ms
637
641
638
642
calib_param.value = 0x7F ;
639
643
write_opmode_command (RADIO_CALIBRATE, &calib_param.value , 1 );
0 commit comments