Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Increase min-residency-us for idle_cache_disabled and s2ram
* so the cpu enters idle_cache_retained state.
*/

/ {
cpus {
power-states {
idle_cache_disabled: idle_cache_disabled {
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
idle_cache_disabled: idle_cache_disabled {
idle_cache_retained: idle_cache_retained {

??? Or I missed something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to enter idle_cache_retained and stay in that state.
In the code I wait for 500 ms.
I must modify "deeper" low power states (idle_cache_disabled and s2ram) to NOT enter these.

I increase min-residency-us for idle_cache_disabled to 790 ms (thus 500 ms is not enough to enter this state).
I increase min-residency-us for s2ram to 800 ms (thus 500 ms is not enough to enter this state).

Original states are:

		power-states {
			// substate-id = <0>; is reserved for "idle", cache powered on
			idle_cache_retained: idle_cache_retained {
				compatible = "zephyr,power-state";
				power-state-name = "suspend-to-idle";
				substate-id = <1>;
				min-residency-us = <700>;
				exit-latency-us = <5>;
			};
			idle_cache_disabled: idle_cache_disabled {
				compatible = "zephyr,power-state";
				power-state-name = "suspend-to-idle";
				substate-id = <2>;
				min-residency-us = <1000>;
				exit-latency-us = <7>;
			};
			s2ram: s2ram {
				compatible = "zephyr,power-state";
				power-state-name = "suspend-to-ram";
				min-residency-us = <2000>;
				exit-latency-us = <33>;
			};
		};

min-residency-us = <790000>;
};

s2ram: s2ram {
Copy link
Contributor

Choose a reason for hiding this comment

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

newline missing line 17

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, thanks.

min-residency-us = <800000>;
};
};
};
};
13 changes: 13 additions & 0 deletions tests/benchmarks/multicore/idle/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ tests:
- idle_SNIPPET=nordic-ppr-xip
- CONFIG_FIRST_SLEEP_OFFSET=y

benchmarks.multicore.idle.nrf54h20dk_cpuapp_cpurad_retained:
harness: console
platform_allow:
- nrf54h20dk/nrf54h20/cpuapp
integration_platforms:
- nrf54h20dk/nrf54h20/cpuapp
extra_args:
- CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
- CONFIG_FIRST_SLEEP_OFFSET=y
- idle_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"
- remote_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"

benchmarks.multicore.idle.nrf54h20dk_cpuapp_cpurad:
harness: console
platform_allow:
Expand Down
2 changes: 0 additions & 2 deletions tests/benchmarks/multicore/idle_flpr/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ CONFIG_NCS_BOOT_BANNER=n
CONFIG_LOG=y
CONFIG_ASSERT=y
CONFIG_GPIO=y

CONFIG_NRF_REGTOOL_VERBOSITY=1
8 changes: 4 additions & 4 deletions tests/benchmarks/multicore/idle_flpr/remote/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(remote)

target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE ../src/main.c)

if(DEFINED CONFIG_SOC_NRF54H20_CPUFLPR)
message(STATUS "Power Mode handler for RISC V is included.")
target_sources(app PRIVATE ../../common/power_off.c)
if(CONFIG_SOC_NRF54H20_CPUFLPR)
message(STATUS "Power Mode handler for RISC V is included.")
target_sources(app PRIVATE ../../common/power_off.c)
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
aliases {
led0 = &led1;
};

leds {
compatible = "gpio-leds";
led1: led_1 {
gpios = < &gpio9 0x1 0x0 >;
label = "Green LED 1";
};
};
};

&gpio9 {
status = "okay";
};

&gpiote130 {
status = "okay";
owned-channels = <1>;
};
3 changes: 1 addition & 2 deletions tests/benchmarks/multicore/idle_flpr/remote/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ CONFIG_NCS_BOOT_BANNER=n
CONFIG_PRINTK=n

CONFIG_ASSERT=y

CONFIG_NRF_REGTOOL_VERBOSITY=1
CONFIG_GPIO=y
3 changes: 3 additions & 0 deletions tests/benchmarks/multicore/idle_flpr/remote/prj_s2ram.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CONFIG_LOG=n

CONFIG_PM=y
CONFIG_POWEROFF=y

Expand All @@ -11,3 +13,4 @@ CONFIG_BOOT_BANNER=n
CONFIG_NCS_BOOT_BANNER=n

