You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
doc: Describe CAF module suspend/resume request events support
Updates docs related to newly introduced CAF module
suspend/resume request events. Describes how the events
are used in nRF Desktop and CAF.
Jira: NCSDK-34237
Signed-off-by: Aleksander Strzebonski <[email protected]>
Copy file name to clipboardExpand all lines: applications/nrf_desktop/board_configuration.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,6 +173,7 @@ Sample mouse or dongle (``nrf54h20dk/nrf54h20/cpuapp``)
173
173
* Bluetooth LE and USB High-Speed transports are enabled.
174
174
Bluetooth LE is configured to use Nordic Semiconductor's SoftDevice Link Layer and Low Latency Packet Mode (LLPM).
175
175
USB High-Speed is configured to use the USB next stack (:kconfig:option:`CONFIG_USB_DEVICE_STACK_NEXT`).
176
+
The :kconfig:option:`CONFIG_DESKTOP_BLE_ADV_CTRL_ENABLE` and :kconfig:option:`CONFIG_DESKTOP_BLE_ADV_CTRL_SUSPEND_ON_USB` Kconfig options are enabled in mouse configurations to improve the USB High-Speed report rate.
176
177
* In ``debug`` configurations, logs are provided through the UART.
177
178
For detailed information on working with the nRF54H20 DK, see the :ref:`ug_nrf54h20_gs` documentation.
178
179
* The configurations use the Software Updates for Internet of Things (SUIT) and support firmware updates using the :ref:`nrf_desktop_dfu`.
The Bluetooth LE advertising control module is responsible for controlling :ref:`caf_ble_adv`.
11
+
The module is used to suspend and resume the |ble_adv|.
12
+
For now, the module can only react to the USB state changes.
13
+
It suspends the |ble_adv| when the active USB device is connected (USB state is set to :c:enum:`USB_STATE_ACTIVE`).
14
+
It resumes the |ble_adv| when the USB is disconnected (USB state is set to :c:enum:`USB_STATE_DISCONNECTED`) and the |ble_adv| was earlier suspended.
15
+
This improves the USB High-Speed performance.
16
+
17
+
Module events
18
+
*************
19
+
20
+
.. include:: event_propagation.rst
21
+
:start-after: table_ble_adv_ctrl_start
22
+
:end-before: table_ble_adv_ctrl_end
23
+
24
+
.. note::
25
+
|nrf_desktop_module_event_note|
26
+
27
+
Configuration
28
+
*************
29
+
30
+
This module is disabled by default.
31
+
To enable it, set the :ref:`CONFIG_DESKTOP_BLE_ADV_CTRL_ENABLE <config_desktop_app_options>` Kconfig option to ``y``.
32
+
To enable the module to suspend and resume the :ref:`caf_ble_adv` when USB state changes, set the :ref:`CONFIG_DESKTOP_BLE_ADV_CTRL_SUSPEND_ON_USB <config_desktop_app_options>` Kconfig option to ``y``.
33
+
It is recommended to enable this option if the device supports the USB High-Speed.
34
+
35
+
Implementation details
36
+
**********************
37
+
38
+
This module subscribes to :c:struct:`usb_state_event` events sent by the |usb_state|.
39
+
It reacts to these events by submitting :c:struct:`module_suspend_req_event` and :c:struct:`module_resume_req_event` events to the |ble_adv| when it is required.
Copy file name to clipboardExpand all lines: applications/nrf_desktop/doc/usb_state_pm.rst
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,10 +54,15 @@ The application power level is imposed using the :c:struct:`power_manager_restri
54
54
55
55
* If the USB state is set to :c:enum:`USB_STATE_POWERED`, the module restricts the power down level to the :c:enum:`POWER_MANAGER_LEVEL_SUSPENDED`.
56
56
* If the USB state is set to :c:enum:`USB_STATE_ACTIVE`, the :c:enum:`POWER_MANAGER_LEVEL_ALIVE` is required.
57
-
* If the USB state is set to :c:enum:`USB_STATE_DISCONNECTED`, any power level is allowed.
58
57
* If the USB state is set to :c:enum:`USB_STATE_SUSPENDED`, the :c:enum:`POWER_MANAGER_LEVEL_SUSPENDED` is imposed.
59
58
The module restricts the power down level to the :c:enum:`POWER_MANAGER_LEVEL_SUSPENDED`.
60
59
The module also submits a :c:struct:`force_power_down_event` to force a quick power down.
60
+
* If the USB state is set to :c:enum:`USB_STATE_DISCONNECTED`, any power level is allowed.
61
+
While disconnecting the USB cable, the :c:enum:`USB_STATE_SUSPENDED` USB state might be reported before the :c:enum:`USB_STATE_DISCONNECTED` USB state.
62
+
For the application to behave consistently regardless of whether the :c:enum:`USB_STATE_SUSPENDED` USB state was reported, the module also submits a :c:struct:`force_power_down_event` to force a quick power down.
63
+
The module initially restricts the power down level to the :c:enum:`POWER_MANAGER_LEVEL_SUSPENDED`.
64
+
Then, after the :ref:`CONFIG_DESKTOP_USB_PM_RESTRICT_REMOVE_DELAY_MS <config_desktop_app_options>` configurable delay, the module removes the power down level restriction.
65
+
This allows you to take actions, such as restart Bluetooth LE advertising, after disconnecting the USB cable without going through reboot.
@@ -71,6 +73,14 @@ Synchronizing RPA and advertising data updates
71
73
With the :kconfig:option:`CONFIG_BT_PRIVACY` Kconfig option enabled, set the :kconfig:option:`CONFIG_CAF_BLE_ADV_ROTATE_RPA` option to synchronize Resolvable Private Address (RPA) rotation with the undirected advertising data update.
72
74
You can control the rotation period with the :kconfig:option:`CONFIG_CAF_BLE_ADV_ROTATE_RPA_TIMEOUT` option and change the randomization factor of the rotation period with the :kconfig:option:`CONFIG_CAF_BLE_ADV_ROTATE_RPA_TIMEOUT_RAND` option.
73
75
76
+
Suspending the module
77
+
=====================
78
+
79
+
When the :kconfig:option:`CONFIG_CAF_BLE_ADV_MODULE_SUSPEND_EVENTS` Kconfig option is enabled, you can suspend the module using a module suspend request event (:c:struct:`module_suspend_req_event`) directed to this module.
80
+
When entering the suspended state, the module stops Bluetooth LE advertising and disconnects connected peers.
81
+
You can resume the module using a module resume request event (:c:struct:`module_resume_req_event`) directed to this module.
82
+
When the :kconfig:option:`CONFIG_CAF_BLE_ADV_SUSPEND_ON_READY` Kconfig option is enabled, the module is suspended automatically right after initialization.
Copy file name to clipboardExpand all lines: doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -317,6 +317,13 @@ nRF Desktop
317
317
* The :ref:`CONFIG_DESKTOP_HIDS_SUBSCRIBER_REPORT_MAX <config_desktop_app_options>` Kconfig option to :ref:`nrf_desktop_hids`.
318
318
The option allows you to limit the number of HID input reports that can be simultaneously processed by the module.
319
319
This limits the number of GATT notifications with HID reports in the Bluetooth stack.
320
+
* The :ref:`nrf_desktop_ble_adv_ctrl` module that is responsible for controlling the :ref:`caf_ble_adv`.
321
+
The module suspends the |ble_adv| when the active USB device is connected (USB state is set to :c:enum:`USB_STATE_ACTIVE`).
322
+
The module resumes the |ble_adv| when the USB is disconnected (USB state is set to :c:enum:`USB_STATE_DISCONNECTED`) and the |ble_adv| was earlier suspended.
323
+
This improves the USB High-Speed performance.
324
+
To enable the module, set the :ref:`CONFIG_DESKTOP_BLE_ADV_CTRL_ENABLE <config_desktop_app_options>` Kconfig option to ``y``.
325
+
To enable the module to suspend and resume the |ble_adv| when the USB state changes, set the :ref:`CONFIG_DESKTOP_BLE_ADV_CTRL_SUSPEND_ON_USB <config_desktop_app_options>` Kconfig option to ``y``.
326
+
These options are enabled for targets that support the USB High-Speed.
320
327
321
328
* Updated:
322
329
@@ -364,6 +371,12 @@ nRF Desktop
364
371
365
372
This change in the nRF54L10 partition map is a breaking change and cannot be performed using DFU.
366
373
As a result, the DFU procedure will fail if you attempt to upgrade the sample firmware based on one of the |NCS| v3.0 releases.
374
+
* The behavior of the :ref:`nrf_desktop_usb_state_pm` on USB cable disconnection.
375
+
While disconnecting the USB cable, the :c:enum:`USB_STATE_SUSPENDED` USB state might be reported before the :c:enum:`USB_STATE_DISCONNECTED` USB state.
376
+
For application to behave consistently regardless of whether the :c:enum:`USB_STATE_SUSPENDED` USB state was reported, the module submits a :c:struct:`force_power_down_event` to force a quick power down.
377
+
The module also restricts the power down level to the :c:enum:`POWER_MANAGER_LEVEL_SUSPENDED`.
378
+
Then, after the :ref:`CONFIG_DESKTOP_USB_PM_RESTRICT_REMOVE_DELAY_MS <config_desktop_app_options>` configurable delay, the module removes the power down level restriction.
379
+
This allows you to take actions, such as restart Bluetooth LE advertising, after disconnecting the USB cable without going through reboot.
367
380
368
381
nRF Machine Learning (Edge Impulse)
369
382
-----------------------------------
@@ -744,6 +757,13 @@ Common Application Framework
744
757
* Removed the tracking of the active Bluetooth connections.
745
758
CAF no longer assumes that the Bluetooth Peripheral device (:kconfig:option:`CONFIG_BT_PERIPHERAL`) supports only one simultaneous connection (:kconfig:option:`CONFIG_BT_MAX_CONN`).
746
759
760
+
* :ref:`caf_ble_adv`:
761
+
762
+
* Updated the module implementation to handle the newly introduced module suspend request event (:c:struct:`module_suspend_req_event`) and module resume request event (:c:struct:`module_resume_req_event`).
763
+
When entering the suspended state, the module stops Bluetooth LE advertising and disconnects connected peers.
764
+
To enable support for these events, use the :kconfig:option:`CONFIG_CAF_BLE_ADV_MODULE_SUSPEND_EVENTS` Kconfig option, which is enabled by default.
765
+
When the :kconfig:option:`CONFIG_CAF_BLE_ADV_SUSPEND_ON_READY` Kconfig option is enabled, the module is suspended automatically right after initialization.
0 commit comments