Skip to content

Commit ed0d58b

Browse files
nordic-seglnordicjm
authored andcommitted
tests: benchmarks: multicore: Check PWM signal in S2RAM with PWM
Add idle_pwm_loopback that checks if PWM signal is present - count rising/falling edges using input GPIO. Signed-off-by: Sebastian Głąb <[email protected]>
1 parent 580dccd commit ed0d58b

18 files changed

+632
-0
lines changed
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(idle_pwm_loopback)
18+
19+
target_sources(app PRIVATE src/main.c)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config TEST_SLEEP_DURATION_MS
8+
int "Amount of time (in miliseconds) the core is sleeping"
9+
default 1000
10+
help
11+
Set sleep duration to TEST_SLEEP_DURATION_MS miliseconds.
12+
Based on the value of 'min-residency-us' specified for each power state defined in the DTS,
13+
core enters the lowest possible power state.
14+
15+
source "Kconfig.zephyr"
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+
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
8+
9+
config REMOTE_BOARD
10+
string "The board used for remote target"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/dt-bindings/pwm/pwm.h>
8+
#include <zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>
9+
10+
/* Test requires wire connection between:
11+
* - PWM130 OUT[0] at P0.00
12+
* - GPIO input at P0.01
13+
*/
14+
15+
/ {
16+
pwm_to_gpio_loopback: pwm_to_gpio_loopback {
17+
compatible = "test-pwm-to-gpio-loopback";
18+
pwms = <&pwm130 0 PWM_USEC(200) PWM_POLARITY_NORMAL>;
19+
gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
20+
};
21+
};
22+
23+
&pinctrl {
24+
/omit-if-no-ref/ pwm130_default: pwm130_default {
25+
group1 {
26+
psels = <NRF_PSEL(PWM_OUT0, 0, 0)>;
27+
};
28+
};
29+
/omit-if-no-ref/ pwm130_sleep: pwm130_sleep {
30+
group1 {
31+
psels = <NRF_PSEL(PWM_OUT0, 0, 0)>;
32+
low-power-enable;
33+
};
34+
};
35+
};
36+
37+
&gpio0 {
38+
status = "okay";
39+
};
40+
41+
&gpiote130 {
42+
status = "okay";
43+
owned-channels = <0>;
44+
};
45+
46+
&pwm130 {
47+
status = "okay";
48+
pinctrl-0 = <&pwm130_default>;
49+
pinctrl-1 = <&pwm130_sleep>;
50+
pinctrl-names = "default", "sleep";
51+
memory-regions = <&cpuapp_dma_region>;
52+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#include <zephyr/dt-bindings/pwm/pwm.h>
8+
#include <zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>
9+
10+
/* Test requires wire connection between:
11+
* - PWM120 OUT[1] at P7.01
12+
* - GPIO input at P1.05
13+
*/
14+
15+
/ {
16+
pwm_to_gpio_loopback: pwm_to_gpio_loopback {
17+
compatible = "test-pwm-to-gpio-loopback";
18+
pwms = <&pwm120 1 PWM_USEC(200) PWM_POLARITY_NORMAL>;
19+
gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
20+
};
21+
};
22+
23+
&pinctrl {
24+
/omit-if-no-ref/ pwm120_default: pwm120_default {
25+
group1 {
26+
psels = <NRF_PSEL(PWM_OUT1, 7, 1)>;
27+
};
28+
};
29+
/omit-if-no-ref/ pwm120_sleep: pwm120_sleep {
30+
group1 {
31+
psels = <NRF_PSEL(PWM_OUT1, 7, 1)>;
32+
low-power-enable;
33+
};
34+
};
35+
};
36+
37+
&gpio1 {
38+
status = "okay";
39+
};
40+
41+
&gpiote130 {
42+
status = "okay";
43+
owned-channels = <0>;
44+
};
45+
46+
&pwm120 {
47+
status = "okay";
48+
pinctrl-0 = <&pwm120_default>;
49+
pinctrl-1 = <&pwm120_sleep>;
50+
pinctrl-names = "default", "sleep";
51+
memory-regions = <&dma_fast_region>;
52+
};
53+
54+
&dma_fast_region {
55+
status = "okay";
56+
};
57+
58+
&pwm130 {
59+
status = "disabled";
60+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
description: |
8+
This binding provides resources required to build and run the
9+
tests/drivers/pwm/pwm_to_gpio_loopback test in Zephyr.
10+
11+
compatible: "test-pwm-to-gpio-loopback"
12+
13+
properties:
14+
pwms:
15+
type: phandle-array
16+
required: true
17+
description: |
18+
PWM pin that will be used for generating a pulse-width modulated signal.
19+
gpios:
20+
type: phandle-array
21+
required: true
22+
description: |
23+
GPIO pin will be used for capturing the generated signal. The PWM and GPIO
24+
pins must be physically connected to each other.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CONFIG_PRINTK=y
2+
3+
CONFIG_LOG=y
4+
CONFIG_ASSERT=y
5+
CONFIG_PWM=y
6+
CONFIG_GPIO=y
7+
8+
CONFIG_NRF_REGTOOL_VERBOSITY=1
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CONFIG_PM=y
2+
CONFIG_PM_S2RAM=y
3+
CONFIG_PM_S2RAM_CUSTOM_MARKING=y
4+
CONFIG_POWEROFF=y
5+
CONFIG_SOC_NRF54H20_NO_MRAM_LATENCY=n
6+
7+
CONFIG_PM_DEVICE=y
8+
CONFIG_PM_DEVICE_RUNTIME=y
9+
10+
CONFIG_BOOT_BANNER=n
11+
CONFIG_NCS_BOOT_BANNER=n
12+
CONFIG_PRINTK=n
13+
CONFIG_LOG=n
14+
CONFIG_CONSOLE=n
15+
CONFIG_UART_CONSOLE=n
16+
CONFIG_SERIAL=n
17+
18+
CONFIG_ASSERT=y
19+
CONFIG_PWM=y
20+
CONFIG_GPIO=y
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)
11+
12+
target_sources(app PRIVATE ../src/main.c)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config TEST_SLEEP_DURATION_MS
8+
int "Amount of time (in miliseconds) the core is sleeping"
9+
default 1000
10+
help
11+
Set sleep duration to TEST_SLEEP_DURATION_MS miliseconds.
12+
Based on the value of 'min-residency-us' specified for each power state defined in the DTS,
13+
core enters the lowest possible power state.
14+
15+
source "Kconfig.zephyr"

0 commit comments

Comments
 (0)