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

Fail to interact with custom characteristics when its UUID is different from its service

Context

I followed these tutorials (which are great btw) and adapted them to have 2 custom services:

  • Nordic UART Service (as provided in examples, no modification)
  • My custom service

In my custom service I added 4 characteristics. All these characteristics share the same ble_uuid128_t base_uuid, which is different from the service they belong to.

  • Service UUID: 0000FFFD-0000-1000-8000-00805F9B34FB
    • Char1:  CAFE0001-1234-1234-1234-123456789000
    • Char2:  CAFE0002-1234-1234-1234-123456789000
    • Char3:  CAFE0003-1234-1234-1234-123456789000
    • Char4:  CAFE0004-1234-1234-1234-123456789000

I use nRF Connect mobile app for Android to test my program.

Problem

When I try to interact (Read/Write/Enable notifications, ...) with my characteristic, the applications hangs forever.
In the logs, the last DEBUG frame is gatt.writeCharacteristic(CHAR_UUID, VALUE)

I tried to change the Service UUID so it matches the one from characteristics(CAFEFFFD-1234-1234-1234-123456789000)
And then that worked ! I was able to successfully Write/Read/etc.


I understand that I register my service UUID with sd_ble_gatts_service_add(), so the SoftDevice indexes the Service UUID.
However it seems that despite attaching my characteristic to the service handle with sd_ble_chracteristics_add(), it seems that some link is missing.
Like... the characteristic base UUID is not registered/indexed/?, only listed (because it appears OK in the Service/Char list after connection and discovery).
I am confused.

Notes:

  • I have set vs_uuid_count to 3 (NUS UUID, Custom service UUID, Custom characteristic UUID). I also tried with 2 with no effect.
  • The RAM is adapted correctly so I have no warning with soft_device_enable()
  • I only advertise my custom service, (not the NUS) but when I connect I see all my services and characteristics with the correct UUIDs
  • The NUS service is working as expected, no matter the configuration used for the custom service

Parents Reply Children
  • If you wanted to create a custom service with the Bluetooth SIG defined UUID base, and with your own custom 16-bit UUID value / octets 12-13 of 128-bit base UUID, then you would normally need to pay a fee to Bluetooth SIG for that. See this page. But this is not the case here, since you are actually using the FIDO UUID.

    I did a quick test here, and it seems to only be hanging when using FIDO UUID(0xFFFD). It could be a bug in the app, or maybe more likely that Android core expect certain requirements to be fullfiled in accordance with the FIDO Bluetooth Specification v1.0 in order to interact with the service/characteristic.

Related