diff --git a/applications/nrf5340_audio/unicast_client/main.c b/applications/nrf5340_audio/unicast_client/main.c index b829c21d86d..98c645b2a4c 100644 --- a/applications/nrf5340_audio/unicast_client/main.c +++ b/applications/nrf5340_audio/unicast_client/main.c @@ -288,7 +288,7 @@ static void le_audio_msg_sub_thread(void) if (ret) { LOG_ERR("Failed to get conn info"); } else { - interval = conn_info.le.interval; + interval = BT_GAP_US_TO_CONN_INTERVAL(conn_info.le.interval_us); } /* Only update conn param once */ diff --git a/applications/nrf_desktop/src/modules/ble_conn_params.c b/applications/nrf_desktop/src/modules/ble_conn_params.c index 63a93785609..e597cfa92e9 100644 --- a/applications/nrf_desktop/src/modules/ble_conn_params.c +++ b/applications/nrf_desktop/src/modules/ble_conn_params.c @@ -23,11 +23,12 @@ LOG_MODULE_REGISTER(MODULE, CONFIG_DESKTOP_BLE_CONN_PARAMS_LOG_LEVEL); #define CONN_INTERVAL_LLPM_US 1000 /* 1 ms */ -#define CONN_INTERVAL_LLPM_REG 0x0d01 /* 1 ms */ #if (CONFIG_CAF_BLE_USE_LLPM && (CONFIG_BT_MAX_CONN >= 2)) #define CONN_INTERVAL_BLE_REG 0x0008 /* 10 ms */ + #define CONN_INTERVAL_BLE_US 10000 #else #define CONN_INTERVAL_BLE_REG 0x0006 /* 7.5 ms */ + #define CONN_INTERVAL_BLE_US 7500 #endif #define CONN_SUPERVISION_TIMEOUT 400 @@ -77,8 +78,10 @@ static int set_le_conn_param(struct bt_conn *conn, uint16_t interval, uint16_t l return bt_conn_le_param_update(conn, ¶m); } -static int interval_reg_to_us(uint16_t reg) +/* Handle llpm encoding in interval_us values */ +static int strip_llpm_encoding_to_us(uint32_t interval_us) { + uint16_t reg = BT_GAP_US_TO_CONN_INTERVAL(interval_us); bool is_llpm = ((reg & 0x0d00) == 0x0d00) ? true : false; return (reg & BIT_MASK(8)) * ((is_llpm) ? 1000 : 1250); @@ -128,7 +131,7 @@ static int set_conn_params(struct connected_peer *peer) LOG_ERR("Cannot get conn info (%d)", err); return err; } - uint32_t curr_ci_us = interval_reg_to_us(info.le.interval); + uint32_t curr_ci_us = strip_llpm_encoding_to_us(info.le.interval_us); if (curr_ci_us > CONN_INTERVAL_PRE_LLPM_MAX_US) { err = set_le_conn_param(peer->conn, CONN_INTERVAL_BLE_REG, @@ -192,13 +195,14 @@ static bool conn_params_update_required(struct connected_peer *peer) __ASSERT_NO_MSG(info.role == BT_CONN_ROLE_CENTRAL); + uint32_t interval_us = strip_llpm_encoding_to_us(info.le.interval_us); if (IS_ENABLED(CONFIG_DESKTOP_BLE_USB_MANAGED_CI) && usb_suspended) { - if ((info.le.interval != CONN_INTERVAL_USB_SUSPEND) || + if ((interval_us != BT_CONN_INTERVAL_TO_US(CONN_INTERVAL_USB_SUSPEND)) || (info.le.latency != CONN_LATENCY_USB_SUSPEND)) { return true; } - } else if ((peer->use_llpm && (info.le.interval != CONN_INTERVAL_LLPM_REG)) || - (!peer->use_llpm && (info.le.interval != CONN_INTERVAL_BLE_REG)) || + } else if ((peer->use_llpm && (interval_us != CONN_INTERVAL_LLPM_US)) || + (!peer->use_llpm && (interval_us != CONN_INTERVAL_BLE_US)) || (info.le.latency != peer->requested_latency)) { return true; } diff --git a/applications/nrf_desktop/src/modules/ble_latency.c b/applications/nrf_desktop/src/modules/ble_latency.c index 09977cc4872..abebc84f5c6 100644 --- a/applications/nrf_desktop/src/modules/ble_latency.c +++ b/applications/nrf_desktop/src/modules/ble_latency.c @@ -102,8 +102,9 @@ static void set_conn_latency(bool low_latency) /* Request with connection interval set to a LLPM value is rejected * by Zephyr Bluetooth API. */ - uint16_t interval = (info.le.interval & REG_CONN_INTERVAL_LLPM_MASK) ? - REG_CONN_INTERVAL_BLE_DEFAULT : info.le.interval; + uint16_t info_interval_1250us = BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us); + uint16_t interval = (info_interval_1250us & REG_CONN_INTERVAL_LLPM_MASK) ? + REG_CONN_INTERVAL_BLE_DEFAULT : info_interval_1250us; const struct bt_le_conn_param param = { .interval_min = interval, .interval_max = interval, diff --git a/samples/bluetooth/conn_time_sync/src/peripheral.c b/samples/bluetooth/conn_time_sync/src/peripheral.c index e339e342260..b751bbce2e5 100644 --- a/samples/bluetooth/conn_time_sync/src/peripheral.c +++ b/samples/bluetooth/conn_time_sync/src/peripheral.c @@ -30,7 +30,7 @@ static uint32_t conn_interval_us_get(const struct bt_conn *conn) return 0; } - return BT_CONN_INTERVAL_TO_US(info.le.interval); + return info.le.interval_us; } static ssize_t time_sync_data_received(struct bt_conn *conn, diff --git a/samples/bluetooth/llpm/src/main.c b/samples/bluetooth/llpm/src/main.c index 559c0f12456..d26165e53e7 100644 --- a/samples/bluetooth/llpm/src/main.c +++ b/samples/bluetooth/llpm/src/main.c @@ -201,7 +201,7 @@ static void connected(struct bt_conn *conn, uint8_t err) printk("Connected as %s\n", conn_info.role == BT_CONN_ROLE_CENTRAL ? "central" : "peripheral"); - __ASSERT_NO_MSG(conn_info.le.interval == INTERVAL_LLPM); + __ASSERT_NO_MSG(conn_info.le.interval_us == INTERVAL_LLPM * BT_HCI_LE_INTERVAL_UNIT_US); printk("Conn. interval is 1 ms\n"); } diff --git a/samples/bluetooth/radio_notification_cb/src/main.c b/samples/bluetooth/radio_notification_cb/src/main.c index 34967f3505d..36c0b60d8ef 100644 --- a/samples/bluetooth/radio_notification_cb/src/main.c +++ b/samples/bluetooth/radio_notification_cb/src/main.c @@ -81,7 +81,7 @@ static void connected(struct bt_conn *conn, uint8_t conn_err) return; } - conn_interval_us = BT_CONN_INTERVAL_TO_US(info.le.interval); + conn_interval_us = info.le.interval_us; /*Start service discovery when link is encrypted*/ err = bt_gatt_dm_start(conn, BT_UUID_LATENCY, &discovery_cb, diff --git a/samples/bluetooth/throughput/src/main.c b/samples/bluetooth/throughput/src/main.c index 1173cac5d3d..60b87406b77 100644 --- a/samples/bluetooth/throughput/src/main.c +++ b/samples/bluetooth/throughput/src/main.c @@ -199,7 +199,7 @@ static void connected(struct bt_conn *conn, uint8_t hci_err) printk("Connected as %s\n", info.role == BT_CONN_ROLE_CENTRAL ? "central" : "peripheral"); - printk("Conn. interval is %u units\n", info.le.interval); + printk("Conn. interval is %u us\n", info.le.interval_us); if (info.role == BT_CONN_ROLE_PERIPHERAL) { err = bt_conn_set_security(conn, BT_SECURITY_L2); @@ -497,7 +497,7 @@ static int connection_configuration_set(const struct shell *shell, return err; } - if (info.le.interval != conn_param->interval_max) { + if (BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us) != conn_param->interval_max) { err = bt_conn_le_param_update(default_conn, conn_param); if (err) { shell_error(shell, diff --git a/samples/wifi/ble_coex/src/bt_throughput_test.c b/samples/wifi/ble_coex/src/bt_throughput_test.c index eccfdcbff52..5239b3c0cd4 100644 --- a/samples/wifi/ble_coex/src/bt_throughput_test.c +++ b/samples/wifi/ble_coex/src/bt_throughput_test.c @@ -207,7 +207,7 @@ static void connected(struct bt_conn *conn, uint8_t hci_err) } LOG_INF("Connected as %s", info.role == BT_CONN_ROLE_CENTRAL ? "central" : "peripheral"); - LOG_INF("Conn. interval is %u units", info.le.interval); + LOG_INF("Conn. interval is %u us", info.le.interval_us); if (info.role == BT_CONN_ROLE_CENTRAL) { err = bt_gatt_dm_start(default_conn, @@ -475,7 +475,7 @@ int connection_configuration_set(const struct bt_le_conn_param *conn_param, } } - if (info.le.interval != conn_param->interval_max) { + if (BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us) != conn_param->interval_max) { err = bt_conn_le_param_update(default_conn, conn_param); if (err) { LOG_ERR("Connection parameters update failed: %d", err); diff --git a/subsys/bluetooth/host_extensions/radio_notification_conn_cb.c b/subsys/bluetooth/host_extensions/radio_notification_conn_cb.c index 9637adec3b6..6d035d84426 100644 --- a/subsys/bluetooth/host_extensions/radio_notification_conn_cb.c +++ b/subsys/bluetooth/host_extensions/radio_notification_conn_cb.c @@ -34,7 +34,7 @@ static uint32_t conn_interval_us_get(const struct bt_conn *conn) return 0; } - return BT_CONN_INTERVAL_TO_US(info.le.interval); + return info.le.interval_us; } static void work_handler(struct k_work *work) diff --git a/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c b/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c index 1f28e6fc2cb..82b2ae04dda 100644 --- a/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c +++ b/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c @@ -279,7 +279,10 @@ static void bt_conn_info_dec(struct nrf_rpc_cbor_ctx *ctx, struct bt_conn *conn, info->id = nrf_rpc_decode_uint(ctx); if (info->type == BT_CONN_TYPE_LE) { - info->le.interval = nrf_rpc_decode_uint(ctx); + info->le.interval_us = nrf_rpc_decode_uint(ctx); +#if !defined(CONFIG_BT_SHORTER_CONNECTION_INTERVALS) + info->le._interval = nrf_rpc_decode_uint(ctx); +#endif info->le.latency = nrf_rpc_decode_uint(ctx); info->le.timeout = nrf_rpc_decode_uint(ctx); LOCK_CONN_INFO(); diff --git a/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c b/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c index 54d69776c46..68ef34f3605 100644 --- a/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c +++ b/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c @@ -246,7 +246,10 @@ static const size_t bt_conn_info_buf_size = 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, type) + 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, role) + 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, id) + - 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.interval) + + 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.interval_us) + +#if !defined(CONFIG_BT_SHORTER_CONNECTION_INTERVALS) + 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le._interval) + +#endif 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.latency) + 1 + BT_RPC_SIZE_OF_FIELD(struct bt_conn_info, le.timeout) + 4 * (1 + sizeof(bt_addr_le_t)) + @@ -269,7 +272,10 @@ static void bt_conn_info_enc(struct nrf_rpc_cbor_ctx *encoder, struct bt_conn_in nrf_rpc_encode_uint(encoder, info->id); if (info->type == BT_CONN_TYPE_LE) { - nrf_rpc_encode_uint(encoder, info->le.interval); + nrf_rpc_encode_uint(encoder, info->le.interval_us); +#if !defined(CONFIG_BT_SHORTER_CONNECTION_INTERVALS) + nrf_rpc_encode_uint(encoder, info->le._interval); +#endif nrf_rpc_encode_uint(encoder, info->le.latency); nrf_rpc_encode_uint(encoder, info->le.timeout); nrf_rpc_encode_buffer(encoder, info->le.src, sizeof(bt_addr_le_t)); diff --git a/subsys/caf/modules/ble_state.c b/subsys/caf/modules/ble_state.c index 74b7db9b827..60b76d367ad 100644 --- a/subsys/caf/modules/ble_state.c +++ b/subsys/caf/modules/ble_state.c @@ -69,10 +69,11 @@ static void broadcast_init_conn_params(struct bt_conn *conn) LOG_ERR("Cannot get conn info (%d)", err); } else { struct ble_peer_conn_params_event *event = new_ble_peer_conn_params_event(); + uint16_t info_interval_1250us = BT_GAP_US_TO_CONN_INTERVAL(info.le.interval_us); event->id = conn; - event->interval_min = info.le.interval; - event->interval_max = info.le.interval; + event->interval_min = info_interval_1250us; + event->interval_max = info_interval_1250us; event->latency = info.le.latency; event->timeout = info.le.timeout; event->updated = true; diff --git a/west.yml b/west.yml index e9b2b704040..cdb341ae02a 100644 --- a/west.yml +++ b/west.yml @@ -64,7 +64,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: 8116dbcc6173ae9a1d6c526ec39f6c9b8c09de8d + revision: ca9ae7fc780e3d3ce61dd123441514b724b8d629 import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above @@ -244,7 +244,7 @@ manifest: remote: throwtheswitch - name: memfault-firmware-sdk path: modules/lib/memfault-firmware-sdk - revision: 1.30.3 + revision: 1.31.0 remote: memfault - name: bsim repo-path: bsim_west