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
@github-actions
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
@eivindj-nordic eivindj-nordic force-pushed the radio_notif branch 4 times, most recently from 8c2a381 to 974e8c4 Compare September 2, 2025 14:22
CODEOWNERS Outdated
/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
Contributor

Choose a reason for hiding this comment

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

alignment is off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected.

#define STATIC static
#endif

LOG_MODULE_REGISTER(ble_radio_ntf, CONFIG_BLE_RADIO_NTF_LOG_LEVEL);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
LOG_MODULE_REGISTER(ble_radio_ntf, CONFIG_BLE_RADIO_NTF_LOG_LEVEL);
LOG_MODULE_REGISTER(ble_radio_notification, CONFIG_BLE_RADIO_NOTIFICATION_LOG_LEVEL);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed

IRQ Priority level 0 and 4 are reserved by the SoftDevice.


module=BLE_RADIO_NTF
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
module=BLE_RADIO_NTF
module=BLE_RADIO_NOTIFICATION

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed.

range 50 5500
default 800

module=BLE_RADIO_NTF_SAMPLE
Copy link
Contributor

Choose a reason for hiding this comment

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

fix names as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines 58 to 64
void setUp(void)
{
}
void tearDown(void)
{
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
void setUp(void)
{
}
void tearDown(void)
{
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

/* Application event handler for handling Radio Notification events. */
static ble_radio_notification_evt_handler_t evt_handler;

STATIC void radio_notification_isr(const void *arg)
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we using STATIC here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Se definition above. It is to be able to call the event handler from the unit test.

}
}

uint32_t ble_radio_notification_init(uint32_t distance,
Copy link
Contributor

Choose a reason for hiding this comment

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

int ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not when we are returning nrf_error.

type = NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE;
#endif

evt_handler = _evt_handler;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the user be able to unset the callback? If not, we could check against NULL here, and avoid doing at every interrupt before invoking the callback. Otherwise, If it should be possible to unset the callback, we could provide an explicit de-initialization function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, will move the check for evt_handler to the initialization. I don't think having a callback-unset would provide much value, unless that is also disabling the IRQ. Though, in that case, if disabling while the radio is active, the radio active state might be messed up.

Comment on lines 36 to 38
#if defined CONFIG_BLE_RADIO_NOTIFICATION_ON_BOTH
radio_active = !radio_active;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would use the macro IS_ENABLED() here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't do that anywhere else, only for runtime if's.

@eivindj-nordic
Copy link
Contributor Author

@nordicjm Please have another look.

#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
menuconfig BLE_RADIO_NOTIFICATION
Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized that this is not expressing the dependency on SoftDevice.

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. Note that this applies for most of the bluetooth libraries. So we should clean it up.

Copy link
Contributor

Choose a reason for hiding this comment

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

@eivindj-nordic What do you mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do not have this dependency for many of the other ble libraries. See connection parameters etc.

@eivindj-nordic eivindj-nordic force-pushed the radio_notif branch 6 times, most recently from 137e477 to a34885f Compare October 3, 2025 07:18
@eivindj-nordic eivindj-nordic force-pushed the radio_notif branch 2 times, most recently from fe2b67f to ba0b865 Compare October 3, 2025 11:56
Copy link
Contributor

@anhmolt anhmolt left a comment

Choose a reason for hiding this comment

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

Approving, but please address comments.

@eivindj-nordic
Copy link
Contributor Author

@nordicjm Please have another look.


#include <stdint.h>
#include <stdbool.h>
#include <nrf_soc.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this is not needed here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to c-file.

CONFIG_LOG_BACKEND_BM_UARTE=y

CONFIG_SOFTDEVICE=y
CONFIG_NRF_SDH=y
Copy link
Contributor

Choose a reason for hiding this comment

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

just CONFIG_SOFTDEVICE should work now

CONFIG_BLE_ADV_FAST_ADVERTISING_INTERVAL=400
CONFIG_BLE_ADV_SLOW_ADVERTISING_INTERVAL=1600
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to override defaults here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strictly no, though it makes it more observable by looking at the LED. With default intervals it blinks quite fast regardless of the advertising mode.

NRF54L15_XXAA
CONFIG_BLE_RADIO_NOTIFICATION_ON_BOTH=1
CONFIG_BLE_RADIO_NOTIFICATION_IRQ_PRIO=5
SWI02_IRQn=0
Copy link
Contributor

Choose a reason for hiding this comment

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

uhm why SWI02_IRQn=0 (equal zero?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just needed to be defined to something, updated to 30 as is what it is defined to for nRF54l15.

@eivindj-nordic eivindj-nordic force-pushed the radio_notif branch 3 times, most recently from 8cc6735 to e6dd6fd Compare October 21, 2025 12:51
@eivindj-nordic eivindj-nordic requested a review from lemrey October 22, 2025 06:28
@eivindj-nordic
Copy link
Contributor Author

@nordicjm @nrfconnect/ncs-bm-doc Please review!

Add ble_radio_notification library and sample.

Signed-off-by: Eivind Jølsgard <[email protected]>
@eivindj-nordic eivindj-nordic merged commit 3571470 into nrfconnect:main Nov 5, 2025
10 checks passed
@eivindj-nordic eivindj-nordic deleted the radio_notif branch November 5, 2025 12:59
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.

7 participants