Skip to content

Commit cbf745e

Browse files
nordic-bamirlubos
authored andcommitted
tests: benchmarks: Start testing Fast UART with s2ram
This test uses P7 for UARTE120 instance Signed-off-by: Bartosz Miller <[email protected]>
1 parent b5c963c commit cbf745e

File tree

7 files changed

+165
-0
lines changed

7 files changed

+165
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&dma_fast_region {
8+
status = "okay";
9+
};
10+
11+
/* UART device used for test
12+
* not the default UART assignment for the LD
13+
*/
14+
&pinctrl {
15+
uart120_default_alt: uart120_default_alt {
16+
group1 {
17+
psels = <NRF_PSEL(UART_TX, 7, 7)>,
18+
<NRF_PSEL(UART_RX, 7, 4)>;
19+
};
20+
};
21+
22+
uart120_sleep_alt: uart120_sleep_alt {
23+
group1 {
24+
psels = <NRF_PSEL(UART_TX, 7, 7)>,
25+
<NRF_PSEL(UART_RX, 7, 4)>;
26+
low-power-enable;
27+
};
28+
};
29+
};
30+
31+
dut: &uart120 {
32+
status = "okay";
33+
memory-regions = <&dma_fast_region>;
34+
pinctrl-0 = <&uart120_default_alt>;
35+
pinctrl-1 = <&uart120_sleep_alt>;
36+
pinctrl-names = "default", "sleep";
37+
current-speed = <115200>;
38+
};

tests/benchmarks/multicore/idle_uarte/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CONFIG_POWEROFF=y
1212

1313
CONFIG_BOOT_BANNER=n
1414
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n
15+
CONFIG_NRFS=y
1516

1617
# Enable for debugging purposes only
1718
CONFIG_PRINTK=n

tests/benchmarks/multicore/idle_uarte/remote/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ CONFIG_SERIAL=n
66
CONFIG_GPIO=n
77
CONFIG_BOOT_BANNER=n
88
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n
9+
CONFIG_NRFS=y

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,60 @@
55
*/
66

77
#include <zephyr/kernel.h>
8+
#include <nrfs_backend_ipc_service.h>
9+
#include <nrfs_gdpwr.h>
10+
11+
/* Required to power off the GD2 and GD3 domains
12+
* Will be removed when GD handling
13+
* is implemented in sdk-zephyr
14+
*/
15+
static void gdpwr_handler(nrfs_gdpwr_evt_t const *p_evt, void *context)
16+
{
17+
switch (p_evt->type) {
18+
case NRFS_GDPWR_REQ_APPLIED:
19+
printk("GDPWR handler - response received: 0x%x, CTX=%d\n", p_evt->type,
20+
(uint32_t)context);
21+
break;
22+
case NRFS_GDPWR_REQ_REJECTED:
23+
printk("GDPWR handler - request rejected: 0x%x, CTX=%d\n", p_evt->type,
24+
(uint32_t)context);
25+
break;
26+
default:
27+
printk("GDPWR handler - unexpected event: 0x%x, CTX=%d\n", p_evt->type,
28+
(uint32_t)context);
29+
break;
30+
}
31+
}
32+
33+
/* Required to power off the GD2 and GD3 domains
34+
* Will be removed when GD handling
35+
* is implemented in sdk-zephyr
36+
*/
37+
static void clear_global_power_domains_requests(void)
38+
{
39+
int service_status;
40+
int tst_ctx = 1;
41+
42+
service_status = nrfs_gdpwr_init(gdpwr_handler);
43+
printk("Response: %d\n", service_status);
44+
printk("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_SLOW\n");
45+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_SLOW,
46+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
47+
printk("Response: %d\n", service_status);
48+
printk("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_FAST\n");
49+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_FAST,
50+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
51+
printk("Response: %d\n", service_status);
52+
printk("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_MAIN_SLOW\n");
53+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_MAIN_SLOW,
54+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx);
55+
printk("Response: %d\n", service_status);
56+
}
857

