Stack Configurations

Configuring Bluetooth low energy Protocol Stack Features

The Bluetooth low energy protocol stack can be configured to include or exclude certain Bluetooth Low Energy features by changing the library configuration in the stack project. The available Bluetooth low energy features are defined in the build_config.opt file in the Tools folder of the stack project within the IDE. Based on the features selected in the build_config.opt file, the lib_search.exe tool selects the respective precompiled library during the build process of the stack project.

Table 15. lists a summary of configurable features. See the build_config.opt file for additional details and supported configurations. Some features in the BLE-Stack 3.01.01.00 cannot be removed and are always enabled, these features are:

  • V41_CTRL_CFG
  • EXT_DATA_LEN_CFG
  • PRIVACY_1_2_CFG
Table 15. Summary of TI Bluetooth Low Energy Protocol Stack Features.
Feature Description
HOST_CONFIG
This option configures the stack’s host layer based on its targeted GAP role.
These combo roles are supported:
- PERIPHERAL_CFG+OBSERVER_CFG
- CENTRAL_CFG+BROADCASTER_CFG
- PERIPHERAL_CFG+CENTRAL_CFG
- BROADCASTER_CFG+OBSERVER_CFG
BLE_V41_FEATURES
Features supported from the Bluetooth Core Specification Version 4.1.
These features include:
- Ping (V41_CTRL_CFG)
- Slave feature exchange (V41_CTRL_CFG)
- Connection parameter update request (V41_CTRL_CFG)
- Multirole connections (V41_CTRL_CFG)
- L2CAP Connection Oriented Channels (L2CAP_COC_CFG)
BLE_V42_FEATURES
Features supported from the Bluetooth Core Specification Version 4.2.
These include:
- Data Length Extension (EXT_DATA_LEN_CFG)
- Secure Connections (SECURE_CONNS_CFG)
- Privacy 1.2 (PRIVACY_1_2_CFG)
HCI_TL_xxxx Include HCI Transport Layer (FULL, PTM or NONE).

Note

Selecting the correct stack configuration is essential in optimizing the amount of flash memory available to the application. To conserve memory, exclude certain Bluetooth Low Energy protocol stack features that may not be required.

Run-Time Bluetooth low energy Protocol Stack Configuration

The Bluetooth low energy protocol stack can be configured with various parameters that control its runtime behavior and RF antenna layout. The available configuration parameters are described in the ble_user_config.h file in the ICallBLE IDE folder of the application. During initialization, these parameters are supplied to the Bluetooth Low Energy protocol stack by the user0Cfg structure, declared in main.c.

#include "ble_user_config.h"

// BLE user defined configuration
bleUserCfg_t user0Cfg = BLE_USER_CFG;

Because the ble_user_config.h file is shared with projects within the SDK, TI recommends defining the configuration parameters in the preprocessor symbols of the application when using a non default value. For example, to change the maximum PDU size from the default 27 to 162, set the preprocessor symbol MAX_PDU_SIZE=162 in the preprocessor symbols for the application project. Increasing certain parameters may increase heap memory use by the protocol stack; adjust the HEAPMGR_SIZE as required (if not using auto sized heap). Table 16. lists the available configuration parameters.

Table 16. Bluetooth Low Energy Stack Configuration Parameters
Parameter Description
MAX_NUM_BLE_CONNS Maximum number of simultaneous Bluetooth low energy connections. Default is 1 for Peripheral and Central roles. Maximum value is based on GAPRole.
MAX_NUM_PDU Maximum number of Bluetooth low energy HCI PDUs. Default is 5. If the maximum number of connections is set to 0, then this number should also be set to 0.
MAX_PDU_SIZE Maximum size in bytes of the Bluetooth low energy HCI PDU. Default is 27. Valid range is 27 to 255. The maximum ATT_MTU is MAX_PDU_SIZE - 4. See Configuring for Larger MTU Values.
L2CAP_NUM_PSM Maximum number of L2CAP Protocol/Service Multiplexers (PSM). Default is 3.
L2CAP_NUM_CO_CHANNELS Maximum number of L2CAP Connection-Oriented (CO) Channels. Default is 3.
PM_STARTUP_MARGIN Defines time in microseconds (us) the system will wake up before the start of the connection event. Default is 300. This value is optimized for the example projects.
RF_FE_MODE_AND_BIAS Defines the RF antenna front end and bias configuration. Set this value to match the actual hardware antenna layout. This value can be set directly, or through Board.h. For more information see Configuring the RF Front-End for Custom Hardware
ICALL_MAX_NUM_TASKS (App) OSAL_MAX_NUM_PROXY_TASKS (Stack) Defines the max number of ICall enabled tasks. These defines, although on different sides, (app and stack), must be the same. OSAL_MAX_NUM_PROXY_TASKS defaults to 2. ICALL_MAX_NUM_Tasks defaults to 2.
ICALL_MAX_NUM_ENTITIES (App) This Maximum number of entities that use ICall, including service entities and application entities.

Warning

TI Recommends limiting the number of ICall enabled tasks due to resource usage. For more information on creating ICall enabled tasks, see Adding ICall RTOS Tasks