Issue using nrf21540 in GPIO-mode with mode pin and multiple advertising set at 10dBM

8551.bluetooth.zip

Hi,

We are using nrf21540 in GPIO mode + mode pin ( and CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL) with an nrf52833.

We are developing under nrf connect sdk 3.0.2.

Using a multiple advertising set (extended advertising) composed by:

  • One set of "legacy advertising"-
  • One set of Long Range advertising (Coded PHY)
  • Both have the the advertsing timings (i.e., interval min and max) set to same value: 100ms( BT_GAP_ADV_FAST_INT_MIN_2) and a150ms(BT_GAP_ADV_FAST_INT_MAX_2)

Using a power analyzer and relating nrf21540 PDN pin and MODE pin, i am observing a strange effect when the overall advertising TX power is set to 10 dBm:

  • only the Long Range advertising respects the 10 dBm, the legacy advertising is always fixed to 20 dBm. Look at the screenshot below, the legacy adv. keeps mode gpio low (i.e., 20 dBm). Also the power consumption is higher during legacy advertising, hint of higher dBm TX.
  • Using the extended advertising with only one advertising set, the issue is not present.

Our code has been devloped using as refrences:

Parents Reply Children
  • longo92 said:
    in case of BT_HCI_VS_LL_HANDLE_TYPE_ADV) is unique for each advretising set (e.g., 0->advertisings et 0, 1->advertising set 1, etc...)?

    Indeed, it is. This will set the TX power for the advertising set with handle 0. 

    So if you have several advertising sets, you need to set the TX power for all advertising sets.

    To clarify, if you are only using bt_le_adv_start(), you should use advertising handle 0, but if you are using bt_le_ext_adv_start(), you will have an advertising handles from bt_le_ext_adv_set_data(), that you can use to set the TX power for that advertising set before you call bt_le_ext_adv_start().

    Best regards,

    Edvin

  • Ok, i have just implemneted setting the tx power for advertising set.

    For getting the adv handle i use 

    bt_hci_get_adv_handle, since 
    bt_le_ext_adv is opaque and you cannot direct access its members.
    Here's my code:
    static struct bt_le_ext_adv *m_p_ext_adv
        [CONFIG_BT_EXT_ADV_MAX_ADV_SET];  // NOTE:
                                          // CONFIG_BT_EXT_ADV_MAX_ADV_SET
                                          // must value at least 2!
    
    //NOTE: advertising sets must be created before setting tx                                      
    static int _set_tx_power_adv(int8_t tx_pwr_lvl) {
        int ret = 0;
        int check_handle = 0;
        uint8_t adv_handle = 0;
        for (uint8_t i = 0; i < CONFIG_BT_EXT_ADV_MAX_ADV_SET; i++) {
            if (m_p_ext_adv[i]) {
                check_handle = bt_hci_get_adv_handle(m_p_ext_adv[i], &adv_handle);
                if (!check_handle) {
                    LOG_INF("Setting adv handle %u", adv_handle);
                    ret = _set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV, adv_handle,
                                        tx_pwr_lvl);
                    if (ret) {  // in vcase of error return
                        return ret;
                    }
                } else {
                    LOG_ERR("Failed to get adv handle (err %d)\n", check_handle);
                }
            }
        }
        return ret;
    }
    I give you a feedback ASAP if is properly working.
  •   ok it works!

    Just for sake of clarity:

    Thanks,

    Alessandro

  • longo92 said:
    Is there an example on  nrf conenct sdk which show how to use multiple advertisings and the tx power?

    Not that I am aware of, unfortunately.

    Best regards,

    Edvin

Related