cancel
Showing results for 
Search instead for 
Did you mean: 

aci_gatt_add_char_desc return error (edited: BLE_STATUS_OUT_OF_MEMORY) BLE_STATUS_INVALID_PARAMS

YGail.2
Associate III

@I'm trying to add a descriptor to my BLE characteristic.

#define COPY_DESC_UUID(uuid_struct)    COPY_UUID_128(uuid_struct,0x00,0x00,0x29,0x02,0x00,0x00,0x10,0x00,0x80,0x00,0x00,0x80,0x5f,0x9b,0x34,0xfb)
 
 
  COPY_DESC_UUID(uuid.Char_UUID_128);
 
  uint16_t byte=0x0000;
ret=aci_gatt_add_char_desc(
		CustomContext.CustomSvcHdle,
		CustomContext.CustomCharHdle,
        UUID_TYPE_128, &uuid,
		10,
		2,
		(void *)&(byte),
		ATTR_PERMISSION_NONE,
		ATTR_ACCESS_READ_WRITE,
		0x01,
		0x10,
		0x00,
        &(CustomContext.CustomDescHdle));

However it returns BLE_STATUS_INVALID_PARAMS and I cannot figure why.

2 REPLIES 2
YGail.2
Associate III

I found an error Char_Desc_Value_Max_Len has to be the same length as Char_Desc_Value_Length as the argument Is_Variable is set to 0.

However I now have another annyoing error, which I cannot get rid of: BLE_STATUS_OUT_OF_MEMORY

I tried to increase CFG_BLE_ATT_VALUE_ARRAY_SIZE to 1340 but it's not solving the problem.

For this test project I have only 1 user service 1 user char 1 enable link. This cannot be that I can define with ease 5 char for 2 service in other projects and failed in memory by adding a descriptor for a single char.

YGail.2
Associate III

For all who struggle as me with the CCCD. The WBs provide thr 2902 desciptor by default. No extra code needed.

Would be however good to know why my memory always ran out.