Hi Nordic Expert,
Recently I wanna run ble_nus service on my nrf51822 platform, you know, sdk 6.0 does have this demo code in s110 directory, but from sdk 6.1 I cann't see it any more. So I try porting it from 6.0 to 6.1. No luck that I got an strange issue when ble begins advertising.
See below code snippet, after nus service is init'd (Nordic UUID should be registered), it goes to this advertising_init funtion. You know, to let upper App know what services are supportted, I have to put my services here, right? But it's weird that each time ble_advdata_set returns with error num and then system reste. But if I replaced nus service UUID as other SIG service, e.g. TX power service, this can work noramally, I can see adverting led is liting. I am so confused what's wrong there? Would you help me?
void advertising_init(uint8_t adv_flags) { uint32_t err_code; ble_advdata_t advdata; ble_advdata_t scanrsp;
ble_uuid_t adv_uuids[] = { //{BLE_UUID_TX_POWER_SERVICE, BLE_UUID_TYPE_BLE}, {BLE_UUID_NUS_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN}, };
m_advertising_mode = BLE_NO_ADV;
// Build and set advertising data
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = false;
advdata.flags.size = sizeof(adv_flags);
advdata.flags.p_data = &adv_flags;
memset(&scanrsp, 0, sizeof(scanrsp));
advdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
advdata.uuids_complete.p_uuids = adv_uuids;
err_code = ble_advdata_set(&advdata, &scanrsp);
APP_ERROR_CHECK(err_code);
}