How to Request BLE Data Length Extension? #bt #bluetooth


George Ruinelli
 

I am trying to set the Bluetooth Low Energy DLE from 27 to something higher, eg. 251.
I was able to do it manually through the nRF Connect Tool, Wireshark then confirms me that the data no longer is fragmented:


How ever I need to be able to do it directly within Zephyr.

I am aware of https://lists.zephyrproject.org/g/users/topic/data_length_extension_on/23297993 and https://lists.zephyrproject.org/g/devel/topic/30301574, but it did not help me further.

I found bt_conn_le_data_len_update() which seems to do what I need, but it doesn't have any impact.
I tried to add its call to exchange_func(), but it simply seems to be ignored:
static void exchange_func(struct bt_conn *conn, uint8_t att_err, struct bt_gatt_exchange_params *params) {
    struct bt_conn_info info = {0};
    int err;

    if (att_err == 0) {
        LOG_INF("MTU exchange successful");
        LOG_DBG("MTU: %d bytes", bt_gatt_get_mtu(conn));
    }
    else {
        LOG_ERR("MTU exchange failed!");
    }

    err = bt_conn_get_info(conn, &info);
    if (err) {
        LOG_ERR("Failed to get connection info %d\n", err);
    }


    LOG_ERR("Data Length: %d", info.le.data_len->tx_max_len); // Reports 27

    struct bt_conn_le_data_len_param param;
    param.tx_max_len = 251;
    param.tx_max_time = 2120;
    err = bt_conn_le_data_len_update(conn, &param);
    if (err) {
        LOG_ERR("Failed to Update DLE: %d\n", err);
    }

    LOG_ERR("Data Length: %d", info.le.data_len->tx_max_len); // Still reporst 27
}

Sadly searching the web for bt_conn_le_data_len_update() only reveals its documentation but no further information :(

Sincerely
George