@@ -452,7 +452,25 @@ void STM32WL_LoRaRadio::SUBGRF_SetTxParams(uint8_t paSelect, int8_t power, radio
452
452
// RegTxClampConfig = @address 0x08D8
453
453
write_to_register (REG_TX_CLAMP, read_register (REG_TX_CLAMP) | (0x0F << 1 ));
454
454
455
- set_pa_config (0x04 , 0x07 , 0x00 , 0x01 );
455
+ // if in mbed_app.json we have configured rf_switch_config in rfo_hp ONLY
456
+ // so "stm32wl-lora-driver.rf_switch_config": "RBI_CONF_RFO_HP"
457
+ // in this particular case it's not optimal settings for power<=20dBm
458
+ if (board_rf_switch_config == RBI_CONF_RFO_HP) {
459
+ // See Section 5.1.2 of the following Application Note
460
+ // https://www.st.com/resource/en/application_note/an5457-rf-matching-network-design-guide-for-stm32wl-series-stmicroelectronics.pdf
461
+ if (power > 20 ) {
462
+ set_pa_config (0x04 , 0x07 , 0x00 , 0x01 );
463
+ } else if (power > 17 ) {
464
+ set_pa_config (0x03 , 0x05 , 0x00 , 0x01 );
465
+ } else if (power > 14 ) {
466
+ set_pa_config (0x02 , 0x03 , 0x00 , 0x01 );
467
+ } else {
468
+ set_pa_config (0x02 , 0x02 , 0x00 , 0x01 );
469
+ }
470
+ } else {
471
+ set_pa_config (0x04 , 0x07 , 0x00 , 0x01 );
472
+ }
473
+
456
474
if (power > 22 ) {
457
475
power = 22 ;
458
476
} else if (power < -9 ) {
0 commit comments