Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Changing advertising maximum size with BLE extended advertisin

Hello! I'm currently using nRF52 SDK to create a BLE beacon in which I update the advertising data at runtime.

I'm using the provided ble beacon example as a base for my program, I found that if I configure the extended advertising in the advertising initialization, it actually support up 251 bytes in the advertising data, however I don't seem to be able to change the base size past 0x18. 

This is how my advertising_init() function looks like: 

static void advertising_init(void)
{
    uint32_t      err_code;
    
    uint8_t       flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;

    manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;

    manuf_specific_data.data.p_data = (uint8_t *) m_beacon_info;
    manuf_specific_data.data.size   = APP_BEACON_INFO_LENGTH;

    // Build and set advertising data.
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type             = BLE_ADVDATA_NO_NAME;
    advdata.flags                 = flags;
    advdata.p_manuf_specific_data = &manuf_specific_data;

    // Initialize advertising parameters (used when starting advertising).
    memset(&m_adv_params, 0, sizeof(m_adv_params));

    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
    m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
    m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.duration        = 0;       // Never time out.
    m_adv_params.primary_phy        = BLE_GAP_PHY_AUTO;
    m_adv_params.secondary_phy      = BLE_GAP_PHY_AUTO;
    m_adv_params.set_id             = 4;
    m_adv_params.filter_policy      = BLE_GAP_ADV_FP_ANY;

    err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params);
    APP_ERROR_CHECK(err_code);
}
 

The beacon doesn't let me change its max size however because the following setting doesn't go above 0x18 (24 bytes) or it will output an error:

#define APP_BEACON_INFO_LENGTH          0x17

What am I missing to be able to advertise the 251 bytes? 

Thank you and best regards. 

Gabriel

Parents Reply Children
Related