CONFIG_ASSERT=y
CONFIG_GPIO=y
17 changes: 0 additions & 17 deletions tests/benchmarks/multicore/idle_flpr/remote/src/main.c

This file was deleted.

28 changes: 21 additions & 7 deletions tests/benchmarks/multicore/idle_flpr/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>

#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(idle_flpr, LOG_LEVEL_INF);

#if !defined(CONFIG_SOC_NRF54H20_CPUFLPR)
/* Unable to use GPIO Zephyr driver on FLPR core due to lack of GPIOTE interrupt. */
#include <zephyr/drivers/gpio.h>

static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
#endif

/* Variables used to make CPU active for ~1 second */
static struct k_timer my_timer;
Expand All @@ -23,11 +27,13 @@ void my_timer_handler(struct k_timer *dummy)
int main(void)
{
int counter = 0;
int ret;

LOG_INF("Multicore idle_flpr test on %s", CONFIG_BOARD_TARGET);
LOG_INF("Main sleeps for %d ms", CONFIG_TEST_SLEEP_DURATION_MS);

#if !defined(CONFIG_SOC_NRF54H20_CPUFLPR)
int ret;

ret = gpio_is_ready_dt(&led);
if (!ret) {
LOG_ERR("LED is not ready");
Expand All @@ -39,38 +45,46 @@ int main(void)
LOG_ERR("Unable to configure GPIO as output");
}
__ASSERT(ret == 0, "Unable to configure GPIO as output\n");
#endif

k_timer_init(&my_timer, my_timer_handler, NULL);

/* Run test forever */
while (1) {
timer_expired = false;

#if !defined(CONFIG_SOC_NRF54H20_CPUFLPR)
/* Turn ON LED */
ret = gpio_pin_set_dt(&led, 1);
#endif

/* start a one-shot timer that expires after 1 second */
k_timer_start(&my_timer, K_MSEC(1000), K_NO_WAIT);

/* Turn ON LED */
ret = gpio_pin_set_dt(&led, 1);
#if !defined(CONFIG_SOC_NRF54H20_CPUFLPR)
if (ret < 0) {
LOG_ERR("Unable to turn on LED");
}
__ASSERT(ret == 0, "Unable to turn on LED\n");
#endif

/* Keep CPU active for ~ 1 second */
while (!timer_expired) {
k_busy_wait(10000);
k_yield();
}

LOG_INF("Run %d", counter);
counter++;

#if !defined(CONFIG_SOC_NRF54H20_CPUFLPR)
/* Turn OFF LED */
ret = gpio_pin_set_dt(&led, 0);
if (ret < 0) {
LOG_ERR("Unable to turn off LED");
}
__ASSERT(ret == 0, "Unable to turn off LED\n");

LOG_INF("Run %d", counter);
counter++;
#endif

/* Sleep / enter low power state */
k_msleep(CONFIG_TEST_SLEEP_DURATION_MS);
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/multicore/idle_flpr/sysbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Add remote project
ExternalZephyrProject_Add(
APPLICATION remote_rad
SOURCE_DIR ${SYSBUILD_NRF_MODULE_DIR}/tests/benchmarks/power_consumption/common/remote_sleep_forever
SOURCE_DIR ${APP_DIR}/remote
BOARD ${SB_CONFIG_BOARD}/${SB_CONFIG_SOC}/cpurad
BOARD_REVISION ${BOARD_REVISION}
)
Expand Down
23 changes: 23 additions & 0 deletions tests/benchmarks/multicore/idle_flpr/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,34 @@ tests:
- "idle_flpr: Run 0"
- "idle_flpr: Run 1"


benchmarks.multicore.idle_flpr.idle_retained:
tags: ppk_power_measure
extra_args:
- CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y
- idle_flpr_CONF_FILE=prj_s2ram.conf
- remote_flpr_CONF_FILE=prj_s2ram.conf
- remote_rad_CONF_FILE=prj_s2ram.conf
- idle_flpr_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_flpr_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_rad_CONFIG_TEST_SLEEP_DURATION_MS=500
- idle_flpr_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"
harness: pytest
harness_config:
fixture: ppk_power_measure
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_ppr_and_idle"

benchmarks.multicore.idle_flpr.idle:
tags: ppk_power_measure
extra_args:
- CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y
- idle_flpr_CONF_FILE=prj_s2ram.conf
- remote_flpr_CONF_FILE=prj_s2ram.conf
- remote_rad_CONF_FILE=prj_s2ram.conf
- idle_flpr_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_flpr_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_rad_CONFIG_TEST_SLEEP_DURATION_MS=500
- idle_flpr_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle.overlay"
harness: pytest
harness_config:
Expand All @@ -39,8 +60,10 @@ tests:
benchmarks.multicore.idle_flpr.s2ram:
tags: ppk_power_measure
extra_args:
- CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y
- idle_flpr_CONF_FILE=prj_s2ram.conf
- remote_flpr_CONF_FILE=prj_s2ram.conf
- remote_rad_CONF_FILE=prj_s2ram.conf
harness: pytest
harness_config:
fixture: ppk_power_measure
Expand Down
17 changes: 17 additions & 0 deletions tests/benchmarks/multicore/idle_ppr/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ tests:
- "idle_ppr: Run 0"
- "idle_ppr: Run 1"

benchmarks.multicore.idle_ppr.idle_retained:
tags: ppk_power_measure
extra_args:
- CONFIG_SOC_NRF54H20_CPURAD_ENABLE=y
- idle_ppr_CONF_FILE=prj_s2ram.conf
- remote_rad_CONF_FILE=prj_s2ram.conf
- remote_ppr_CONF_FILE=prj_s2ram.conf
- idle_ppr_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_rad_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_ppr_CONFIG_TEST_SLEEP_DURATION_MS=500
- idle_ppr_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"
harness: pytest
harness_config:
fixture: ppk_power_measure
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_ppr_and_idle"

benchmarks.multicore.idle_ppr.idle:
tags: ppk_power_measure
extra_args:
Expand Down
31 changes: 31 additions & 0 deletions tests/benchmarks/multicore/idle_pwm_led/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ tests:
- "Multicore idle_pwm_led test iteration 0"
- "Multicore idle_pwm_led test iteration 1"

benchmarks.multicore.idle_pwm_led.nrf54h20dk_cpuapp_cpurad.idle_retained:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
extra_args:
- idle_pwm_led_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_led_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_CONFIG_TEST_SLEEP_DURATION_MS=500
- idle_pwm_led_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"
harness: pytest
harness_config:
fixture: ppk_power_measure
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_idle"

benchmarks.multicore.idle_pwm_led.nrf54h20dk_cpuapp_cpurad.idle:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
Expand Down Expand Up @@ -49,6 +64,22 @@ tests:
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram"

benchmarks.multicore.idle_pwm_led.nrf54h20dk_cpuapp_cpurad.idle_retained_fast:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
extra_args:
- idle_pwm_led_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_led_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_CONFIG_TEST_SLEEP_DURATION_MS=500
- idle_pwm_led_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_0.overlay"
- idle_pwm_led_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"
harness: pytest
harness_config:
fixture: ppk_power_measure
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_idle"

benchmarks.multicore.idle_pwm_led.nrf54h20dk_cpuapp_cpurad.idle_fast:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
Expand Down
31 changes: 31 additions & 0 deletions tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ tests:
- "Iteration 0"
- "Iteration 1"

benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle_retained:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
extra_args:
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_CONFIG_TEST_SLEEP_DURATION_MS=500
- idle_pwm_loopback_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"
harness: pytest
harness_config:
fixture: spi_loopback
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_idle"

benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
Expand Down Expand Up @@ -64,6 +79,22 @@ tests:
- "Iteration 0"
- "Iteration 1"

benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle_retained_fast:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
extra_args:
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_CONFIG_TEST_SLEEP_DURATION_MS=500
- remote_CONFIG_TEST_SLEEP_DURATION_MS=500
- idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
- idle_pwm_loopback_EXTRA_DTC_OVERLAY_FILE="${ZEPHYR_NRF_MODULE_DIR}/tests/benchmarks/multicore/common/workaround_idle_retained.overlay"
harness: pytest
harness_config:
fixture: spi_loopback
pytest_root:
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_idle"

benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle_fast:
filter: not CONFIG_COVERAGE
tags: ppk_power_measure
Expand Down
3 changes: 3 additions & 0 deletions tests/benchmarks/multicore/idle_spim_loopback/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ int main(void)
#endif
LOG_INF("===================================================================");

/* Arbitrary sleep to fix CI synchronization. */
k_msleep(100);

ret = spi_is_ready_dt(&spim_spec);
if (!ret) {
LOG_ERR("Error: SPI device is not ready");
Expand Down
Loading