Skip to content

Conversation

eivindj-nordic
Copy link
Contributor

Add ble_radio_notification library and sample.

@eivindj-nordic eivindj-nordic added this to the v0.9.0 milestone Sep 2, 2025
@eivindj-nordic eivindj-nordic self-assigned this Sep 2, 2025
@eivindj-nordic eivindj-nordic requested review from a team as code owners September 2, 2025 08:54
@github-actions github-actions bot added changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval. labels Sep 2, 2025
Copy link

github-actions bot commented Sep 2, 2025

You can find the documentation preview for this PR here.

@eivindj-nordic eivindj-nordic requested a review from a team as a code owner September 2, 2025 08:59
@github-actions github-actions bot removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Sep 2, 2025
CODEOWNERS Outdated
@@ -89,6 +90,7 @@
/tests/lib/bm_zms/ @nrfconnect/ncs-bm @rghaddab
/tests/lib/ble_qwr/ @nrfconnect/ncs-bm
/tests/lib/ble_racp/ @nrfconnect/ncs-bm
tests/lib/ble_radio_notif/ @nrfconnect/ncs-bm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tests/lib/ble_radio_notif/ @nrfconnect/ncs-bm
/tests/lib/ble_radio_notif/ @nrfconnect/ncs-bm

Seems like the other ones start with /

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, thanks

Overview
********

The library allows the user to register a handler to receive the radio notifications and configure the distance in microseconds between the Radio Notification signal and the radio event.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The library allows the user to register a handler to receive the radio notifications and configure the distance in microseconds between the Radio Notification signal and the radio event.
The library allows the user to register a handler to receive the radio notifications and configure the distance in microseconds between the active Radio Notification signal and the radio event.

The library is enabled and configured entirely using the Kconfig system.
Set the :kconfig:option:`CONFIG_BLE_RADIO_NOTIFICATION` Kconfig option to enable the library.

The library uses the ``SWI02`` IRQ. Use the :kconfig:option:`CONFIG_BLE_RADIO_NOTIFICATION_IRQ_PRIO` Kconfig option to set the IRQ priority.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the correct place to mention it, but some priority levels shall not be used.
This used to be documented in the SDS: https://docs.nordicsemi.com/bundle/sds_s140/page/SDS/s1xx/processor_avail_interrupt_latency/exception_mgmt_sd.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think it can be documented in the Kconfig option at least.


if BLE_RADIO_NOTIFICATION

config BLE_RADIO_NOTIFICATION_IRQ_PRIO
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add a range that disallows 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a help text that level 0 and 4 is reserved by the SoftDevice.

NVIC_ClearPendingIRQ(RADIO_NOTIFICATION_IRQn);
NVIC_EnableIRQ(RADIO_NOTIFICATION_IRQn);

return sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, distance);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit limiting. The library will only support generating both active and inactive notifications.
There are several use cases that would only need only active or inactive notification.

I think it would be better to allow the user to configure this with a config, that can select the different options for softdevice:

NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, /**< Using interrupt for notification when the radio will be enabled. */
NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, /**< Using interrupt for notification when the radio has been disabled. */
NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH, /**< Using interrupt for notification both when the radio will be enabled and disabled. */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit limiting indeed. This module mimics the behavior from nRF5 SDK. I can look into adding a Kconfig option for this, keeping the current behavior as the default.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is the same behavior as nRF5 SDK, it may be good as is. There is always the opportunity to use the SD interface directly if someone wants only active or inactive notifications.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Kconfig choice.

Building and running
********************

This sample can be found under :file:`samples/bluetooth/ble_hrs/` in the |BMshort| folder structure.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This sample can be found under :file:`samples/bluetooth/ble_hrs/` in the |BMshort| folder structure.
This sample can be found under :file:`samples/bluetooth/ble_radio_notification/` in the |BMshort| folder structure.


.. include:: /includes/softdevice_flash.txt

.. _ble_hrs_sample_testing:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. _ble_hrs_sample_testing:
.. _ble_radio_notification_sample_testing:

CONFIG_NRF_SDH=y

CONFIG_BLE_ADV=y
CONFIG_BLE_ADV_NAME="nRF_BM_HRS"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CONFIG_BLE_ADV_NAME="nRF_BM_HRS"
CONFIG_BLE_ADV_NAME="nRF_BM_RADIO_NOTIFICATION"

Or an abbreviation

CONFIG_BLE_ADV_NAME="nRF_BM_HRS"
CONFIG_BLE_ADV_EXTENDED_ADVERTISING=n
CONFIG_BLE_ADV_DIRECTED_ADVERTISING=n

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps:

Suggested change
CONFIG_BLE_ADV_FAST_ADVERTISING_INTERVAL=400
CONFIG_BLE_ADV_SLOW_ADVERTISING_INTERVAL=1600

So it blinks at 4Hz, then 1 Hz. The default blinks a bit fast.

/**
* @brief Function for initializing the Radio Notification module.
*
* @param[in] distance The time from an Active event until the radio is activated.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The distance is from the active event until the SoftDevice does the preparation for the radio event.
The time between the preparation and the actual radio activity will vary depending on the role that is scheduled.

It is documented like this in the softdevice

* @param[in] distance_us Distance between the ACTIVE notification signal and start of radio event
* preparation by SoftDevice in microseconds.

@eivindj-nordic eivindj-nordic force-pushed the radio_notif branch 3 times, most recently from e5a75ba to 8c2a381 Compare September 2, 2025 14:08
Add ble_radio_notification library and sample.

Signed-off-by: Eivind Jølsgard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-required PR must not be merged without tech writer approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants