Skip to content

Commit 9ca1f6a

Browse files
nordic-seglmasz-nordic
authored andcommitted
tests: drivers: gpio: Add test for NFCT pins as GPIO
Add test that verifies correct operation of NFCT pins as GPIO. Signed-off-by: Sebastian Głąb <[email protected]>
1 parent 6e2d7d9 commit 9ca1f6a

10 files changed

+187
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2025 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(gpio_nfct)
11+
12+
FILE(GLOB app_sources ${ZEPHYR_NRF_MODULE_DIR}/tests/drivers/gpio/gpio_more_loops/src/main.c)
13+
target_sources(app PRIVATE ${app_sources})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
3+
4+
config TEST_DURATION
5+
int "Test duration in ms"
6+
default 4000
7+
help
8+
Test will run for (at least) defined time.
9+
This value affects how many times GPIOs will be toggled.
10+
11+
source "Kconfig.zephyr"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_NRF_REGTOOL_VERBOSITY=1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
/* Test requirements:
9+
* NFC antenna connected to the DK.
10+
*/
11+
test_gpios {
12+
compatible = "gpio-leds";
13+
out_gpios: out_gpios {
14+
gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
15+
};
16+
17+
in_gpios: in_gpios {
18+
gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
19+
};
20+
};
21+
};
22+
23+
&nfct {
24+
status = "okay"; /* not needed - APP is the default owner of NFCT */
25+
};
26+
27+
&gpiote130 {
28+
status = "okay";
29+
owned-channels = <7>;
30+
};
31+
32+
&gpio2 {
33+
status = "okay";
34+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_NRF_REGTOOL_VERBOSITY=1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
/* Test requirements:
9+
* NFC antenna connected to the DK.
10+
*/
11+
test_gpios {
12+
compatible = "gpio-leds";
13+
out_gpios: out_gpios {
14+
gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
15+
};
16+
17+
in_gpios: in_gpios {
18+
gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
19+
};
20+
};
21+
};
22+
23+
&nfct {
24+
status = "okay"; /* APP is the default owner of NFCT */
25+
};
26+
27+
&gpiote130 {
28+
status = "okay";
29+
owned-channels = <7>;
30+
};
31+
32+
&gpio2 {
33+
status = "okay";
34+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
/* Test requirements:
9+
* NFC antenna connected to the DK.
10+
*/
11+
test_gpios {
12+
compatible = "gpio-leds";
13+
out_gpios: out_gpios {
14+
gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
15+
};
16+
17+
in_gpios: in_gpios {
18+
gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
19+
};
20+
};
21+
};
22+
23+
&uicr {
24+
nfct-pins-as-gpios;
25+
};
26+
27+
&gpiote20 {
28+
status = "okay";
29+
};
30+
31+
&gpio1 {
32+
status = "okay";
33+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
/* Test requirements:
9+
* P1.00 shorted with P1.01;
10+
* P1.02 shorted with P1.03.
11+
* (NFC pins are P1.01 and P1.02)
12+
*/
13+
test_gpios {
14+
compatible = "gpio-leds";
15+
out_gpios: out_gpios {
16+
gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>, <&gpio1 2 GPIO_ACTIVE_HIGH>;
17+
};
18+
19+
in_gpios: in_gpios {
20+
gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>, <&gpio1 3 GPIO_ACTIVE_HIGH>;
21+
};
22+
};
23+
};
24+
25+
&uicr {
26+
nfct-pins-as-gpios;
27+
};
28+
29+
&gpiote20 {
30+
status = "okay";
31+
};
32+
33+
&gpio1 {
34+
status = "okay";
35+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_GPIO=y
2+
CONFIG_ZTEST=y
3+
CONFIG_LOG=y
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
common:
2+
tags:
3+
- drivers
4+
- gpio
5+
- ci_tests_drivers_gpio
6+
depends_on: gpio
7+
filter: not CONFIG_COVERAGE
8+
harness: ztest
9+
harness_config:
10+
fixture: gpio_loopback
11+
12+
tests:
13+
drivers.gpio.gpio_nfct:
14+
platform_allow:
15+
- nrf54l15dk/nrf54l15/cpuapp
16+
- nrf54l20pdk/nrf54l20/cpuapp
17+
- nrf54h20dk/nrf54h20/cpuapp
18+
- nrf54h20dk/nrf54h20/cpurad
19+
integration_platforms:
20+
- nrf54l15dk/nrf54l15/cpuapp
21+
- nrf54l20pdk/nrf54l20/cpuapp
22+
- nrf54h20dk/nrf54h20/cpuapp

0 commit comments

Comments
 (0)