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

Erroneous results during service discovery of custom UUIDs

Hi there,

Background:

I have set-up a gap peripheral device (nRF52832 / SDK 15.0.0) with 1 service with 2 characteristics, each having its own custom 128 bit UUID. i can connect to the peripheral with nRF Connect App and exchange characteristic data  without any problem. All ok so far.

Now i have another central device (also nRF52832 / SDK 15.0.0), which tries to discover these services via the SDK API's  (sd_ble_gattc_primary_services_discover() / sd_ble_gattc_characteristics_discover() etc. ), however i see the first signs of the trouble, when in the discovery response of the first characteristic (on_evtgattc_char_discovery_resp()), i get the following  response logged below (contents of "ble_gattc_evt_t", please see the lines highlighted in red (char-decl-handle: , service-uuid: etc..).

---------------------------------------------------------------------------------------

discovering primary services..
GATT ATT MTU on conn-id 0x0 changed to 247
discovered primary service. uuid: 0x2001, type: 2, start-handle: 0x000E, end-handle: 0xFFFF
--> found a service-uuid: 0x2001

discovering char's (0x000E)..
rcvd char discovery resp, char count: 2
char-decl-handle: 0x000F, service-uuid: 0x2001, uuid-type: 3, value-handle: 0x0010
char-decl-handle: 0x0000, service-uuid: 0x9680, uuid-type: 0, value-handle: 0x001E
read resp for char-decl-handle: 0x000F
char-properties: 0x0C
--> found a char-uuid: 0x0001

discovering char-desc's (0x0011)..
rcvd desc discovery resp, desc count: 1
desc-handle: 0x0011, uuid: 0x2803, type: 1

discovering char's (0x0011)..
rcvd char discovery resp, char count: 1
char-decl-handle: 0x0011, service-uuid: 0x2001, uuid-type: 4, value-handle: 0x0012
read resp for char-decl-handle: 0x0011
char-properties: 0x10
--> found a char-uuid: 0x0002

discovering char-desc's (0x0013)..
rcvd desc discovery resp, desc count: 1
desc-handle: 0x0013, uuid: 0x2902, type: 1
found CCCD
on_evtgattc_write_resp()

discovering char-desc's (0x0014)..
error: on_evtgattc_desc_discovery_resp(): 0x10A

discovering char's (0x0014)..
error: on_evtgattc_char_discovery_resp(): 0x10A

---------------------------------------------------------------------------------------

The Problems:
1. first of all, why there is characteristic count of 2 in first characteristic discovery.

2.  the 1st characteristic index is relatively OK (i.e., service-uuid is correct, although uuid-type = 3? (0=ble, 1=vendor, 2=unknown), but the 2nd line is completely junk.

3. (for later perhaps), the 2nd characteristic had cccd / notifications enabled, the notification payload is partly corrupted, and appears to have the same junk bytes as contained in the junk characteristic discovery index mentioned in point 2.

 
   
how could these results be explained? is there something i need to look into, to avoid this?

much thanks in advance!

Parents
  • Hi Tejinder, 

    We need to have you code to know what could be wrong. Also please provide information about your 128 bit UUIDs. 

    I would suggest you to test with 1 service and 1 characteristic first before testing with multiple characteristics. You can refer to the ble_app_uart_c for reference

    Note that the uuid-type (equivalent to our uuid_type in our code I assume) is the index of your base UUID in the UUID database inside softdevice. 

    When you register your first 128 bit UUID base you will have uuid_type = 2 (Vendor begin)

    When you register your 2nd 128bit UUID base, you will have uuid_type =3 for that UUID base. And so on for next UUID bases.

    You would need to register the UUID base you are expecting to discover on the peer device in advance. Otherwise you would need to do extra step to read the UUID value. It's not covered in the discovery library. 

Reply
  • Hi Tejinder, 

    We need to have you code to know what could be wrong. Also please provide information about your 128 bit UUIDs. 

    I would suggest you to test with 1 service and 1 characteristic first before testing with multiple characteristics. You can refer to the ble_app_uart_c for reference

    Note that the uuid-type (equivalent to our uuid_type in our code I assume) is the index of your base UUID in the UUID database inside softdevice. 

    When you register your first 128 bit UUID base you will have uuid_type = 2 (Vendor begin)

    When you register your 2nd 128bit UUID base, you will have uuid_type =3 for that UUID base. And so on for next UUID bases.

    You would need to register the UUID base you are expecting to discover on the peer device in advance. Otherwise you would need to do extra step to read the UUID value. It's not covered in the discovery library. 

Children
Related