@@ -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
@@ -76,12 +78,6 @@ static uint8_t _active_modem;
76
78
using namespace std ::chrono;
77
79
using namespace mbed ;
78
80
79
-
80
- /* *
81
- * @brief voltage of vdd tcxo.
82
- */
83
- #define TCXO_CTRL_VOLTAGE TCXO_CTRL_1_7V
84
-
85
81
/* !
86
82
* FSK bandwidth definition
87
83
*/
@@ -466,7 +462,9 @@ void STM32WL_LoRaRadio::SUBGRF_SetTxParams(uint8_t paSelect, int8_t power, radio
466
462
// if in mbed_app.json we have configured rf_switch_config in rfo_hp ONLY
467
463
// so "stm32wl-lora-driver.rf_switch_config": "RBI_CONF_RFO_HP"
468
464
// 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 ) {
470
468
// See Section 5.1.2 of the following Application Note
471
469
// https://www.st.com/resource/en/application_note/an5457-rf-matching-network-design-guide-for-stm32wl-series-stmicroelectronics.pdf
472
470
if (power > 20 ) {
@@ -633,7 +631,7 @@ void STM32WL_LoRaRadio::cold_start_wakeup()
633
631
if (crystal_select == 1 ) {
634
632
calibration_params_t calib_param;
635
633
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
637
635
638
636
calib_param.value = 0x7F ;
639
637
write_opmode_command (RADIO_CALIBRATE, &calib_param.value , 1 );
0 commit comments