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

DB Discovery failing with BLE_DB_DISCOVERY_SRV_NOT_FOUND

Hi,

I am trying to connect to a peripheral device but keep getting the above error on DB Discovery.

I am using the nRF52832 on a custom board with S132 and SDK 13.

I register the event like so:

static ble_uuid_t const accs_uuid = 
{
	.type = BLE_UUID_TYPE_VENDOR_BEGIN,
	.uuid = BLE_ACC_SERVICE_UUID,
};    	

ret_code_t err_code = ble_db_discovery_evt_register(&accs_uuid);
APP_ERROR_CHECK(err_code);

and then show the device a peripheral with that service which has been initialised like so:

uint32_t   			err_code;
ble_uuid_t        	service_uuid;
ble_uuid128_t     	base_uuid = BLE_ACC_BASE_UUID;

service_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
service_uuid.uuid = BLE_ACC_SERVICE_UUID;

err_code = sd_ble_uuid_vs_add(&base_uuid, &service_uuid.type);
APP_ERROR_CHECK(err_code);

p_accs->conn_handle = BLE_CONN_HANDLE_INVALID;

err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                &service_uuid,
                                &p_accs->service_handle);
APP_ERROR_CHECK(err_code);

but when connecting to the peripheral I am getting the above error.

Any advice would be greatly appreciated!

Parents
  • I found the answer, when calling sd_ble_uuid_vs_add, the service type is changed to a value that is different to BLE_UUID_TYPE_VENDOR_BEGIN.

    If I use the updated value in my ble_db_discovery_evt_register instead of BLE_UUID_TYPE_VENDOR_BEGIN then I get the DB_DISCOVERY_EVT_COMPLETE as expected.

    For reference my functions now look like so:

    uint32_t            err_code;
    ble_uuid_t          service_uuid;
    ble_uuid128_t       base_uuid = BLE_ACC_BASE_UUID;
    
    service_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
    service_uuid.uuid = BLE_ACC_SERVICE_UUID;
    
    err_code = sd_ble_uuid_vs_add(&base_uuid, &service_uuid.type);
    APP_ERROR_CHECK(err_code);
    
    p_accs->conn_handle = BLE_CONN_HANDLE_INVALID;
    
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                    &service_uuid,
                                    &p_accs->service_handle);
    APP_ERROR_CHECK(err_code);
    
    
    ble_uuid_t accs_uuid = 
    {
        .type = service_uuid.type,
        .uuid =service_uuid.uuid,
    };      
    
    ret_code_t err_code = ble_db_discovery_evt_register(&accs_uuid);
    APP_ERROR_CHECK(err_code);
    

    Thanks for all your help!

Reply
  • I found the answer, when calling sd_ble_uuid_vs_add, the service type is changed to a value that is different to BLE_UUID_TYPE_VENDOR_BEGIN.

    If I use the updated value in my ble_db_discovery_evt_register instead of BLE_UUID_TYPE_VENDOR_BEGIN then I get the DB_DISCOVERY_EVT_COMPLETE as expected.

    For reference my functions now look like so:

    uint32_t            err_code;
    ble_uuid_t          service_uuid;
    ble_uuid128_t       base_uuid = BLE_ACC_BASE_UUID;
    
    service_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
    service_uuid.uuid = BLE_ACC_SERVICE_UUID;
    
    err_code = sd_ble_uuid_vs_add(&base_uuid, &service_uuid.type);
    APP_ERROR_CHECK(err_code);
    
    p_accs->conn_handle = BLE_CONN_HANDLE_INVALID;
    
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                    &service_uuid,
                                    &p_accs->service_handle);
    APP_ERROR_CHECK(err_code);
    
    
    ble_uuid_t accs_uuid = 
    {
        .type = service_uuid.type,
        .uuid =service_uuid.uuid,
    };      
    
    ret_code_t err_code = ble_db_discovery_evt_register(&accs_uuid);
    APP_ERROR_CHECK(err_code);
    

    Thanks for all your help!

Children
No Data
Related