cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB - How to calculate Max_Attribute_Records parameter

DS.4
Senior II

Hi,

What is the general rule for computing the max attributes records parameter for:

aci_gatt_add_service

Can you supply a general formula for all characteristic types:

#define CHAR_PROP_NONE                           0x00U
#define CHAR_PROP_BROADCAST                      0x01U
#define CHAR_PROP_READ                           0x02U
#define CHAR_PROP_WRITE_WITHOUT_RESP             0x04U
#define CHAR_PROP_WRITE                          0x08U
#define CHAR_PROP_NOTIFY                         0x10u
#define CHAR_PROP_INDICATE                       0x20U
#define CHAR_PROP_SIGNED_WRITE                   0x40U
#define CHAR_PROP_EXT                            0x80U

Thanks!

1 REPLY 1
Remi QUINTIN
ST Employee

Some information can be found in AN5289 chapter 7.6.4. But need to be completed.

Formula for GATT database needs is (in bytes):

(number of services) x 48 + (number of attributes) x 40 + CFG_BLE_ATT_VALUE_ARRAY_SIZE 

with CFG_BLE_ATT_VALUE_ARRAY_SIZE = 1344 (defined in app_conf.h)

The max size cannot be changed by the user's FW, the limitation is resulting from the M0+ FW stack.

The size allocated for each service and characteristic is linked to the GATT specification.

The max size is different for the different stacks, calculation is done in M0 under different conditions

For WB55 full stack, the max value is 10.5kbytes

For WB55 light stack, the max value is the same as the full one.

The size will depend on the flash/SRAM size, sizes are different for WB15 => only 2.7KB for the full BLE stack.

and depends also on the presence of THREAD stack.

See the joined picture.