@@ -55,6 +55,8 @@ uint8_t crystal_select = MBED_CONF_STM32WL_LORA_DRIVER_CRYSTAL_SELECT;
5555
5656uint8_t board_rf_switch_config = MBED_CONF_STM32WL_LORA_DRIVER_RF_SWITCH_CONFIG;
5757
58+ radio_TCXO_ctrl_voltage_t tcxo_ctrl = MBED_CONF_STM32WL_LORA_DRIVER_TCXO_CTRL;
59+
5860
5961static void SUBGHZ_Radio_IRQHandler (void );
6062
@@ -76,12 +78,6 @@ static uint8_t _active_modem;
7678using namespace std ::chrono;
7779using namespace mbed ;
7880
79-
80- /* *
81- * @brief voltage of vdd tcxo.
82- */
83- #define TCXO_CTRL_VOLTAGE TCXO_CTRL_1_7V
84-
8581/* !
8682 * FSK bandwidth definition
8783 */
@@ -466,7 +462,9 @@ void STM32WL_LoRaRadio::SUBGRF_SetTxParams(uint8_t paSelect, int8_t power, radio
466462 // if in mbed_app.json we have configured rf_switch_config in rfo_hp ONLY
467463 // so "stm32wl-lora-driver.rf_switch_config": "RBI_CONF_RFO_HP"
468464 // in this particular case it's not optimal settings for power<=20dBm
469- if (board_rf_switch_config == RBI_CONF_RFO_HP) {
465+ // So if we set also rfo_hp_lpfix to 1 then optimize power
466+ // See https://github.com/ARMmbed/mbed-os/pull/15017#issuecomment-1173455762
467+ if (board_rf_switch_config == RBI_CONF_RFO_HP && MBED_CONF_STM32WL_LORA_DRIVER_RF_RFO_HP_LPFIX == 1 ) {
470468 // See Section 5.1.2 of the following Application Note
471469 // https://www.st.com/resource/en/application_note/an5457-rf-matching-network-design-guide-for-stm32wl-series-stmicroelectronics.pdf
472470 if (power > 20 ) {
@@ -633,7 +631,7 @@ void STM32WL_LoRaRadio::cold_start_wakeup()
633631 if (crystal_select == 1 ) {
634632 calibration_params_t calib_param;
635633
636- SUBGRF_SetTcxoMode (TCXO_CTRL_VOLTAGE , MBED_CONF_STM32WL_LORA_DRIVER_RF_WAKEUP_TIME << 6 ); // 100 ms
634+ SUBGRF_SetTcxoMode (tcxo_ctrl , MBED_CONF_STM32WL_LORA_DRIVER_RF_WAKEUP_TIME << 6 ); // 100 ms
637635
638636 calib_param.value = 0x7F ;
639637 write_opmode_command (RADIO_CALIBRATE, &calib_param.value , 1 );
0 commit comments