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

sd_ble_uuid_encode() returning NRF_ERROR_INVALID_PARAM

When calling sd_ble_uuid_encode() I get NRF_ERROR_INVALID_PARAM in one project while in another I get NRF_SUCCESS with the same params on same SoftDevice(S110 8.0.0) on same DevKit(nRF51422):

image description

image description

The first screen is from SDK 10.0.0, example ble_app_uart and it's fine. The second is ble_app_hrs which is modified so that it advertises BLE_UUID_NUS_SERVICE in scan response (I am trying to reuse bonding from ble_app_uart and just replace heart service with uart service from ble_app_uart). The problem now is that device does not advertise because of this error.

Relevant code:

static ble_uuid_t    m_adv_uuids[] = {{BLE_UUID_NUS_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN}}; // {{0x0001, 0x02}}


static void advertising_init(void)
{ 
    uint32_t      err_code;
    ble_advdata_t advdata;
    ble_advdata_t scanrsp;

    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&advdata, 0, sizeof(advdata));
    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = false;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    memset(&scanrsp, 0, sizeof(scanrsp));
    scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

    ble_adv_modes_config_t options = {0};
    options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
    options.ble_adv_fast_interval = APP_ADV_INTERVAL;
    options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code); // err_code = NRF_ERROR_INVALID_PARAM; from sd_ble_uuid_encode()
}

I compared main.c from both projects (ble_app_uart and ble_app_hrs) to make sure I'm not missing some configuration but I am not. What is wrong here?

Parents
  • have you actually registered the custom UUID and received BLE_UUID_TYPE_VENDOR_BEGIN as a reply or just used it without it meaning anything? You shouldn't use that statically either way, you have no guarantee the UUID registration will return that, even though it currently always does, you should register it and use the one you're returned.

Reply
  • have you actually registered the custom UUID and received BLE_UUID_TYPE_VENDOR_BEGIN as a reply or just used it without it meaning anything? You shouldn't use that statically either way, you have no guarantee the UUID registration will return that, even though it currently always does, you should register it and use the one you're returned.

Children
No Data
Related