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

Discovering a VS UUID Characterisic, but it shows UUID as 0

Hi,

I am running SDK15, and using the example ble_app_interactive in ble_central and peripheral. I am trying to discover services and characteristic from a peripheral device, using NRF52 DK as a central device. There is a lot of services and VS services and characteristic in the peripheral. I can discover the services, and see the VS UUID services. As seen on picture:

But when i try to discover the characteristics in the VS services, it writes out the UUID as 0. I have also made it print out it handles and it does have it's handles Both things is shown in pictures below.

The UUID is 0. This is by using gatt characteristics <address> 2EAF.

If i then try to write gatt characteristics <address> AE62. I still don't get UUID, but my progam also crashes and gives me error code 11, but this is in the CCCD descriptor, as seen on picture:

I have made extra logging. I have also increased NRF_SDH_BLE_VS_UUID_COUNT in sdk_config. I have also increased my maximum characterstics and services. Hope you can help.

Regards Andreas 

Parents
  • Hi Dresse, 

    Please post a full log of your test, including the commands you type in. I don't see the part where you find the VS services I would suggest you also test first with connecting to ble_app_uart, just to test if it would work with a simple custom profile. 

  • Alright, I now have the full log. I have added some extra text to the program, so I know where it is, hope you can see past that. The first log file, show the communation between the hearingaid, and the Nordic.

     

    I also did a test where I try to connect, to my phone, and setting up my GATT server on my phone with a custom service UUID, and custom characteristic UUID. And that worked perfectly:

    I think it has to do with some settings in the config file or where ever. The hearing aid have 5 custom VS UUID services and quite a few VS UUID characteristics. I have already turned up NRF_SDH_BLE_VS_UUID_COUNT, but perhaps I have to turn another setting up?

  • Thanks Dresse,  I have reproduced the issue here with the ble_app_uart. Seems like we have an issue if it's not the 16 bit Bluetooth UUID. I will investigate a little bit more and get back to you.

  • Hi Dresse, 

    I found that in the code, when we find an 128 bit UUID we only assign the value of the 128 bit UUID base into the UUID database, without assigning the 16 bit short UUID of that service to the service uuid. So that why they were all 0. So if you add this line of code

                    mp_device_srv[conn_handle]->services[i].uuid.uuid = (uuid.uuid128[13]<<8)+uuid.uuid128[12];

    after  

    err_code = sd_ble_uuid_vs_add(&uuid, &mp_device_srv[conn_handle]->services[i].uuid.type);
    APP_ERROR_CHECK(err_code);

    inside on_read_rsp() in ble_m.c , then you should be able to see the UUID on the first time when you do service discovery. 

    In addition , in characteristic discovery we won't take in to account that the characteristic may have different base UUID, we assume that the characteristic would have same base uuid as the service. 

    Could you update the code, and also let me know what the problem you currently have ?  I would suggest you to test with the ble_app_uart first before you test with your device. 

  • So, I don't quite understand what you mean about base uuid. I have attached one of the custom uuid, that is in the hearing aid.

     

    I still have my problem of not being able to see the custom characteristics inside the custom service, well I can see it, but I can't see the specific uuid for it. But if I understand what you said correctly, because my custom characteristics, does not have the same base uuid as the service, it can't see it?

    And you are suggesting me to test with ble_app_uart, but do you mean ble_app_uart_c? Because my nrf52 dk is acting as a central and connecting with a peripheral.

  • Hi Dresse, 

    Yes you can test with the ble_app_uart. The GAP role is a little bit different but the service discovery from the GATT client is the same. 
    We have the base UUID which is the 128 bit UUID and the short 16 bit UUID which is byte 12 and 13 inside the 128 bit UUID. This is explained in the description of sd_ble_uuid_vs_add() 

    You can use nRF Connect on the phone and do service discovery for the ble_app_uart you can see how the service and characteristic share the same base UUID and only byte 12 and 13 are different. 

    In your att table, I can see that all characteristics and service have different base UUID. 

    In this case you would need to modify the ble_m.c library to support UUID read on the characteristic discovery, the same way as we have in the service discovery. Please have a look at  on_primary_srv_discovery_rsp() and on_read_rsp() function, where we do a sd_ble_gattc_read() on each service that has the uuid.type == BLE_UUID_TYPE_UNKNOWN

    You would need to add the code to do the same when doing characteristic discovery. 

    I'm a little bit busy at the moment, if I managed to have time I can try to implement but I would suggest you to try first. 

  • Thanks, that explains a lot! I will try to implement it myself.

Reply Children
No Data