Hi,
To set the DLE to e.g. 50 you can use this code:
static void ble_stack_init(void) { uint32_t err_code; nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; // Initialize SoftDevice. SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); //Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT); // Enable BLE stack. #if (NRF_SD_BLE_API_VERSION == 3) ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE; #endif err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Subscribe for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); ble_opt_t gap_opt; gap_opt.gap_opt.ext_len.rxtx_max_pdu_payload_size = 54; //Example: set max length to 54bytes err_code = sd_ble_opt_set(BLE_GAP_OPT_EXT_LEN, &gap_opt); APP_ERROR_CHECK(err_code); }
make sure to call sd_ble_opt_set() after you have enabled the Softdevice with softdevice_enable(). Otherwise you will get error 0x3001.
Also remember to increase the MTU size accordingly. In the BLE UART example you can do this by setting GATT_MTU_SIZE_DEFAULT in ble_gatt.h to the value you want.
Can nordic provide similar code for Soft Device 132 V6.0.0, SDK 15.0 ?? The code above does not work for this soft device as BLE_GAP_OPT_EXT_LEN is not defined and ext_len is not a member of gap_opt ?? I can find no exampled showing the correct way to do LE Length Extension...
Nigel
Hi,
Please refer to the Migration Document for S132 v6.0.0. It shows how to initiate (or respond to) a data length update procedure. You can find the document here: https://www.nordicsemi.com/eng/nordic/Products/nRF52-DK/S132-SD-v6/67250
Hi
Just a note for others. A DLE example has appeared in SDK V15.2 See here: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fble_sdk_app_att_mtu.html&cp=4_0_0_4_1_1_0
The DLE Update procedure for SoftDevice 132 V6.0.x can be found here: http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v6.0.0%2Fgroup___b_l_e___g_a_p___d_a_t_a___l_e_n_g_t_h___u_p_d_a_t_e___p_r_o_c_e_d_u_r_e___m_s_c.html&cp=2_3_1_1_0_2_1_3_6
Nigel