Hi there,
I am trying to send large data files via BLE notifications. My setup is nRF5340 development kit sending data to connecting devices (phone, PC).
I have gone through the Lecture 4 Exercise 2 of nRF Dev Academy and have made the following modifications in my respective files to have a large data length in each packet.
prj.conf
CONFIG_BT_USER_DATA_LEN_UPDATE=y CONFIG_BT_BUF_ACL_RX_SIZE=251 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_L2CAP_TX_MTU=247
main.c
/* Define the function to update the connection's data length */
static void update_data_length(struct bt_conn *conn)
{
int err;
struct bt_conn_le_data_len_param my_data_len = {
.tx_max_len = BT_GAP_DATA_LEN_MAX,//251, // Maximum DLE payload
.tx_max_time = BT_GAP_DATA_TIME_MAX,// 2120, // Maximum time microseconds for 2M PHY
};
err = bt_conn_le_data_len_update(conn, &my_data_len);
if (err) {
LOG_ERR("data_len_update failed (err %d)", err);
}
}
/* Define the function to update the connection's MTU */
static void update_mtu(struct bt_conn *conn)
{
int err;
exchange_params.func = exchange_func;
err = bt_gatt_exchange_mtu(conn, &exchange_params);
}
static void update_phy(struct bt_conn *conn)
{
int err;
const struct bt_conn_le_phy_param preferred_phy = {
.options = BT_CONN_LE_PHY_OPT_NONE,
.pref_rx_phy = BT_GAP_LE_PHY_2M,
.pref_tx_phy = BT_GAP_LE_PHY_2M,
};
err = bt_conn_le_phy_update(conn, &preferred_phy);
if (err) {
LOG_ERR("bt_conn_le_phy_update() returned %d", err);
}
LOG_INF("PHY updated to 2M");
}
And I call the update functions for increasing MTU, data length in the on_connected callback function.
However, my application is still stuck with a data length of 27 bytes as seen in the sniffer logs on Wireshark.
Is there anything I am missing? Kindly advise.