This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

max L2CAP rx length is 23, but I'm sending 256 bytes from iOS

Parameter setting code is shown below. I've verified that the settings are being reported back in events, so they seem to be taking place.  However, I'm keeping track of the max rx length when sending 256 byte chunks from iOS and the max size I'm seeing is 23 bytes.  So looks like the settings below aren't increasing things.  See any obvious issues?

#define AW_BLE_GATT_ATT_MTU_MAX 247

static void aw_ble_stack_initialize(void) { uint32_t 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. uint32_t ram_start = 0; err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start); APP_ERROR_CHECK(err_code); // Configure one L2CAP channel. 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.l2cap_conn_cfg.rx_mps = 512; // BLE_L2CAP_MPS_MIN; ble_cfg.conn_cfg.params.l2cap_conn_cfg.rx_queue_size = rx_queue_size; ble_cfg.conn_cfg.params.l2cap_conn_cfg.tx_mps = 512; // BLE_L2CAP_MPS_MIN; ble_cfg.conn_cfg.params.l2cap_conn_cfg.tx_queue_size = 10; ble_cfg.conn_cfg.params.l2cap_conn_cfg.ch_count = 1; err_code = sd_ble_cfg_set(BLE_CONN_CFG_L2CAP, &ble_cfg, ram_start); APP_ERROR_CHECK(err_code); // Configure MTU MAX memset(&ble_cfg, 0, sizeof(ble_cfg)); ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG; ble_cfg.conn_cfg.params.gatt_conn_cfg.att_mtu = AW_BLE_GATT_ATT_MTU_MAX; err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATT, &ble_cfg, ram_start); APP_ERROR_CHECK(err_code); // Configure the maximum event length. memset(&ble_cfg, 0x00, sizeof(ble_cfg)); ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG; ble_cfg.conn_cfg.params.gap_conn_cfg.event_length = 320; ble_cfg.conn_cfg.params.gap_conn_cfg.conn_count = BLE_GAP_CONN_COUNT_DEFAULT; err_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &ble_cfg, ram_start); APP_ERROR_CHECK(err_code); // Configure service changed. memset(&ble_cfg, 0, sizeof(ble_cfg)); ble_cfg.gatts_cfg.service_changed.service_changed = 1; err_code = sd_ble_cfg_set(BLE_GATTS_CFG_SERVICE_CHANGED, &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); }
static ble_gap_conn_params_t aw_gap_conn_params(void) {
    ble_gap_conn_params_t gap_conn_params;
    memset(&gap_conn_params, 0, sizeof(gap_conn_params));
    gap_conn_params.min_conn_interval = 12; // 8 == 10 ms (1.25 ms units)
    gap_conn_params.max_conn_interval = 12; // 16 == 20 ms (1.25 ms units)
    gap_conn_params.slave_latency = 0;
    gap_conn_params.conn_sup_timeout = 400; // 4 s (10 ms units)
    return gap_conn_params;
}
Related