Hello, I am trying to implement my custom service with NUS. I have gone through almost all the solutions presented on this forum.
Observations:
-
The board does not advertise.
-
On debugging, the board keeps resetting.
-
ble_advertising_init() generates error code 0x0C i.e. NRF_ERROR_DATA_SIZE. This means that the data is overflowing in the packet.
Procedures performed:
-
Changed p_ble_enable_params->common_enable_params.vs_uuid_count = 1; to p_ble_enable_params->common_enable_params.vs_uuid_count = 2; in softdevice_handler.c
-
Defined static ble_uuid_t m_adv_uuids[] = {{BLE_UUID_NUS_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN}, {BLE_UUID_OUR_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN}};
I have enabled scan response packet as:
static void advertising_init(void)
{
uint32_t err_code;
ble_advdata_t advdata;
// Build advertising data struct to pass into 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_GENERAL_DISC_MODE;
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;
// OUR_JOB: Create a scan response packet and include the list of UUIDs
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;
err_code = ble_advertising_init(&advdata, &srdata, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);
}
With both advertising and scan response packet we should have a total size of 496 bits and should easily accommodate 256 bits from two base UUIDs. Still I am getting NRF_ERROR_DATA_SIZE.
- I have also tried using a single base UUID from NUS with my custom 16 bit service ID. The problem persists even then.
Any suggestions or link would be much appreciated.
Thank you.