Skip to content

Commit 6942e59

Browse files
nordic-bamirlubos
authored andcommitted
tests: benchmarks: Test fast UART with different GD frequencies
Default GD frequency is 320MHz Validate fast UART with 256, 128 and 64MHz Signed-off-by: Bartosz Miller <[email protected]>
1 parent 26eb8eb commit 6942e59

File tree

5 files changed

+120
-6
lines changed

5 files changed

+120
-6
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
choice GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION
8+
prompt "Global domain clock frequency"
9+
default GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ
10+
11+
config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ
12+
bool "320MHz"
13+
14+
config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ
15+
bool "256MHz"
16+
17+
config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ
18+
bool "128MHz"
19+
20+
config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ
21+
bool "64MHz"
22+
23+
endchoice
24+
25+
config GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ
26+
int
27+
default 320 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ
28+
default 256 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ
29+
default 128 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ
30+
default 64 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ
31+
32+
source "Kconfig.zephyr"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#
2-
# Copyright (c) 2023 Nordic Semiconductor ASA
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
33
#
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

77
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
88

99
config REMOTE_BOARD
10-
string "The board used for remote target"
10+
string
11+
default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP

tests/benchmarks/multicore/idle_uarte/src/main.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <zephyr/pm/device_runtime.h>
1010
#include <zephyr/kernel.h>
1111
#include <zephyr/logging/log.h>
12+
#include <zephyr/devicetree/clocks.h>
13+
#include <zephyr/drivers/clock_control/nrf_clock_control.h>
1214

1315
/* Note: logging is normally disabled for this test
1416
* Enable only for debugging purposes
@@ -32,6 +34,39 @@ const uint8_t test_pattern[TEST_BUFFER_LEN] = {0x11, 0x12, 0x13, 0x14, 0x15,
3234
static uint8_t test_buffer[TEST_BUFFER_LEN];
3335
static volatile uint8_t uart_error_counter;
3436

37+
#if defined(CONFIG_CLOCK_CONTROL)
38+
const struct nrf_clock_spec clk_spec_global_hsfll = {
39+
.frequency = MHZ(CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ)
40+
};
41+
42+
/*
43+
* Set Global Domain frequency (HSFLL120)
44+
* based on: CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ
45+
*/
46+
void set_global_domain_frequency(void)
47+
{
48+
int err;
49+
int res;
50+
struct onoff_client cli;
51+
const struct device *hsfll_dev = DEVICE_DT_GET(DT_NODELABEL(hsfll120));
52+
53+
printk("Requested frequency [Hz]: %d\n", clk_spec_global_hsfll.frequency);
54+
sys_notify_init_spinwait(&cli.notify);
55+
err = nrf_clock_control_request(hsfll_dev, &clk_spec_global_hsfll, &cli);
56+
printk("Return code: %d\n", err);
57+
__ASSERT_NO_MSG(err < 3);
58+
__ASSERT_NO_MSG(err >= 0);
59+
do {
60+
err = sys_notify_fetch_result(&cli.notify, &res);
61+
k_yield();
62+
} while (err == -EAGAIN);
63+
printk("Clock control request return value: %d\n", err);
64+
printk("Clock control request response code: %d\n", res);
65+
__ASSERT_NO_MSG(err == 0);
66+
__ASSERT_NO_MSG(res == 0);
67+
}
68+
#endif /* CONFIG_CLOCK_CONTROL */
69+
3570
/*
3671
* Callback function for UART async transmission
3772
*/
@@ -110,6 +145,11 @@ int main(void)
110145
.data_bits = UART_CFG_DATA_BITS_8,
111146
.flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS};
112147

148+
#if defined(CONFIG_CLOCK_CONTROL)
149+
k_msleep(1000);
150+
set_global_domain_frequency();
151+
#endif
152+
113153
printk("Hello World! %s\n", CONFIG_BOARD_TARGET);
114154
printk("UART instance: %s\n", uart_dev->name);
115155

tests/benchmarks/multicore/idle_uarte/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/benchmarks/multicore/idle_uarte/testcase.yaml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ tests:
1111
integration_platforms:
1212
- nrf54h20dk/nrf54h20/cpuapp
1313
extra_args:
14-
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
1514
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_normal.overlay"
1615
harness_config:
1716
fixture: gpio_loopback
@@ -25,21 +24,64 @@ tests:
2524
integration_platforms:
2625
- nrf54h20dk/nrf54h20/cpuapp
2726
extra_args:
28-
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
2927
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
3028
harness_config:
3129
fixture: gpio_loopback
3230
pytest_root:
3331
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_uarte"
3432

33+
benchmarks.multicore.idle_uarte.fast.gd_freq_256MHz.nrf54h20dk_cpuapp_cpurad.s2ram:
34+
harness: pytest
35+
platform_allow:
36+
- nrf54h20dk/nrf54h20/cpuapp
37+
integration_platforms:
38+
- nrf54h20dk/nrf54h20/cpuapp
39+
extra_args:
40+
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
41+
- CONFIG_CLOCK_CONTROL=y
42+
- CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ=y
43+
harness_config:
44+
fixture: gpio_loopback
45+
pytest_root:
46+
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_uarte"
47+
48+
benchmarks.multicore.idle_uarte.fast.gd_freq_128MHz.nrf54h20dk_cpuapp_cpurad.s2ram:
49+
harness: pytest
50+
platform_allow:
51+
- nrf54h20dk/nrf54h20/cpuapp
52+
integration_platforms:
53+
- nrf54h20dk/nrf54h20/cpuapp
54+
extra_args:
55+
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
56+
- CONFIG_CLOCK_CONTROL=y
57+
- CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ=y
58+
harness_config:
59+
fixture: gpio_loopback
60+
pytest_root:
61+
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_uarte"
62+
63+
benchmarks.multicore.idle_uarte.fast.gd_freq_64MHz.nrf54h20dk_cpuapp_cpurad.s2ram:
64+
harness: pytest
65+
platform_allow:
66+
- nrf54h20dk/nrf54h20/cpuapp
67+
integration_platforms:
68+
- nrf54h20dk/nrf54h20/cpuapp
69+
extra_args:
70+
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
71+
- CONFIG_CLOCK_CONTROL=y
72+
- CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ=y
73+
harness_config:
74+
fixture: gpio_loopback
75+
pytest_root:
76+
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_uarte"
77+
3578
benchmarks.multicore.idle_uarte.automatic_pm.nrf54h20dk_cpuapp_cpurad.s2ram:
3679
harness: pytest
3780
platform_allow:
3881
- nrf54h20dk/nrf54h20/cpuapp
3982
integration_platforms:
4083
- nrf54h20dk/nrf54h20/cpuapp
4184
extra_args:
42-
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
4385
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_normal.overlay"
4486
- CONFIG_PRINTK=y
4587
- CONFIG_LOG=y

0 commit comments

Comments
 (0)