cancel
Showing results for 
Search instead for 
Did you mean: 

What limits the values in SHCI_C2_Ble_Init_Cmd_Param_t when calling SHCI_C2_BLE_Init() for different processors?

jro
Associate III

Trying to port code written for WB55 or WB50 onto a WB15. Obviously there's less memory available, but apparently zero documentation on what this means in the Real World. I've managed to squeeze a version of my basic application into the WB15 by making the following changes in app_conf.h:

  • CFG_BLE_NUM_GATT_ATTRIBUTES 68 -> 48
  • CFG_BLE_ATT_VALUE_ARRAY_SIZE  (1344) -> (500)

Why does this work? Is there something I can do elsewhere to give CPU2 more memory to play with? Using IAR EWARM, looking at the link map there's plenty of spare space in SRAM2, though I have had to allocate CSTACK and HEAP in SRAM2.

Any help appreciated...

5 REPLIES 5
jro
Associate III

No-one? C'mon, I know there's ST employees on here...

jro
Associate III

Two months further on, still no response... sigh.

jro
Associate III

@Remi QUINTIN​ , @Christophe Arnal​  - you seem to be well-informed about this - could you please give me (and the community) some guidance? Despite the BLE full stack using 26kb of the STM32WB15's 48k of RAM, I don't seem to be able to increase the number and size of GATT attributes and their values beyond very meagre limits. There doesn't appear to be any documentation about acceptable ranges of values for the members of SHCI_C2_Ble_Init_Cmd_Param_t, though it's very possible I've missed it - there's a lot of documents to go through! Any places where trade-offs can be made would be handy to know, e.g. if the value array can be bigger if the number of supported links is smaller.

jro
Associate III

@Remi QUINTIN​ , @Christophe Arnal​ 

What is it about this question that you're taking over 5 months to not answer it? You're clearly on the forum answering others' questions... if it's unclear what I want to know, please ask me to clarify, I'll be happy to do so.

Remy ISSALYS
ST Employee

Hello,

A wiki page is under redaction about this topic. The following parameters can be configured by the user:

  • CFG_BLE_NUM_GATT_SERVICES:

Defines the maximum number of attribute records related to all the required characteristics that can be stored in the GATT database, for the specific BLE user application. For each characteristic, the number of attribute records goes from two to five depending on the characteristic properties:

> Minimum of two (one for declaration and one for the value)

> Add one more record for each additional property: notify or indicate, broadcast, extended property.

The total calculated value must be increased by 9, due to the records related to the standard attribute profile and GAP service characteristics, and automatically added when initializing GATT and GAP layers.

  • CFG_BLE_NUM_GATT_ATTRIBUTES:

Defines the maximum number of services that can be stored in the GATT database. Note that the GAP and GATT services are automatically added at initialization so this parameter must be the number of user services increased by two.

  • CFG_BLE_ATT_VALUE_ARRAY_SIZE:

Defines the size of the storage area for the attribute values.

Each characteristic contributes to the Attribute Value Array Size as follow:

Characteristic value length plus:

– 5 bytes if characteristic UUID is 16 bits

– 19 bytes if characteristic UUID is 128 bits

– 2 bytes if characteristic has a server configuration descriptor

– 2 bytes * CFG_BLE_NUM_LINK if the characteristic has a client configuration descriptor

– 2 bytes if the characteristic has extended properties

Each descriptor contributes to the Attribute Value Array Size as follow:

Descriptor length

The max size of the GATT database is fixed and done in M0, max size depends on stack type and WB family. The limitation is:

CFG_BLE_NUM_GATT_SERVICES x 48 + CFG_BLE_NUM_GATT_ATTRIBUTES x 40 + CFG_BLE_ATT_VALUE_ARRAY_SIZE < (max_size) 

For WB55, with light stack configuration the GATT database max size is equals to 10784 bytes.

For WB15, with light stack configuration the GATT database max size is equals to 2684 bytes and with full stack configuration is 2804 bytes.

Best Regards