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

Size of service UUID sdk12.3 (nrf51822) softdevice130

Hi,

Is there a size limit for the vendor specific service UUID? It looks like it should be 16 bits but I can't set more than 4 bits in my code.

I am using the uart central exmaple code sdk12.3 (nrf51822). The ble service UUID (BLE_UUID_NUS_SERVICE) is set at 0x0001. I tried to change it to a different value 0x1485 and now the central device can't connect to peripheral. If I keep the UUID within 4 bits (eg: 0x008) it works. Is there somewhere the UUID size can be set?

Debug log: (no connection, UUID 0x22)

 0> SDH:DEBUG:sd_ble_enable: RAM start at 0x200025e0
 0> APP:INFO: BLE started
 0> :INFO:Fast advertising
 0> :INFO:Connecting to target c651c51bb7ec
 0> :INFO:Connected.
 0> BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x22 for Connection handle 1
 0> BLE_DB_DISC:INFO:Found service UUID 0x22

Debug log: (connected!, UUID 0x08)

 0> SDH:DEBUG:sd_ble_enable: RAM start at 0x200025e0
 0> :INFO:Fast advertising
 0> :INFO:Connecting to target c651c51bb7ec
 0> :INFO:Connected.
 0> BLE_DB_DISC:INFO:Starting discovery of service with UUID 0x8 for Connection handle 1
 0> BLE_DB_DISC:INFO:Found service UUID 0x8
 0> BLE_DB_DISC:INFO:Discovery of service with UUID 0x8 completed with success for Connection handle 1APP:INFO:All Peripheral Services Discovered
  • Sorry but this doesn't make any sense. Firstly GATT UUID is matter of stack so you should refer SoftDevice version (if you use Nordic Soft Device) and not SDK. Second all Nordic SD API work with 128-bit(16-byte) base (in the form of reference to table provisioned through Soft Device API earlier) and 16-bit (2-byte) "short" UUID. Could you be more precise what SDK example you use and what changes you made to the code? COuld you go back to generic example and verify that (indeed) all works fine?

  • I am using softdevice s130v2. I am using the ble_central\ble_app_uart_c and ble_peripheral\ble_app_uart_c example code from sdk12.3.

    I am talking about size of service UUID (BLE_UUID_NUS_SERVICE) which is 0x0001 in the code and not the base UUID (NUS_BASE_UUID) which is 128 bit. Everything works fine in the example code and also in my code if I keep the service UUID < 4 bit. If I change the service UUID to say 0x0022 it won't work.

  • You mean that you are changing the constant on both sides and is stops working depending on how many non-zero bits UUID has? That sounds really strange. Btw. the UUID you talk about has always 16-bits, the fact that some are zeros doesn't make it shorter. Are you sure there isn't some nasty conversion done on top o that constant before you use it as 16-bit unsigned integer in UUID structure? If you are sure that all is correct could you show us radio log from some sniffer/analyzer to see what exactly happens on GATT layer and what is source of the error?

  • Yes, I am just changing the constant on both sides. Its not about the 0s but the bit size of the UUID value itself. I haven't change the device discovery part much. Biggest change in my code is, my device has both central and peripheral role at same time (not sure if the problem is related to that though).

    Can you please point me to some tutorial how to get sniffer/analyzer logs? I am pretty new to BLE programming.

  • Here is link to Nordic cheap sniffing solution (special FW for nRF51 DK or Dongle, unofficial FW for nRF52 Dk can be found on this forum as well). But indeed there are many other tools and variants, from few USD up to dozens of thousands. I would bet that if you go back to stock SDK examples of NUS Central and Peripheral, change just 16bit UUID of the service it will work. Kind of indication where is the problem... but maybe there is some wrong cast or whatever which will be already in the example. In every case there is nothing like "length" of UUID, zeros count indeed, that number is in the end used as 16-bit part of entire 128-bit UUID, trust me;)

Related