diff --git a/tests/benchmarks/multicore/idle_spim_loopback/Kconfig b/tests/benchmarks/multicore/idle_spim_loopback/Kconfig index f14517bb87eb..5000250506bb 100644 --- a/tests/benchmarks/multicore/idle_spim_loopback/Kconfig +++ b/tests/benchmarks/multicore/idle_spim_loopback/Kconfig @@ -45,5 +45,29 @@ config TEST_SPI_RELEASE_BEFORE_SLEEP first test iteration will see SPI CS signal activation. Next test iterations will NOT observe changes on SPI CS signal. +choice GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION + prompt "Global domain clock frequency" + default GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ + bool "320MHz" + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ + bool "256MHz" + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ + bool "128MHz" + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ + bool "64MHz" + +endchoice + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ + int + default 320 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ + default 256 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ + default 128 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ + default 64 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ source "Kconfig.zephyr" diff --git a/tests/benchmarks/multicore/idle_spim_loopback/src/main.c b/tests/benchmarks/multicore/idle_spim_loopback/src/main.c index e66ab97c56fd..1834f5e86476 100644 --- a/tests/benchmarks/multicore/idle_spim_loopback/src/main.c +++ b/tests/benchmarks/multicore/idle_spim_loopback/src/main.c @@ -12,6 +12,8 @@ LOG_MODULE_REGISTER(idle_spim_loopback, LOG_LEVEL_INF); #include #include #include +#include +#include #define DELTA (1) @@ -49,6 +51,38 @@ static volatile uint32_t high, low; static struct k_timer my_timer; static bool timer_expired; +#if defined(CONFIG_CLOCK_CONTROL) +const struct nrf_clock_spec clk_spec_global_hsfll = { + .frequency = MHZ(CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ) +}; + +/* + * Set Global Domain frequency (HSFLL120) + * based on: CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ + */ +void set_global_domain_frequency(void) +{ + int err; + int res; + struct onoff_client cli; + const struct device *hsfll_dev = DEVICE_DT_GET(DT_NODELABEL(hsfll120)); + + printk("Requested frequency [Hz]: %d\n", clk_spec_global_hsfll.frequency); + sys_notify_init_spinwait(&cli.notify); + err = nrf_clock_control_request(hsfll_dev, &clk_spec_global_hsfll, &cli); + printk("Return code: %d\n", err); + __ASSERT_NO_MSG(err < 3); + __ASSERT_NO_MSG(err >= 0); + do { + err = sys_notify_fetch_result(&cli.notify, &res); + k_yield(); + } while (err == -EAGAIN); + printk("Clock control request return value: %d\n", err); + printk("Clock control request response code: %d\n", res); + __ASSERT_NO_MSG(err == 0); + __ASSERT_NO_MSG(res == 0); +} +#endif /* CONFIG_CLOCK_CONTROL */ void my_timer_handler(struct k_timer *dummy) { @@ -97,6 +131,12 @@ int main(void) .count = 1 }; +#if defined(CONFIG_CLOCK_CONTROL) + k_msleep(1000); + set_global_domain_frequency(); + k_msleep(100); +#endif + LOG_INF("Multicore idle_spi_loopback test on %s", CONFIG_BOARD_TARGET); LOG_INF("Core will sleep for %u ms", CONFIG_TEST_SLEEP_DURATION_MS); LOG_INF("Testing SPIM device %s", spim_spec.bus->name); diff --git a/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml b/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml index 2f715492553f..d4d63587f721 100644 --- a/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml +++ b/tests/benchmarks/multicore/idle_spim_loopback/testcase.yaml @@ -82,6 +82,45 @@ tests: pytest_root: - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + benchmarks.multicore.idle_spim_loopback.4_bytes.gd_freq_256MHz.s2ram_fast: + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - CONFIG_CLOCK_CONTROL=y + - CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ=y + 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_s2ram" + + benchmarks.multicore.idle_spim_loopback.4_bytes.gd_freq_128MHz.s2ram_fast: + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - CONFIG_CLOCK_CONTROL=y + - CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ=y + 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_s2ram" + + benchmarks.multicore.idle_spim_loopback.4_bytes.gd_freq_64MHz.s2ram_fast: + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - CONFIG_CLOCK_CONTROL=y + - CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ=y + 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_s2ram" + # # 16 Bytes of data # @@ -163,6 +202,48 @@ tests: pytest_root: - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + benchmarks.multicore.idle_spim_loopback.16_bytes.gd_freq_256MHz.s2ram_fast: + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - idle_spim_loopback_CONFIG_DATA_FIELD=16 + - CONFIG_CLOCK_CONTROL=y + - CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ=y + 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_s2ram" + + benchmarks.multicore.idle_spim_loopback.16_bytes.gd_freq_128MHz.s2ram_fast: + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - idle_spim_loopback_CONFIG_DATA_FIELD=16 + - CONFIG_CLOCK_CONTROL=y + - CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ=y + 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_s2ram" + + benchmarks.multicore.idle_spim_loopback.16_bytes.gd_freq_64MHz.s2ram_fast: + tags: ppk_power_measure + extra_args: + - idle_spim_loopback_CONF_FILE=prj_s2ram.conf + - idle_spim_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay" + - idle_spim_loopback_CONFIG_DATA_FIELD=16 + - CONFIG_CLOCK_CONTROL=y + - CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ=y + 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_s2ram" + # # 4 Bytes of data with SPI Chip Select Lock enabled #