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

Issue discovering services using discovery module

Good afternoon, 

  I have been having issues discovering any service within a peer device which i have recently paired with. I am using Nordic SDK 15.2 and softdevice 6.1 on a nrf52840 development board. I am currently using the BLE_Central_multilink example and have modified it to pair with another device. The application pairs successfully however when attempting to discover the services the database discovery module returns BLE_DB_DISCOVERY_SRV_NOT_FOUND.  I have attempted to add the service i want to discover before starting the database discovery process like this: 


ret_code_t err_code = ble_db_discovery_init(db_disc_handler);
APP_ERROR_CHECK(err_code);

ble_uuid_t BATTERY_SERVICE;
BATTERY_SERVICE.uuid = 0x108A;
BATTERY_SERVICE.type = 2;

uint32_t error_code = ble_db_discovery_evt_register(&BATTERY_SERVICE);
APP_ERROR_CHECK(error_code);

 The above code however does not work. I have noticed that when i try to discover the services of another ble application in the SDK the database discovery module returns BLE_DB_DISCOVERY_COMPLETE however i cannot replicate this with my peer device for some reason. I am using SEGGER studio on a windows machine. Any help would be very much appreciated. 

thanks, 

Gian

Parents
  • Hi,

    It is not clear to me what service UUID you are searching for. The line "BATTERY_SERVICE.type = 2;" could do anything, as the type field is an index into the SoftDevice's table of vendor specific base UUIDs. If you have a look at the ble_app_multilink_central example, you will see an example of a service being initialized and the UUID for the service registered with the database discovery module, in the function ble_lbs_c_init() in ble_lbs_c.c. You will find that the base UUID is registered with the SoftDevice using sd_ble_uuid_vs_add(), and then the UUID type returend is used when registering the UUID with the database discovery module.

    Hopefully the above will lead you in the right direction.

    Regards,
    Terje

  • I apologize for the for the lack of clarity. I do not know the base UUID for the peer device which i am paired with, however i do have access to some one of its services which i would like to discover using the ble_db_discovery_start() function. Shortly after connecting(pairing) i call the ble_db_discovery_start() function which returns the error BLE_DB_DISCOVERY_SRV_NOT_FOUND within its handler. I believe i made a mistake earlier and that the previous code should be the following: 

    ret_code_t err_code = ble_db_discovery_init(db_disc_handler);
    APP_ERROR_CHECK(err_code);
    
    ble_uuid_t BATTERY_SERVICE;
    BATTERY_SERVICE.uuid = 0x108A;
    BATTERY_SERVICE.type = 1; // since its a 16 bit UUID
    
    uint32_t error_code = ble_db_discovery_evt_register(&BATTERY_SERVICE);
    APP_ERROR_CHECK(error_code);

     Do i still need to add the SIG UUID using sd_ble_uuid_vs_add() even though i do not have the base UUID of the peer device?  Is there a way for me to locate the base UUID of the peer device and add it to the ble stack table with sd_ble_uuid_vs_add() ?  Even with the edited code it still returns the same error. Any help would be very much appreciated, thank you.

Reply
  • I apologize for the for the lack of clarity. I do not know the base UUID for the peer device which i am paired with, however i do have access to some one of its services which i would like to discover using the ble_db_discovery_start() function. Shortly after connecting(pairing) i call the ble_db_discovery_start() function which returns the error BLE_DB_DISCOVERY_SRV_NOT_FOUND within its handler. I believe i made a mistake earlier and that the previous code should be the following: 

    ret_code_t err_code = ble_db_discovery_init(db_disc_handler);
    APP_ERROR_CHECK(err_code);
    
    ble_uuid_t BATTERY_SERVICE;
    BATTERY_SERVICE.uuid = 0x108A;
    BATTERY_SERVICE.type = 1; // since its a 16 bit UUID
    
    uint32_t error_code = ble_db_discovery_evt_register(&BATTERY_SERVICE);
    APP_ERROR_CHECK(error_code);

     Do i still need to add the SIG UUID using sd_ble_uuid_vs_add() even though i do not have the base UUID of the peer device?  Is there a way for me to locate the base UUID of the peer device and add it to the ble stack table with sd_ble_uuid_vs_add() ?  Even with the edited code it still returns the same error. Any help would be very much appreciated, thank you.

Children
Related