This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ble_advertising_init returned error 7

Hi there,

I am working on the SDK13 project template that I am modifying in order to install a vendor type uuid. But my code crash on "advertising_init" and ble_advertising_init returns error invalid parameter. However, I do not find what could be invalid:

My UUID comes from the service tutorial:

#define BLE_UUID_OUR_BASE_UUID              {{0x23, 0xD1, 0x13, 0xEF, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00}} // 128-bit base UUID
#define BLE_UUID_OUR_SERVICE                0xABCD // Just a random, but recognizable value

My problem started when I started to populate the UUIDs table. It seems to be the source but it looks fine:

static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_OUR_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN}}; /**< Universally unique service identifiers. */

My Advertising_init code is almost identical to the service tutorial:

uint32_t      err_code;
ble_advdata_t advdata;

// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));

advdata.name_type               = BLE_ADVDATA_FULL_NAME;
advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
advdata.include_appearance      = true;

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;

// STEP 6: Declare and instantiate the scan response
ble_advdata_t srdata;
memset(&srdata, 0, sizeof(srdata));
srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
srdata.uuids_complete.p_uuids = m_adv_uuids;
// STEP 7: Include scan response packet in advertising
err_code = ble_advertising_init(&advdata, &srdata, &options, on_adv_evt, NULL);

if(err_code != NRF_SUCCESS)
	NRF_LOG_DEBUG("ble_advertising_init returned error %x \r\n",err_code)
APP_ERROR_CHECK(err_code);

Here is my RTT output:

SDH:DEBUG:RAM start at 0x20001fe0.
APP:INFO:ble_stack_init()
APP:INFO:gap_params_init()
APP:INFO:gatt_init()
APP:DEBUG:ble_advertising_init returned error 7 
:ERROR:Fatal

I am on ECLIPSE

  • Hi,

    Could it be that you call advertising_init() before you have set up your vendor specific UUID? I don't know if it can be the problem here, but make sure to initialize all your services before calling advertising_init(). This is necessary because the Softdevice has to register and store all the VS UUIDs before you can put them in your advertising packet.

Related