2021-04-05 11:23 PM
My general understanding is that the BLE standard supports characteristics with a lenght of up to 512 bytes. I'm using the BlueNRG-MS chip from STM but there the function call to add a characteristic has a uint8_t value for the length parameter
tBleStatus aci_gatt_add_char(uint16_t serviceHandle,
uint8_t charUuidType,
const uint8_t* charUuid,
uint8_t charValueLen,
uint8_t charProperties,
uint8_t secPermissions,
uint8_t gattEvtMask,
uint8_t encryKeySize,
uint8_t isVariable,
uint16_t* charHandle);
So this would allow only a maximum characteristic length of 255 bytes. According to this document the stack itself supports 2 bytes with FW 7.2 or higher. I have 7.23 so this should be fine but I cannot find any reference or example of a BlueNRG-MS middleware that would support a call with
charValueLen
of type
uint16_t
. I also downloaded the latest STSW-BLUENRG-DK and the examples also only support
uint8_t charValueLen
.
2021-04-18 06:26 PM
Try to lower Max_Attribute_Records.
You declared a number too large, which consumed large memory (for attribute declarations) that will not be used in your application.
2021-04-18 11:10 PM
Hi Winfred, thanks for your reply
I played around with this number already, Setting it to 6 (1(service) +4(2*characteristic) +1(notify)) didn't change anything, I still get 0x1F as return value. Are you sure it has to be memory related, cause in bluenrg_def.h is has a define that says "UNKNOWN_ERROR".
I tried to find the treshold and the size limit is 410 bytes. The thing is that I have even more characteristics to add. Is there a know limit that all characteristics may use up in space? I have a total value length of 551 bytes in 5 services and 14 characteristics.
2021-04-20 11:46 PM
0x1F is most likely to be memory related in my opinion. The value was the code for "out of memory" in previous implementation, but now used as some HCI standard error code meaning unspecific error. Otherwise i have no idea what's wrong.
>I tried to find the treshold and the size limit is 410 bytes.
Could you clarify how did you get the size limit?
>Is there a know limit that all characteristics may use up in space? I have a total value length of 551 bytes in 5 services and 14 characteristics.
For MODE2,
The following would be my quick test adding a service and a 440-byte characteristic in addition to default attributes. (which can also be a reference about the memory array used by default attributes). There is no special meaning for the length 440 byte, i just picked up some value larger than 410 randomly.
The followed is calling ACI_GATT_ADD_CHAR with 2-byte value (0x01B8) for charValueLen.
The followed is the event showing ACI_GATT_ADD_CHAR was completed successfully.
2021-04-25 10:53 PM
@Winfred LU
>Could you clarify how did you get the size limit?
Just by reducing it step by step, but as mentioned, there are also other services running. So I suspect that I'm running into this 700 bytes limit
2021-04-26 10:59 PM
Please refer to Release Notes for BlueNRG, BlueNRG-MS Stacks, that comes with DK, by default at:
C:\Program Files (x86)\STMicroelectronics\BlueNRG DK 2.0.2\Docs\bluenrg_fw_stack_release_notes_html\BlueNRG_release_notes.html