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

nrf52 advertising multiple services

Hi,

Similar questions have already been posted but they don't seem to fit to my problem...

Basically I want to advertise 3 primary services, starting from the 'experimental_ble_app_blinky' example: the already provided lbs service and two new ones. For the moment, the new services are just copy-pasted-renamed from the lbs and are correctly initialized.

I made three modifications:

  • in advertising_init

    ble_uuid_t adv_uuids[] = {{LBS_UUID_SERVICE, m_lbs.uuid_type}, {OWN_UUID_SERVICE, m_own.uuid_type}, {MY_UUID_SERVICE, m_my.uuid_type}};

    advdata.name_type = BLE_ADVDATA_SHORT_NAME;

  • in softdevice_enable_get_default_config

    p_ble_enable_params->common_enable_params.vs_uuid_count = 3;

As RK often suggests, I set a breakpoint at the ble_advdata_set function and got NRF_ERROR_DATA_SIZE. That's good to know, but I haven't any clue to reduce my advertisment data after reducing to short_name and using the scan response (as the example already does). If I correctly understood the functions, it seems that each service uuid is encoded and needs a size of 0x10 for that... what is definetly too large when the maximum size is 0x1F.

Any suggestions about how to advertise 3 services and remain within the advertising size limitations?

Thanks a lot!

Related