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

SD: Characteristics Per Service Limit

Is there a limit to the number of characteristics per (custom) service?

After some testing, it looks like 20 is the maximum (21 causes the device to stop functioning) - is this corrrect and is it documented somewhere?

Thanks :)

Parents
  • The way this works is that there is a static 1.5 kB of memory allocated for the GATT table internally in the softdevice. These can be used for any combination of services, characteristics and descriptors, so there isn't a specific limit as such. Each attribute that is in the attribute table consumes of this memory block, both with its size and some overhead per attribute.

    There is currently no way to increase these 1.5 kB. The only thing you can do is to change characteristics from VLOC_STACK to VLOC_USER. This will move the actual characteristic value out of these 1.5 kB and into the application's RAM space, and hence allow you to add more characteristics. Please note that the effect of doing such move is biggest for characteristics with large values.

    If you try to add more that what there is room for, you will get an error code back, which will normally make your application end up in app_error_handler on top of main.c. This will by default do a reset, but if you uncomment the debug assert handler, it will instead hang in a loop allowing you to inspect where things failed and with what error code.

    Edit: Changed size to the correct 1.5 kB, and changed some parts for clarity.

  • What soft device is this for? Is this information current? Is that same limitation on the S130 SD 2.0.0?

Reply Children
No Data
Related