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

Problem detecting 128-bit service w/ 16-bit char using BLE driver.

Setup: DK #1 is running native S110/SDK10/nRF51, one service 128-bit w/ 16-bit char:

Service UUID: 0x0xb1ad
Service UUID type: 0x0x2
Service handle: 0x0x0c
Service handle: 0xc
Characteristic value handle: 0xe
Characteristic CCCD handle: 0xf

DK #2 is running S130 serialization with Linux driver, modified HRM collector:

Received service discovery response

UUID: 0xB1AD, start handle: 0x000C, end handle: 0xFFFF
Discovering characteristics
Received characteristic discovery response, characteristics count: 1
Handle: 0x000D, UUID: 0xBEEF
Discovering descriptors
Received descriptor discovery response, descriptor count: 1
Handle: 0x000D, UUID: 0x2803
Press enter to toggle notifications
Unhandled event with ID: 81

The service and char are correctly detected, but somehow the characteristic descriptor is not (handle 0x000D is returned twice.)

What could the cause be?

How can I find the problem to be on the peripheral or central? LightBLUE app on iPhone shows a descriptor and notify works on the characteristic, so I assume the descriptor is setup alright.

  • By pure luck I found this patch lurking in the pc-ble-driver-py folder /usr/local/lib/python2.7/dist-packages/pc_ble_driver_py/hex/SD20_SDK11.patch, which seems a likely candidate for a fix of the (wrong) behaviour I am seeing:

    diff --git a/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c
    --- a/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c
    +++ b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c
    @@ -586,7 +586,8 @@ static uint32_t gatts_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length
         const uint32_t err_code = ble_gatts_attr_get_rsp_dec(
             p_buffer,
             length,
    -        (ble_gatts_attr_md_t **)&mp_out_params[0],
    +        (ble_uuid_t **)&mp_out_params[0],
    +        (ble_gatts_attr_md_t **)&mp_out_params[1],
             &result_code);
    
  • This is no bug fix for the issue I am seeing. Instead I am now going to try the SD 2.0.1 that comes with the pc-ble-driver-py release which has a newer SD 2.0.1, newer lib/includes and SDK11 patch.

  • Hi Leon,

    Do you have the same issue that the descriptor was wrong when discovering the stock HRM example ?

    Could you take a screenshot of the service discovery result when you use Master Control Panel on PC/Android ?

    It's a little bit complicated to debug this because we need to track down to the serialization library that the python code based on, and then if the issue doesn't lie there, we need to get to the service discovery code.

Related