cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB Why the value is set to 0x3A for CFG_BLE_PREPARE_WRITE_LIST_SIZE in most of the BLE examples

HSing
Associate II

I am trying to understand what parameters I could change to increase throughput.

In the file app_conf.h

/**
 * Maximum supported ATT_MTU size
 */
#define CFG_BLE_MAX_ATT_MTU             (156)
 
/**
 * Size of the storage area for Attribute values
 *  This value depends on the number of attributes used by application. In particular the sum of the following quantities (in octets) should be made for each attribute:
 *  - attribute value length
 *  - 5, if UUID is 16 bit; 19, if UUID is 128 bit
 *  - 2, if server configuration descriptor is used
 *  - 2*DTM_NUM_LINK, if client configuration descriptor is used
 *  - 2, if extended properties is used
 *  The total amount of memory needed is the sum of the above quantities for each attribute.
 */
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE    (1344)
 
/**
 * Prepare Write List size in terms of number of packet with ATT_MTU=23 bytes
 */
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE         ( 0x3A )
 
/**
 * Number of allocated memory blocks
 */
#define CFG_BLE_MBLOCK_COUNT            ( 0x79 )
 
/**
 * Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
 */
#define CFG_BLE_DATA_LENGTH_EXTENSION   1

The comment above "#define CFG_BLE_PREPARE_WRITE_LIST_SIZE     ( 0x3A )" says ATT_MTU for 23 bytes but ATT_MTU, by default, set to 156 bytes.

Could somebody either explain or point to a document that could explain on how to set this variables.

1 REPLY 1
Remi QUINTIN
ST Employee

Please have a look at the application note AN5289. One chapter named "How to start the BLE stack – SHCI_C2_BLE_Init()" explains how the parameters (like CFG_BLE_PREPARE_WRITE_LIST_SIZE and others ...) are initialized with the proper calculated values.

Now I understand the real question is about the increase of the throughput. Look at the BLE_DataThroughput example. Data throughput is done via notifications (server to client) and not with data writing (client to server) with ATT_MTU_MAX = 250.

Note there is also a chapter dedicated to data throughput in AN5289.

The max value of ATT_MTU supported for data communication  is exchanged using the ATT_GATT_EXCHANGE_CONFIG command. If not used, the ATT_MTU value remains to the one by default (23).

hope this helps.