Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: benchmarks: multicore: Test fast PWM with different GD freq. #19680

Merged
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
25 changes: 25 additions & 0 deletions tests/benchmarks/multicore/idle_pwm_loopback/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,29 @@ config TEST_SLEEP_DURATION_MS
Based on the value of 'min-residency-us' specified for each power state defined in the DTS,
core enters the lowest possible power state.

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"
44 changes: 44 additions & 0 deletions tests/benchmarks/multicore/idle_pwm_loopback/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ LOG_MODULE_REGISTER(idle_pwm_loop, LOG_LEVEL_INF);
#include <zephyr/drivers/gpio.h>
#include <zephyr/pm/device_runtime.h>

#if defined(CONFIG_CLOCK_CONTROL)
#include <zephyr/devicetree/clocks.h>
#include <zephyr/drivers/clock_control/nrf_clock_control.h>
#endif

#if !DT_NODE_EXISTS(DT_NODELABEL(pwm_to_gpio_loopback))
#error "Unsupported board: pwm_to_gpio_loopback node is not defined"
Expand All @@ -30,6 +34,41 @@ 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)
{
timer_expired = true;
Expand Down Expand Up @@ -58,6 +97,11 @@ int main(void)
uint32_t tolerance;
int ret;

#if defined(CONFIG_CLOCK_CONTROL)
k_msleep(1000);
set_global_domain_frequency();
#endif

/* Set PWM fill ratio to 50% */
pulse = pwm_out.period >> 1;

Expand Down
92 changes: 75 additions & 17 deletions tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
common:
sysbuild: true
tags: ci_build ci_tests_benchmarks_multicore
tags:
- ci_build
- ci_tests_benchmarks_multicore
platform_allow:
- nrf54h20dk/nrf54h20/cpuapp
integration_platforms:
Expand All @@ -21,10 +23,10 @@ tests:
benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle:
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_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
harness: pytest
harness_config:
fixture: spi_loopback
Expand All @@ -34,8 +36,8 @@ tests:
benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram:
tags: ppk_power_measure
extra_args:
idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
harness: pytest
harness_config:
fixture: spi_loopback
Expand All @@ -44,7 +46,7 @@ tests:

benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.no_sleep_fast:
extra_args:
idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
- idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
harness: console
harness_config:
type: multi_line
Expand All @@ -57,23 +59,79 @@ tests:
benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle_fast:
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_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"
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.s2ram_fast:
benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.no_clock_control:
tags: ppk_power_measure
extra_args:
idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
remote_CONF_FILE=prj_s2ram.conf
idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.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_s2ram"

benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_320MHz:
tags: ppk_power_measure
extra_args:
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
- idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y
- idle_pwm_loopback_CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ=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_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_256MHz:
tags: ppk_power_measure
extra_args:
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
- idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y
- idle_pwm_loopback_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_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_128MHz:
tags: ppk_power_measure
extra_args:
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
- idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y
- idle_pwm_loopback_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_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_64MHz:
tags: ppk_power_measure
extra_args:
- idle_pwm_loopback_CONF_FILE=prj_s2ram.conf
- remote_CONF_FILE=prj_s2ram.conf
- idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay"
- idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y
- idle_pwm_loopback_CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ=y
harness: pytest
harness_config:
fixture: spi_loopback
Expand Down
Loading