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

Adding descriptions to characteristics fails after fixed number

Hello,

I have three custom services. I wanted to add descriptions to the characteristics for easier testing and debug, so I used the typical method to add descriptions:

char_md.p_char_user_desc = user_desc;
char_md.char_user_desc_size = user_desc_len;
char_md.char_user_desc_max_size = user_desc_len;

where I pass the user_desc and user _desc_len arguments into the function that adds the characteristic. I've declared static strings and string lengths of the form:

static uint8_t name_desc[] = "Name";
static uint8_t name_size = 4;

and pass them in. I've checked all the sizes, and even had a version with strlen(), so I don't believe I'm giving it incorrect parameters.

This all works fine as long as I don't do this for more than 15 characteristics; on trying to set the description for a 16th, the services fail to initialize. I have 7 characteristics in one service, 7 in another and 4 in the third, but only 15 of them can have descriptions without failure. It doesn't seem to matter which service I add the 16th one to, it will fail. If I set one more description to NULL in service 2, for example, I can make one more description non-NULL in service 1. Is there some reason for this limit?

Related