Skip to content

Commit

Permalink
tests: drivers: gpio: Add test for NFCT pins as GPIO
Browse files Browse the repository at this point in the history
Add test that verifies correct operation of NFCT pins as GPIO.

Signed-off-by: Sebastian Głąb <[email protected]>
  • Loading branch information
nordic-segl authored and masz-nordic committed Feb 11, 2025
1 parent 6e2d7d9 commit 9ca1f6a
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/drivers/gpio/gpio_nfct/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(gpio_nfct)

FILE(GLOB app_sources ${ZEPHYR_NRF_MODULE_DIR}/tests/drivers/gpio/gpio_more_loops/src/main.c)
target_sources(app PRIVATE ${app_sources})
11 changes: 11 additions & 0 deletions tests/drivers/gpio/gpio_nfct/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2025 Nordic Semiconductor ASA
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

config TEST_DURATION
int "Test duration in ms"
default 4000
help
Test will run for (at least) defined time.
This value affects how many times GPIOs will be toggled.

source "Kconfig.zephyr"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_NRF_REGTOOL_VERBOSITY=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
/* Test requirements:
* NFC antenna connected to the DK.
*/
test_gpios {
compatible = "gpio-leds";
out_gpios: out_gpios {
gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
};

in_gpios: in_gpios {
gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
};
};
};

&nfct {
status = "okay"; /* not needed - APP is the default owner of NFCT */
};

&gpiote130 {
status = "okay";
owned-channels = <7>;
};

&gpio2 {
status = "okay";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_NRF_REGTOOL_VERBOSITY=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
/* Test requirements:
* NFC antenna connected to the DK.
*/
test_gpios {
compatible = "gpio-leds";
out_gpios: out_gpios {
gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
};

in_gpios: in_gpios {
gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
};
};
};

&nfct {
status = "okay"; /* APP is the default owner of NFCT */
};

&gpiote130 {
status = "okay";
owned-channels = <7>;
};

&gpio2 {
status = "okay";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
/* Test requirements:
* NFC antenna connected to the DK.
*/
test_gpios {
compatible = "gpio-leds";
out_gpios: out_gpios {
gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
};

in_gpios: in_gpios {
gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
};
};
};

&uicr {
nfct-pins-as-gpios;
};

&gpiote20 {
status = "okay";
};

&gpio1 {
status = "okay";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
/* Test requirements:
* P1.00 shorted with P1.01;
* P1.02 shorted with P1.03.
* (NFC pins are P1.01 and P1.02)
*/
test_gpios {
compatible = "gpio-leds";
out_gpios: out_gpios {
gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>, <&gpio1 2 GPIO_ACTIVE_HIGH>;
};

in_gpios: in_gpios {
gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>, <&gpio1 3 GPIO_ACTIVE_HIGH>;
};
};
};

&uicr {
nfct-pins-as-gpios;
};

&gpiote20 {
status = "okay";
};

&gpio1 {
status = "okay";
};
3 changes: 3 additions & 0 deletions tests/drivers/gpio/gpio_nfct/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_GPIO=y
CONFIG_ZTEST=y
CONFIG_LOG=y
22 changes: 22 additions & 0 deletions tests/drivers/gpio/gpio_nfct/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
common:
tags:
- drivers
- gpio
- ci_tests_drivers_gpio
depends_on: gpio
filter: not CONFIG_COVERAGE
harness: ztest
harness_config:
fixture: gpio_loopback

tests:
drivers.gpio.gpio_nfct:
platform_allow:
- nrf54l15dk/nrf54l15/cpuapp
- nrf54l20pdk/nrf54l20/cpuapp
- nrf54h20dk/nrf54h20/cpuapp
- nrf54h20dk/nrf54h20/cpurad
integration_platforms:
- nrf54l15dk/nrf54l15/cpuapp
- nrf54l20pdk/nrf54l20/cpuapp
- nrf54h20dk/nrf54h20/cpuapp

0 comments on commit 9ca1f6a

Please sign in to comment.