cancel
Showing results for 
Search instead for 
Did you mean: 

LoRaWAN_End_Node_LBM v1.5.0, US915, B-WL5M-SUBG1, TX Power Too Low - with possible solution

JHCarter
Associate III

In testing the LoRaWAN_End_Node_LBM application supplied with STM32CubeWL-1.5.0 release I found that the output power is substantially lower than the same test setup with the LoRaWAN_End_Node application supplied with STM32CubeWL-1.4.0.  This testing was conducted only using the US915 region setting.

First I found that the EIRP was being defined as 16 dBm in Middlewares/Third_Party/LoRaWAN/smtc_modem_core/lr1mac/src/smtc_real/src/region_us_915_defs.h when it should be 24 dBm.

#if defined( LR11XX ) || defined( SX1262 ) || defined( SX1268 )
// region is 30 dBm but radio is 22 dBm ERP (+2 to EIRP)
#define TX_POWER_EIRP_US_915    (24)    // define in dbm
#else
// region is 30 dBm but radio is 14 dBm ERP (+2 to EIRP)
#define TX_POWER_EIRP_US_915    (16)    // define in dbm  // TODO must be checked, SX126x dependent for the max power
#endif

Since the project compiles with the preprocessor symbol -DSX126X the #if condition fails and the maximum transmit power is capped at 14 dBm ERP rather than the correct 22 dBm ERP

You can see that there is a TODO comment there so I think somebody knew that a change was needed.

I implemented this fix:

#if defined( LR11XX ) || defined( SX1262 ) || defined( SX1268 ) || defined( SX126X )
// region is 30 dBm but radio is 22 dBm ERP (+2 to EIRP)
#define TX_POWER_EIRP_US_915    (24)    // define in dbm
#else
// region is 30 dBm but radio is 14 dBm ERP (+2 to EIRP)
#define TX_POWER_EIRP_US_915    (16)    // define in dbm
#endif

 

That got it into the HP path but then the observed output power dropped even more.

I finally found a problem in the sx126x_set_ant_switch() function in Middlewares/Third_Party/SubGHz_Phy/lorawan/radio_drivers/sx126x_driver/src/sx126x.c .  

sx126x_status_t sx126x_set_ant_switch( bool is_tx_on )
{
    RBI_Switch_TypeDef state = RBI_SWITCH_RX;
    uint8_t paSelect = RFO_LP;          // hardcoded — never changed

    if (is_tx_on)
    {
        if (paSelect == RFO_LP)         // always true
            state = RBI_SWITCH_RFO_LP;

        if (paSelect == RFO_HP)         // never true
            state = RBI_SWITCH_RFO_HP;
    }
    RBI_ConfigRFSwitch(state);
    ...
}

The variable paSelect is declared as a local and set to RFO_LP each time the function is called.  It can never be RFO_HP so the second if() statement in the code above will never succeed. The PA selection determined by ral_sx126x_bsp_get_tx_cfg() is communicated to the radio chip via sx126x_set_pa_cfg(), but it is never passed to sx126x_set_ant_switch(). The two functions are decoupled in the layered 1.5.0 architecture, whereas in the 1.4.0 code PA selection and RF switch control occurred in the same function.

The result is (I think) that the RF output is routed to nothing as the antenna switch is set to the LP output.

My quick-and-dirty fix was to declare a static global variable, sx126x_pa_device_sel, update it in sx126x_set_pa_config() and read it in sx126x_set_ant_switch().  Since sx126x_set_pa_config() is always called before sx126x_set_ant_switch() it works.  I know it's a bit ugly.

I would appreciate hearing from anyone who has encountered this and I would appreciate hearing from STMicro that they will be fixing this in the next revision.

1 REPLY 1
Saket_Om
ST Employee

Hello @JHCarter 

Thank you for bringing this issue to our attention.

I reported this internally.

Internal ticket number: CDM0062059 (This is an internal tracking number and is not accessible or usable by customers).

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om