958
int main(void)
1059
{
60+
nrfs_backend_wait_for_connection(K_FOREVER);
61+
clear_global_power_domains_requests();
1162
k_sleep(K_FOREVER);
1263

1364
return 0;

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

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#include <zephyr/pm/device_runtime.h>
99
#include <zephyr/kernel.h>
1010
#include <zephyr/logging/log.h>
11+
#include <zephyr/pm/device.h>
12+
#include <zephyr/pm/device_runtime.h>
13+
#include <nrfs_backend_ipc_service.h>
14+
#include <nrfs_gdpwr.h>
1115

1216
/* Note: logging is normally disabled for this test
1317
* Enable only for debugging purposes
@@ -31,6 +35,53 @@ const uint8_t test_pattern[TEST_BUFFER_LEN] = {0x11, 0x12, 0x13, 0x14, 0x15,
3135
static uint8_t test_buffer[TEST_BUFFER_LEN];
3236
static volatile uint8_t uart_error_counter;
3337

38+
/* Required to power off the GD2 and GD3 domains
39+
* Will be removed when GD handling
40+
* is implemented in sdk-zephyr
41+
*/
42+
static void gdpwr_handler(nrfs_gdpwr_evt_t const *p_evt, void *context)
43+
{
44+
switch (p_evt->type) {
45+
case NRFS_GDPWR_REQ_APPLIED:
46+
printk("GDPWR handler - response received: 0x%x, CTX=%d\n", p_evt->type,
47+
(uint32_t)context);
48+
break;
49+
case NRFS_GDPWR_REQ_REJECTED:
50+
printk("GDPWR handler - request rejected: 0x%x, CTX=%d\n", p_evt->type,
51+
(uint32_t)context);
52+
break;
53+
default:
54+
printk("GDPWR handler - unexpected event: 0x%x, CTX=%d\n", p_evt->type,
55+
(uint32_t)context);
56+
break;
57+
}
58+
}
59+
60+
/* Required to power off the GD2 and GD3 domains
61+
* Will be removed when GD handling
62+
* is implemented in sdk-zephyr
63+
*/
64+
static void clear_global_power_domains_requests(void)
65+
{
66+
int service_status;
67+
int tst_ctx = 1;
68+
69+
service_status = nrfs_gdpwr_init(gdpwr_handler);
70+
printk("Response: %d\n", service_status);
71+
printk("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_SLOW\n");
72+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_SLOW,
73+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
74+
printk("Response: %d\n", service_status);
75+
printk("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_ACTIVE_FAST\n");
76+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_FAST,
77+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
78+
printk("Response: %d\n", service_status);
79+
printk("Sending GDPWR DISABLE request for: GDPWR_POWER_DOMAIN_MAIN_SLOW\n");
80+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_MAIN_SLOW,
81+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx);
82+
printk("Response: %d\n", service_status);
83+
}
84+
3485
/*
3586
* Callback function for UART async transmission
3687
*/
@@ -53,6 +104,7 @@ static void async_uart_callback(const struct device *dev, struct uart_event *evt
53104
printk("Recieived data byte %d does not match pattern 0x%x != "
54105
"0x%x\n",
55106
index, test_buffer[index], test_pattern[index]);
107+
__ASSERT_NO_MSG(test_buffer[index] == test_pattern[index]);
56108
}
57109
}
58110
break;
@@ -79,6 +131,13 @@ int main(void)
79131
.data_bits = UART_CFG_DATA_BITS_8,
80132
.flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS};
81133

134+
printk("Hello World! %s\n", CONFIG_BOARD_TARGET);
135+
printk("UART instance: %s\n", uart_dev->name);
136+
137+
nrfs_backend_wait_for_connection(K_FOREVER);
138+
clear_global_power_domains_requests();
139+
k_msleep(250);
140+
82141
err = uart_configure(uart_dev, &test_uart_config);
83142
if (err != 0) {
84143
printk("Unexpected error when configuring UART: %d\n", err);

tests/benchmarks/multicore/idle_uarte/testcase.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ tests:
1212
- nrf54h20dk/nrf54h20/cpuapp
1313
extra_args:
1414
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
15+
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_normal.overlay"
16+
harness_config:
17+
fixture: gpio_loopback
18+
pytest_root:
19+
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_uarte"
20+
21+
benchmarks.multicore.idle_uarte.fast.nrf54h20dk_cpuapp_cpurad.s2ram:
22+
harness: pytest
23+
platform_allow:
24+
- nrf54h20dk/nrf54h20/cpuapp
25+
integration_platforms:
26+
- nrf54h20dk/nrf54h20/cpuapp
27+
extra_args:
28+
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
29+
- DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
1530
harness_config:
1631
fixture: gpio_loopback
1732
pytest_root:

0 commit comments

Comments
 (0)