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

SoftDevice return parameter

Hi,

I'm using S132 SD 6.1.0. I'm transferring some advertising data to the SoftDevice and it returns INVALD_PARAMETER. How can I find out, where the problem of the SoftDevice is? Are there any rules or is there any documentation where I can find out what's wrong with these parameters? Some detailed description or documentation would be very helpfull. Thanks in advance for any help!!!

Kind regards

Sascha

  • Hi Sascha,

    I assume you are referring to the sd_ble_gap_adv_set_configure() function? It will return NRF_ERROR_INVALID_PARAM if the parameter check fails. There are also some return values used for more specific errors, but unfortunately NRF_ERROR_INVALID_PARAM could be caused by quite a few different problems. From API doc (components\softdevice\s132\headers\ble_gap.h):

     * @retval ::NRF_ERROR_INVALID_PARAM                   Invalid parameter(s) supplied:
     *                                                      - Invalid advertising data configuration specified. See @ref ble_gap_adv_data_t.
     *                                                      - Invalid configuration of p_adv_params. See @ref ble_gap_adv_params_t.
     *                                                      - Use of whitelist requested but whitelist has not been set,
     *                                                        see @ref sd_ble_gap_whitelist_set.

    I need to see part of your code to give more specific advice.

    Einar

  • Hi,

    here is the advertising data, which I send to the function:

    /* Struct that contains pointers to the encoded advertising data. */
    static uint8_t m_enc_advdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX]; /**< Buffer for storing an encoded advertising set. */
    static uint8_t m_enc_srdata[BLE_GAP_ADV_SET_DATA_SIZE_MAX]; /**< Buffer for storing an encoded advertising set. */
    // raw data of the advertising packet
    static uint8_t adv_raw_data[ ] = { LEN_FLAGS, ID_FLAGS, FLAGS, LEN_DEVICE_NAME, ID_DEVICE_NAME, DEVICE_NAME_RAW };
    // raw data of the scan response packet
    static uint8_t scr_raw_data[ ] = { LEN_SERVICES, ID_SERVICES, INCOMPLETE_SERVICES, LEN_MANUFACTURER, ID_MANUFACTURER, MANUFACTURER};
    
    
    this->Advertising_Instance->adv_data.adv_data.p_data = m_enc_advdata;
    this->Advertising_Instance->adv_data.adv_data.len = BLE_GAP_ADV_SET_DATA_SIZE_MAX;
    this->Advertising_Instance->adv_data.scan_rsp_data.p_data = m_enc_srdata;
    this->Advertising_Instance->adv_data.scan_rsp_data.len = BLE_GAP_ADV_SET_DATA_SIZE_MAX;
    
    this->Advertising_Instance->adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
    this->Advertising_Instance->adv_params.p_peer_addr = NULL;
    this->Advertising_Instance->adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
    this->Advertising_Instance->adv_params.interval = 64;
    this->Advertising_Instance->adv_params.duration = 0x4650;
    this->Advertising_Instance->adv_params.primary_phy = BLE_GAP_PHY_1MBPS;
    this->Advertising_Instance->adv_params.secondary_phy = BLE_GAP_PHY_1MBPS;
    
    this->Advertising_Instance->adv_modes_config.ble_adv_fast_enabled = true;
    
    ble_advdata_t adv_data;
    memset(&adv_data, 0, sizeof(adv_data));
    
    adv_data.name_type = BLE_ADVDATA_FULL_NAME;
    adv_data.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    adv_data.include_appearance = false;
    
    // ble_advdata_t scr_data;
    // scr_data.name_type = BLE_ADVDATA_FULL_NAME;
    // scr_data.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    // scr_data.include_appearance = false;
    
    ret = ble_advdata_encode(&adv_data, this->Advertising_Instance->adv_data.adv_data.p_data, &this->Advertising_Instance->adv_data.adv_data.len);
    APP_ERROR_CHECK(ret);
    
    //set advertising raw data
    this->Advertising_Instance->adv_data.adv_data.len = sizeof(adv_raw_data);
    this->Advertising_Instance->adv_data.adv_data.p_data = adv_raw_data;
    
    //set scan response raw data
    this->Advertising_Instance->adv_data.scan_rsp_data.len = sizeof(scr_raw_data);
    this->Advertising_Instance->adv_data.scan_rsp_data.p_data = scr_raw_data;
    
    ret = sd_ble_gap_adv_set_configure(&this->Advertising_Instance->adv_handle, &this->Advertising_Instance->adv_data, &this->Advertising_Instance->adv_params);
    APP_ERROR_CHECK(ret);
    
    this->Advertising_Instance->initialized = true;

    It's written in C++ and I provide the data to the ble_advertising_start function in this way:

    ret_code_t err_code = ble_advertising_start(this->Advertising_Instance, BLE_ADV_MODE_FAST);

    Thanks in advance!!!

    Kind regards

    Sascha

  • Hi,

    I did not spot anything that should upset sd_ble_gap_adv_set_configure(), but it is easy to miss something. It might be easier to start by removing must of the configuration until you have something that is working, then adding stuff back until you get the error. Then finding the explanation should be simple.

    Can you verify (using for instance breakpoints) weather NRF_ERROR_INVALID_PARAM is returned from the call to sd_ble_gap_adv_set_configure() or sd_ble_gap_adv_start(), both in the end of the implementation of ble_advertising_start() in components\ble\ble_advertising\ble_advertising.c?

Related