Bluetooth LE connection parameters module

Use the Bluetooth® LE connection parameters module for the following purposes:

  • Update the connection parameters after the peripheral discovery.

  • React on connection parameter update requests from the connected peripherals.

  • Reduce power consumption while USB is suspended by increasing the Bluetooth connection interval for non-HID SCI connections, or by switching HID SCI connections to the LOW_POWER mode.

Module Events

Source Module

Input Event

This Module

Output Event

Sink Module

Bluetooth LE discovery module

ble_discovery_complete_event

ble_conn_params

Bluetooth LE state module

ble_peer_conn_params_event

Bluetooth LE advertising module

ble_peer_event

Bluetooth LE state module

Source modules for module_state_event

module_state_event

USB state module

usb_state_event

HID forward module

hogp_sci_mode_changed_event

module_state_event

Sink modules for module_state_event

hogp_sci_mode_req_event

HID forward module

Note

See the Application overview for more information about the event-based communication in the nRF Desktop application and about how to read this table.

Configuration

The module requires the basic Bluetooth configuration, as described in nRF Desktop: Bluetooth. Make sure that both CONFIG_DESKTOP_ROLE_HID_DONGLE and CONFIG_DESKTOP_BT_CENTRAL options are enabled. The Bluetooth LE connection parameters module is enabled by the CONFIG_DESKTOP_BLE_CONN_PARAMS_ENABLE option. The option is implied by CONFIG_DESKTOP_BT_CENTRAL together with other features used by a HID dongle that forwards the HID reports received over Bluetooth LE.

Enable the CONFIG_DESKTOP_BLE_USB_MANAGED_CI Kconfig option to reduce dongle power consumption while USB is suspended by adjusting Bluetooth connection parameters based on the USB state. The option is enabled by default. For standard (non-SCI) connections, use the CONFIG_DESKTOP_BLE_USB_MANAGED_CI_VALUE Kconfig option to set the connection interval used in suspended state (100 ms by default) and the CONFIG_DESKTOP_BLE_USB_MANAGED_LATENCY_VALUE Kconfig option to set the peripheral latency used in suspended state (1 by default). For HID SCI connections, the module requests the appropriate HID SCI mode instead. See the Aligning connection parameters to USB state section in the Implementation details for more information.

Implementation details

After setting Bluetooth LE connection parameters using Bluetooth stack APIs, the module waits until the update is completed (for ble_peer_conn_params_event with ble_peer_conn_params_event.updated set to true) before performing subsequent connection parameter updates for a given connection. Subsequent connection parameter update for a given connection can be done right after the previous one is completed.

Handling peripheral’s requests

The Bluetooth LE connection parameters module receives the peripheral’s connection parameters update request as ble_peer_conn_params_event with ble_peer_conn_params_event.updated set to false. The module updates only the connection latency. The connection interval and supervision timeout are not changed according to the peripheral’s request.

Note

On the peripheral side, the Bluetooth connection parameters are controlled by Bluetooth LE latency module. When HID SCI is enabled and the peripheral has switched to SCI-based connection parameter handling, latency updates use the connection rate API instead of the standard connection parameter update API. In that case, the module no longer updates its latency state based on ble_peer_conn_params_event.

Aligning connection parameters to USB state

When the CONFIG_DESKTOP_BLE_USB_MANAGED_CI Kconfig option is enabled, the Bluetooth LE connection parameters module reacts to usb_state_event to reduce power consumption while USB is suspended. The applied mechanism depends on whether a given connection uses HID SCI.

Standard connections

For connections that do not use HID SCI, the module updates the Bluetooth connection parameters directly while USB is suspended:

When USB is disconnected or becomes active, the module restores the connection parameters used during normal operation.

HID SCI connections

For connections that use HID SCI, the module does not update connection parameters directly, as such behavior would break the HID Over GATT Profile Specification. Instead, it requests an appropriate HID SCI mode from the peripheral:

  • On USB suspend, the module requests the LOW_POWER HID SCI mode.

  • On USB resume or disconnect, the module requests the FAST HID SCI mode.

The CONFIG_DESKTOP_BLE_USB_MANAGED_CI_VALUE and CONFIG_DESKTOP_BLE_USB_MANAGED_LATENCY_VALUE Kconfig options do not apply to HID SCI connections.

If a peer switches out of the LOW_POWER mode while USB is suspended (for example, when the peer wakes up from power down), the module immediately requests the LOW_POWER mode again to avoid excessive power consumption.

Note

Make sure that the configured peripheral’s LOW_POWER HID SCI connection parameters allow for the dongle’s current to remain under the required limit of 2.5 mA while USB is suspended. The LOW_POWER HID SCI mode parameters configured in nrf_desktop meet this requirement.

HID SCI

When the CONFIG_DESKTOP_HID_FORWARD_HID_SCI_ENABLE Kconfig option is enabled, the Bluetooth LE connection parameters module sets the promptless CONFIG_DESKTOP_BLE_CONN_PARAMS_HID_SCI_ENABLE Kconfig option. With this option set, the module sets default connection rate parameters on module initialization using bt_conn_le_conn_rate_set_defaults().

For HID SCI connections, the module does not perform the standard connection parameter update. Instead, it controls the connection parameters by requesting appropriate HID SCI modes from the peripheral, as required by the HID Over GATT Profile Specification. For details, see the Connection interval update section.

For USB suspend and resume behavior, see HID SCI connections.

LLPM connections

The Low Latency Packet Mode (LLPM) connection parameters are not supported by the standard Bluetooth.

The LLPM connection parameters update requires using vendor-specific HCI commands. Moreover, the peripheral cannot request the LLPM connection parameters using Zephyr Bluetooth® API.

Connection interval update

After the Bluetooth LE discovery module completes the peripheral discovery, the Bluetooth LE connection parameters module updates the connection parameters in the following manner:

  • If the peripheral supports HID SCI, the parameter update is skipped and HID SCI FAST mode is requested as soon as the peripheral discovery completes. When the CONFIG_DESKTOP_BLE_USB_MANAGED_CI Kconfig option is enabled and USB is suspended, HID SCI LOW_POWER mode is requested instead.

  • If the central and the connected peripheral both support the Low Latency Packet Mode (LLPM), the connection interval is set to 1 ms.

  • If neither the central nor the connected peripheral support LLPM, or if only one of them supports it, the interval is set to the following values:

    • 7.5 ms if LLPM is not supported by the central or CONFIG_BT_MAX_CONN is set to value of 1. This is the shortest interval allowed by the standard Bluetooth.

    • 10 ms otherwise. This is required to avoid Bluetooth Link Layer scheduling conflicts that could lead to HID report rate drop.