This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Get NO_MEM error while trying to add second ADV set (S140/52840)

Hi All,

we're developing beacon that advertise both legacy and long range at the same time.

however we got NO_MEM error while adding 2nd adv set

    // ============== Set advertising parameters.
    memset(&m_adv_params_legacy, 0, sizeof(m_adv_params_legacy));

    m_adv_params_legacy.primary_phy     = BLE_GAP_PHY_1MBPS;
    m_adv_params_legacy.duration        = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED;
    m_adv_params_legacy.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
    m_adv_params_legacy.p_peer_addr     = NULL;
    m_adv_params_legacy.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_adv_params_legacy.interval        = APP_ADV_INTERVAL_CONFIG;

    // ============== Set longrange parameters.
    memset(&m_adv_params_longrange, 0, sizeof(m_adv_params_longrange));

    m_adv_params_longrange.primary_phy     = BLE_GAP_PHY_CODED;
    m_adv_params_longrange.secondary_phy   = BLE_GAP_PHY_CODED;
    // m_adv_params_longrange.primary_phy     = BLE_GAP_PHY_1MBPS;
    m_adv_params_longrange.duration        = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED;
    m_adv_params_longrange.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
    m_adv_params_longrange.p_peer_addr     = NULL;
    m_adv_params_longrange.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_adv_params_longrange.interval        = APP_ADV_INTERVAL_CONFIG;


    // ========== init handles
    m_adv_data.adv_data.p_data = m_enc_ibs_adv[0];
    m_adv_data.adv_data.len = m_enc_ibs_adv_len[0];

    m_adv_data.scan_rsp_data.p_data = m_enc_ibs_cfg;
    m_adv_data.scan_rsp_data.len = m_enc_ibs_cfg_len;
    err_code = sd_ble_gap_adv_set_configure(&m_handle_legacy, &m_adv_data, &m_adv_params_legacy);
    APP_ERROR_CHECK(err_code);

#if defined(USE_S140)
    err_code = sd_ble_gap_adv_set_configure(&m_handle_longrange, &m_adv_data, &m_adv_params_longrange);
    APP_ERROR_CHECK(err_code); // NO_MEM error
#endif

any limit on multiple ADV handle on S140 ?

BR,

Sam

Parents
  • Hi,

    Looks like this should have been documented more clearly, but the Softdevice supports only one advertisement set, hence the NO_MEM error when you try to add another one. But as mentioned in the API documentation, the way to work around this is to update the existing set.  You can for instance do this by setting up a repeated timer (the low power app timer module is suitable for this purpose) that periodically restarts advertising. Alternatively, instead of the app timer,  you could use a shorter adv. duration then use the generated timeout event to trigger advertising start with a new paramaters.

    Best regards,

    Vidar

Reply
  • Hi,

    Looks like this should have been documented more clearly, but the Softdevice supports only one advertisement set, hence the NO_MEM error when you try to add another one. But as mentioned in the API documentation, the way to work around this is to update the existing set.  You can for instance do this by setting up a repeated timer (the low power app timer module is suitable for this purpose) that periodically restarts advertising. Alternatively, instead of the app timer,  you could use a shorter adv. duration then use the generated timeout event to trigger advertising start with a new paramaters.

    Best regards,

    Vidar

Children
No Data
Related