Skip to content

Commit 6507f63

Browse files
nordic-pikrrlubos
authored andcommitted
tests: benchmarks: power_consumption: add qdec_idle
Add add qdec power consumption test Signed-off-by: Piotr Krzyzanowski <[email protected]>
1 parent 7fa28ae commit 6507f63

File tree

14 files changed

+438
-0
lines changed

14 files changed

+438
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(remote_sleep_forever)
11+
12+
target_sources(app PRIVATE src/main.c)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&uart135 {
8+
status = "disabled";
9+
/delete-property/memory-regions;
10+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CONFIG_NRFS=y
2+
3+
CONFIG_PM=y
4+
CONFIG_POWEROFF=y
5+
CONFIG_CONSOLE=n
6+
CONFIG_UART_CONSOLE=n
7+
CONFIG_SERIAL=n
8+
CONFIG_GPIO=n
9+
CONFIG_BOOT_BANNER=n
10+
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/kernel.h>
8+
9+
#ifdef CONFIG_BOARD_NRF54H20DK
10+
#include <nrfs_backend_ipc_service.h>
11+
#include <nrfs_gdpwr.h>
12+
13+
static void gdpwr_handler(nrfs_gdpwr_evt_t const *p_evt, void *context)
14+
{
15+
}
16+
17+
static void clear_global_power_domains_requests(void)
18+
{
19+
int service_status;
20+
int tst_ctx = 1;
21+
22+
service_status = nrfs_gdpwr_init(gdpwr_handler);
23+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_SLOW,
24+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
25+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_ACTIVE_FAST,
26+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx++);
27+
service_status = nrfs_gdpwr_power_request(GDPWR_POWER_DOMAIN_MAIN_SLOW,
28+
GDPWR_POWER_REQUEST_CLEAR, (void *)tst_ctx);
29+
}
30+
#endif
31+
32+
int main(void)
33+
{
34+
#ifdef CONFIG_BOARD_NRF54H20DK
35+
nrfs_backend_wait_for_connection(K_FOREVER);
36+
clear_global_power_domains_requests();
37+
#endif
38+
39+
k_sleep(K_FOREVER);
40+
41+
return 0;
42+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
11+
if(NOT SYSBUILD)
12+
message(FATAL_ERROR
13+
" This is a multi-image application that should be built using sysbuild.\n"
14+
" Add --sysbuild argument to west build command to prepare all the images.")
15+
endif()
16+
17+
project(qdec)
18+
19+
target_sources(app PRIVATE src/main.c)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2023 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
8+
9+
config REMOTE_BOARD
10+
string "The board used for remote target"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CONFIG_NRFS=y
2+
3+
# Enable runtime power management for peripheral
4+
CONFIG_PM_DEVICE=y
5+
CONFIG_PM_DEVICE_RUNTIME=y
6+
7+
CONFIG_PM=y
8+
CONFIG_PM_S2RAM=y
9+
CONFIG_POWEROFF=y
10+
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
11+
CONFIG_NRFS_MRAM_SERVICE_ENABLED=n
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2024 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
*/
5+
6+
/ {
7+
aliases {
8+
qdec0 = &qdec130;
9+
qenca = &phase_a;
10+
qencb = &phase_b;
11+
};
12+
13+
encoder-emulate {
14+
compatible = "gpio-leds";
15+
phase_a: phase_a {
16+
gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>;
17+
};
18+
phase_b: phase_b {
19+
gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
20+
};
21+
};
22+
};
23+
24+
&pinctrl {
25+
qdec_pinctrl: qdec_pinctrl {
26+
group1 {
27+
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
28+
<NRF_PSEL(QDEC_B, 2, 10)>;
29+
};
30+
};
31+
32+
qdec_sleep_pinctrl: qdec_sleep_pinctrl {
33+
group1 {
34+
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
35+
<NRF_PSEL(QDEC_B, 2, 10)>;
36+
low-power-enable;
37+
};
38+
};
39+
};
40+
41+
&gpio2 {
42+
status = "okay";
43+
};
44+
45+
&qdec130 {
46+
status = "okay";
47+
pinctrl-0 = <&qdec_pinctrl>;
48+
pinctrl-1 = <&qdec_sleep_pinctrl>;
49+
pinctrl-names = "default", "sleep";
50+
steps = <127>;
51+
led-pre = <500>;
52+
zephyr,pm-device-runtime-auto;
53+
};
54+
55+
/* To prevent enabling console receiver. */
56+
&uart136 {
57+
disable-rx;
58+
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2024 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
4+
*/
5+
6+
/ {
7+
aliases {
8+
qdec0 = &qdec20;
9+
qenca = &phase_a;
10+
qencb = &phase_b;
11+
};
12+
13+
encoder-emulate {
14+
compatible = "gpio-leds";
15+
phase_a: phase_a {
16+
gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
17+
};
18+
phase_b: phase_b {
19+
gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
20+
};
21+
};
22+
};
23+
24+
&pinctrl {
25+
qdec_pinctrl: qdec_pinctrl {
26+
group1 {
27+
psels = <NRF_PSEL(QDEC_A, 1, 8)>,
28+
<NRF_PSEL(QDEC_B, 1, 10)>;
29+
};
30+
};
31+
};
32+
33+
&gpio1 {
34+
status = "okay";
35+
};
36+
37+
&qdec20 {
38+
status = "okay";
39+
pinctrl-0 = <&qdec_pinctrl>;
40+
pinctrl-names = "default";
41+
steps = <127>;
42+
led-pre = <500>;
43+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CONFIG_SENSOR=y
2+
3+
CONFIG_CONSOLE=n
4+
CONFIG_UART_CONSOLE=n
5+
CONFIG_SERIAL=n
6+
CONFIG_BOOT_BANNER=n
7+
8+
CONFIG_ASSERT=y

0 commit comments

Comments
 (0)