Bluetooth LE latency module

Use the Bluetooth® LE latency module for the following purposes:

  • Lower the Bluetooth LE connection latency when the Configuration channel is in use or when a firmware update is received either by the Simple Management Protocol module or Device Firmware Upgrade MCUmgr module (low latency ensures quick data exchange).

  • Request setting the initial connection parameters for a new Bluetooth connection.

  • Keep the connection latency low for the LLPM (Low Latency Packet Mode) connections to improve performance.

  • Disconnect the Bluetooth Central if the connection has not been secured in the predefined amount of time after the connection occurred.

Module events

Source Module

Input Event

This Module

Output Event

Sink Module

Source modules for config_event

config_event

ble_latency

Bluetooth LE state module

ble_peer_conn_params_event

Bluetooth LE advertising module

ble_peer_event

Bluetooth LE state module

Device Firmware Upgrade MCUmgr module

ble_smp_transfer_event

Simple Management Protocol module

Source modules for module_state_event

module_state_event

Power manager module

power_down_event

Bluetooth LE advertising module

wake_up_event

Buttons module

HID forward module

Motion module

Power manager module

Wheel module

module_state_event

Sink modules for module_state_event

Note

See the Overview: Firmware architecture 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 Bluetooth in nRF Desktop. Make sure that both CONFIG_DESKTOP_ROLE_HID_PERIPHERAL and CONFIG_DESKTOP_BT_PERIPHERAL options are enabled. The Bluetooth LE latency application module is enabled by the CONFIG_DESKTOP_BLE_LATENCY_ENABLE option. The option is implied by CONFIG_DESKTOP_BT_PERIPHERAL together with other features used by an HID peripheral device.

You can use the option CONFIG_DESKTOP_BLE_SECURITY_FAIL_TIMEOUT_S to define the maximum allowed time for establishing the connection security. If the connection is not secured during this period of time, the peripheral device disconnects.

You can set the option CONFIG_DESKTOP_BLE_LOW_LATENCY_LOCK to keep the connection latency low for the LLPM connections. This speeds up sending the first HID report after not sending a report for some connection intervals. Enabling this option increases the power consumption - the connection latency is kept low unless the device is in the low power mode.

You can use the CONFIG_DESKTOP_BLE_LATENCY_PM_EVENTS Kconfig option to enable or disable handling of the power management events, such as power_down_event and wake_up_event. The option is enabled by default and depends on the CONFIG_CAF_PM_EVENTS Kconfig option.

Implementation details

The Bluetooth LE latency module uses delayed works (k_work_delayable) to control the connection latency and trigger the security timeout.

Note

The module does not request an increase in the connection latency until the connection is secured. Increasing the slave latency can significantly increase the amount of time required to establish the Bluetooth connection security level on some hosts.

The module listens for the following events related to data transfer initiated by the connected Bluetooth central:

When these events are received, the module sets the connection latency to low. When the Configuration channel is no longer in use, and neither Simple Management Protocol module nor Device Firmware Upgrade MCUmgr module receive firmware updates (no mentioned events for LOW_LATENCY_CHECK_PERIOD_MS), the module sets the connection latency to CONFIG_BT_PERIPHERAL_PREF_LATENCY to reduce the power consumption.

Note

If the option CONFIG_DESKTOP_BLE_LOW_LATENCY_LOCK is enabled, the LLPM connection latency is not increased unless the device is in the low power mode.

When the device is in the low power mode and the events related to data transfer are not received, the connection latency is set to higher value to reduce the power consumption.

The ble_latency module receives Configuration channel events, but it is not configurable with the Configuration channel. The module does not register itself using the GEN_CONFIG_EVENT_HANDLERS macro.

Note

Zephyr’s Bluetooth API does not allow to use the LLPM connection intervals in the connection parameter update request. If the LLPM connection interval is in use:

  • The nRF Desktop peripheral uses a 7.5-ms interval in the request.

  • The nRF Desktop central ignores the requested connection interval, and only the connection latency is updated.

For more detailed information, see the Bluetooth LE connection parameters module documentation page.