I posted on the forum regarding the same project here https://devzone.nordicsemi.com/f/nordic-q-a/34022/optimizing-throughput-with-multiple-central-links-and-1-peripheral-link.
I wan't to stream with about 25kb/s as a minimum. Iv'e calcuated that if using 100ms conn interval I would need to set NRF_SDH_BLE_GAP_EVENT_LENGTH = 25ms. This would give me approximately 52 packets of 100bytes guaranteed per conn interval. I'm streaming data using notifications as a peripheral to a central device. I'm thinking that I would like to increase the TX buffer (hvn_tx_queue_size ) to increase the throughput. But if I increase it to above 11 i get NRF_ERROR_NO_MEM when running nrf_sdh_ble_enable(). This is fine, I check what RAM settings I should use and try, but I still get same error.
I also initiate with 19 central links so I eat alot of RAM. If I change to 1 central link I can go up to hvn_tx_queue_size = 17.
Is there a max value for hvn_tx_queue_size? Or is there a max value for softDevice RAM allocation? Does it matter what hvn_tx_queue_size is set to if I push data really fast? Do I need a big TX buffer to be able to send as many as 52 packets in 1 connection interval?
That was alot of questions, but I feel a bit confused to why I can't enable the sd with these settings.
Here is the code in ble_stack_init()
static void ble_stack_init(void)
{
ret_code_t err_code;
err_code = nrf_sdh_enable_request();
APP_ERROR_CHECK(err_code);
// Configure the BLE stack using the default settings.
// Fetch the start address of the application RAM.
ram_start = 0;
err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
APP_ERROR_CHECK(err_code);
ble_cfg_t ble_cfg;
memset(&ble_cfg, 0, sizeof ble_cfg);
ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 17;
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &ble_cfg, ram_start);
APP_ERROR_CHECK(err_code);
// Enable BLE stack.
err_code = nrf_sdh_ble_enable(&ram_start);
APP_ERROR_CHECK(err_code);
// Register a handler for BLE events.
NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
}