I am attempting to increase the queue size for handle value notifications to support a higher number of packets per connection event. However, I am unable to set the queue size using the BLE_CONN_CFG_GATTS cfg_id, as the function always returns "Invalid Param", which is documented to mean an improper cfg_id. Is there a step I'm missing? My softdevice and stack initialization code is below. This is for SDKv13, SoftDevice S132 v4.0.2.
static void ble_stack_init(void)
{
uint32_t err_code;
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_APPSH_INIT(&clock_lf_cfg, true);
// RAM Start
uint32_t ram_start = 0;
err_code = softdevice_app_ram_start_get(&ram_start);
APP_ERROR_CHECK(err_code);
// BLE Configuration
ble_cfg_t ble_cfg;
// VS UUIDs
memset(&ble_cfg, 0, sizeof ble_cfg);
ble_cfg.common_cfg.vs_uuid_cfg.vs_uuid_count = 2;
err_code = sd_ble_cfg_set(BLE_COMMON_CFG_VS_UUID, &ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);
// Max Connections
memset(&ble_cfg, 0, sizeof ble_cfg);
ble_cfg.gap_cfg.role_count_cfg.periph_role_count = BLE_GAP_ROLE_COUNT_PERIPH_DEFAULT;
ble_cfg.gap_cfg.role_count_cfg.central_role_count = 0;
ble_cfg.gap_cfg.role_count_cfg.central_sec_count = 0;
err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);
// Max Packets Per Connection Event
memset(&ble_cfg, 0, sizeof ble_cfg);
ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 4;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);
// Enable BLE stack.
err_code = softdevice_enable(&ram_start);
APP_ERROR_CHECK(err_code);
// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
APP_ERROR_CHECK(err_code);
}