Merge pull request #15312 from hallard/prep_rak3172sip

STMWL32 preparation for new chip rak3172sip
pull/15322/head
Martin Kojtal 2022-08-17 13:11:07 +02:00 committed by GitHub
commit b482f2dcec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 11 deletions

View File

@ -55,6 +55,8 @@ uint8_t crystal_select = MBED_CONF_STM32WL_LORA_DRIVER_CRYSTAL_SELECT;
uint8_t board_rf_switch_config = MBED_CONF_STM32WL_LORA_DRIVER_RF_SWITCH_CONFIG;
radio_TCXO_ctrl_voltage_t tcxo_ctrl = MBED_CONF_STM32WL_LORA_DRIVER_TCXO_CTRL;
static void SUBGHZ_Radio_IRQHandler(void);
@ -76,12 +78,6 @@ static uint8_t _active_modem;
using namespace std::chrono;
using namespace mbed;
/**
* @brief voltage of vdd tcxo.
*/
#define TCXO_CTRL_VOLTAGE TCXO_CTRL_1_7V
/*!
* FSK bandwidth definition
*/
@ -466,7 +462,9 @@ void STM32WL_LoRaRadio::SUBGRF_SetTxParams(uint8_t paSelect, int8_t power, radio
// 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) {
// So if we set also rfo_hp_lpfix to 1 then optimize power
// See https://github.com/ARMmbed/mbed-os/pull/15017#issuecomment-1173455762
if (board_rf_switch_config == RBI_CONF_RFO_HP && MBED_CONF_STM32WL_LORA_DRIVER_RF_RFO_HP_LPFIX == 1) {
// 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) {
@ -633,7 +631,7 @@ void STM32WL_LoRaRadio::cold_start_wakeup()
if (crystal_select == 1) {
calibration_params_t calib_param;
SUBGRF_SetTcxoMode(TCXO_CTRL_VOLTAGE, MBED_CONF_STM32WL_LORA_DRIVER_RF_WAKEUP_TIME << 6); //100 ms
SUBGRF_SetTcxoMode(tcxo_ctrl, MBED_CONF_STM32WL_LORA_DRIVER_RF_WAKEUP_TIME << 6); //100 ms
calib_param.value = 0x7F;
write_opmode_command(RADIO_CALIBRATE, &calib_param.value, 1);

View File

@ -20,6 +20,15 @@
#define RBI_CONF_RFO_LP_HP 0
#define RBI_CONF_RFO_LP 1
#define RBI_CONF_RFO_HP 2
// Some boards such as LoRa-E5 and RAK3172 have only RFO_HP path wired
// thus, in EU868 mode, TX peak is 80mA (over consumption)
// We made a fix that decrease consumption according datasheet but
// since fix breaks HW machting network, transmit range may be lowered so
// it's depending on what you want to achieve, hi range or low consumption
// Setting RBI_CONF_RFO_HP_LPFIX decrease power according datasheet but can
// reduce range (long ones) due to bad HW macthing network on the both modules
// See https://github.com/ARMmbed/mbed-os/pull/15017#issuecomment-1173455762
#define RBI_CONF_RFO_HP_LPFIX 3
typedef enum {
RBI_SWITCH_OFF = 0,

View File

@ -26,10 +26,18 @@
"help": "Default: Internal XO = 0, IS_TCXO_SUPPORTED = 1",
"value": "IS_TCXO_SUPPORTED"
},
"tcxo_ctrl": {
"help": "TCXO Control voltage. Default: TCXO control TCXO_CTRL_1_7V (RAK3172SIP use TCXO_CTRL_3_0V)",
"value": "TCXO_CTRL_1_7V"
},
"rf_switch_config": {
"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_rfo_hp_lpfix": {
"help": "Fix high power consumption when only RFO_HP is used on some boards. No fix = 0, Fix = 1",
"value": 1
},
"rf_wakeup_time": {
"help": "Radio maximum wakeup time (in ms)",
"value": 10