Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/benchmarks/current_consumption/beacon_idle/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(beacon_idle)

target_sources(app PRIVATE src/main.c)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y

CONFIG_PM_S2RAM=y
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
&uart136 {
zephyr,pm-device-runtime-auto;
disable-rx;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/ {
aliases {
/delete-property/ sw3;
};
};

/delete-node/ &button3;

&uart20 {
zephyr,pm-device-runtime-auto;
disable-rx;
};

&led0 {
gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
label = "Green LED 0";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
&uart20 {
zephyr,pm-device-runtime-auto;
disable-rx;
};
11 changes: 11 additions & 0 deletions tests/benchmarks/current_consumption/beacon_idle/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_DEVICE_NAME="Test beacon"

CONFIG_PM=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y
CONFIG_POWEROFF=y

CONFIG_DK_LIBRARY=y
CONFIG_ASSERT=y
114 changes: 114 additions & 0 deletions tests/benchmarks/current_consumption/beacon_idle/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#include <zephyr/types.h>
#include <stddef.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/util.h>

#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>

#include <dk_buttons_and_leds.h>

#include <zephyr/pm/device.h>
#include <zephyr/pm/device_runtime.h>

#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
#define SLEEP_TIME_MS 1000

/*
* Set Advertisement data. Based on the Eddystone specification:
* https://github.com/google/eddystone/blob/master/protocol-specification.md
* https://github.com/google/eddystone/tree/master/eddystone-url
*/
static const struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_NO_BREDR),
BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0xaa, 0xfe),
BT_DATA_BYTES(BT_DATA_SVC_DATA16,
0xaa, 0xfe, /* Eddystone UUID */
0x10, /* Eddystone-URL frame type */
0x00, /* Calibrated Tx power at 0m */
0x00, /* URL Scheme Prefix http://www. */
'z', 'e', 'p', 'h', 'y', 'r',
'p', 'r', 'o', 'j', 'e', 'c', 't',
0x08) /* .org */
};

/* Set Scan Response data */
static const struct bt_data sd[] = {
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
};

static void bt_ready(int err)
{
char addr_s[BT_ADDR_LE_STR_LEN];
bt_addr_le_t addr = {0};
size_t count = 1;

if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
}

printk("Bluetooth initialized\n");

/* Start advertising */
err = bt_le_adv_start(BT_LE_ADV_NCONN_IDENTITY, ad, ARRAY_SIZE(ad),
sd, ARRAY_SIZE(sd));
if (err) {
printk("Advertising failed to start (err %d)\n", err);
return;
}


/* For connectable advertising you would use
* bt_le_oob_get_local(). For non-connectable non-identity
* advertising an non-resolvable private address is used;
* there is no API to retrieve that.
*/

bt_id_get(&addr, &count);
bt_addr_le_to_str(&addr, addr_s, sizeof(addr_s));

printk("Beacon started, advertising as %s\n", addr_s);
}

int main(void)
{
int err;

err = dk_leds_init();
if (err) {
printk("DK leds init failed (err %d)\n", err);
}
dk_set_led_off(DK_LED1);
printk("Starting Beacon Demo\n");

while (1) {
printk("Starting Beacon\n");
dk_set_led_on(DK_LED1);

err = bt_enable(bt_ready);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
}

k_msleep(SLEEP_TIME_MS);
dk_set_led_off(DK_LED1);

printk("Stopping Beacon\n");
err = bt_disable();
if (err) {
printk("Bluetooth stop failed (err %d)\n", err);
}

k_msleep(SLEEP_TIME_MS);
}

return 0;
}
31 changes: 31 additions & 0 deletions tests/benchmarks/current_consumption/beacon_idle/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
common:
sysbuild: true
tags:
- ci_tests_benchmarks_current_consumption
- ppk_power_measure
- bluetooth
harness: pytest
harness_config:
fixture: ppk_power_measure
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_beacon_idle"
tests:
benchmarks.current_consumption.beacon_idle.nrf54h:
platform_allow:
- nrf54h20dk/nrf54h20/cpuapp
integration_platforms:
- nrf54h20dk/nrf54h20/cpuapp
extra_args:
- ipc_radio_CONFIG_PM=y
- ipc_radio_CONFIG_PM_DEVICE=y
- ipc_radio_CONFIG_PM_DEVICE_RUNTIME=y
- ipc_radio_POWEROFF=y
- SB_CONFIG_NETCORE_IPC_RADIO=y
- SB_CONFIG_NETCORE_IPC_RADIO_BT_HCI_IPC=y
benchmarks.current_consumption.beacon_idle.nrf54l:
platform_allow:
- nrf54l15dk/nrf54l15/cpuapp
- nrf54lm20dk/nrf54lm20a/cpuapp
integration_platforms:
- nrf54l15dk/nrf54l15/cpuapp
- nrf54lm20dk/nrf54lm20a/cpuapp
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ manifest:
# https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html
- name: zephyr
repo-path: sdk-zephyr
revision: 5696f6b423a54390721955d6e0e63c363e02cfff
revision: pull/3314/head
import:
# In addition to the zephyr repository itself, NCS also
# imports the contents of zephyr/west.yml at the above
Expand Down
Loading