Skip to content

Commit 6aa9ba1

Browse files
committed
tests: drivers: spi: spi_loopback: add from zephyr, support L20 and L09
Taken from zephyr to check support for L20 and L09. Signed-off-by: Piotr Kosycarz <[email protected]>
1 parent d812554 commit 6aa9ba1

File tree

8 files changed

+145
-0
lines changed

8 files changed

+145
-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+
set(KCONFIG_ROOT "\${ZEPHYR_BASE}/tests/drivers/spi/spi_loopback/Kconfig")
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(spi_loopback)
11+
12+
target_sources(app PRIVATE ${ZEPHYR_BASE}/tests/drivers/spi/spi_loopback/src/spi.c)
13+
target_sources_ifdef(CONFIG_SPI_RTIO app PRIVATE ${ZEPHYR_BASE}/tests/drivers/spi/spi_loopback/src/spi_rtio.c)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This sample extends the same-named Zephyr sample to verify it
2+
with Nordic development kits.
3+
4+
Source code and basic configuration files can be found in the corresponding folder structure in zephyr/tests/drivers/spi/spi_loopback.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
&pinctrl {
2+
spi21_default: spi21_default {
3+
group1 {
4+
psels = <NRF_PSEL(SPIM_SCK, 1, 6)>,
5+
<NRF_PSEL(SPIM_MISO, 1, 9)>,
6+
<NRF_PSEL(SPIM_MOSI, 1, 8)>;
7+
};
8+
};
9+
10+
spi21_sleep: spi21_sleep {
11+
group1 {
12+
psels = <NRF_PSEL(SPIM_SCK, 1, 6)>,
13+
<NRF_PSEL(SPIM_MISO, 1, 9)>,
14+
<NRF_PSEL(SPIM_MOSI, 1, 8)>;
15+
low-power-enable;
16+
};
17+
};
18+
};
19+
20+
&spi21 {
21+
status = "okay";
22+
pinctrl-0 = <&spi21_default>;
23+
pinctrl-1 = <&spi21_sleep>;
24+
pinctrl-names = "default", "sleep";
25+
overrun-character = <0x00>;
26+
zephyr,pm-device-runtime-auto;
27+
slow@0 {
28+
compatible = "test-spi-loopback-slow";
29+
reg = <0>;
30+
spi-max-frequency = <DT_FREQ_M(2)>;
31+
};
32+
fast@0 {
33+
compatible = "test-spi-loopback-fast";
34+
reg = <0>;
35+
spi-max-frequency = <DT_FREQ_M(4)>;
36+
};
37+
};
38+
39+
&gpio1 {
40+
status = "okay";
41+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
&pinctrl {
2+
spi00_default: spi00_default {
3+
group1 {
4+
psels = <NRF_PSEL(SPIM_SCK, 2, 6)>,
5+
<NRF_PSEL(SPIM_MISO, 2, 9)>,
6+
<NRF_PSEL(SPIM_MOSI, 2, 8)>;
7+
};
8+
};
9+
10+
spi00_sleep: spi00_sleep {
11+
group1 {
12+
psels = <NRF_PSEL(SPIM_SCK, 2, 6)>,
13+
<NRF_PSEL(SPIM_MISO, 2, 9)>,
14+
<NRF_PSEL(SPIM_MOSI, 2, 8)>;
15+
low-power-enable;
16+
};
17+
};
18+
};
19+
20+
&spi00 {
21+
status = "okay";
22+
pinctrl-0 = <&spi00_default>;
23+
pinctrl-1 = <&spi00_sleep>;
24+
pinctrl-names = "default", "sleep";
25+
overrun-character = <0x00>;
26+
zephyr,pm-device-runtime-auto;
27+
slow@0 {
28+
compatible = "test-spi-loopback-slow";
29+
reg = <0>;
30+
spi-max-frequency = <DT_FREQ_M(2)>;
31+
};
32+
fast@0 {
33+
compatible = "test-spi-loopback-fast";
34+
reg = <0>;
35+
spi-max-frequency = <DT_FREQ_M(4)>;
36+
};
37+
};
38+
39+
&gpio2 {
40+
status = "okay";
41+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
description: |
2+
This binding provides resources required to build and run the
3+
tests/drivers/spi/spi_loopback test in Zephyr.
4+
5+
compatible: "test-spi-loopback-fast"
6+
7+
include: [spi-device.yaml]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
description: |
2+
This binding provides resources required to build and run the
3+
tests/drivers/spi/spi_loopback test in Zephyr.
4+
5+
compatible: "test-spi-loopback-slow"
6+
7+
include: [spi-device.yaml]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CONFIG_TEST=y
2+
CONFIG_BOOT_BANNER=y
3+
CONFIG_SPI=y
4+
CONFIG_SPI_ASYNC=y
5+
CONFIG_SPI_LOG_LEVEL_INF=y
6+
CONFIG_ZTEST=y
7+
CONFIG_ZTEST_THREAD_PRIORITY=1
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
common:
2+
# depends_on: spi
3+
tags:
4+
- drivers
5+
- spi
6+
- dma
7+
- ci_tests_drivers_spi
8+
filter: dt_compat_enabled("test-spi-loopback-slow") and
9+
dt_compat_enabled("test-spi-loopback-fast")
10+
harness: ztest
11+
harness_config:
12+
fixture: spi_loopback
13+
platform_allow:
14+
- nrf54l20pdk/nrf54l20/cpuapp
15+
- nrf54l09pdk/nrf54l09/cpuapp
16+
integration_platforms:
17+
- nrf54l20pdk/nrf54l20/cpuapp
18+
- nrf54l09pdk/nrf54l09/cpuapp
19+
20+
tests:
21+
nrf.extended.drivers.spi.loopback: {}
22+
nrf.extended.drivers.spi.nrf_pm_runtime:
23+
extra_configs:
24+
- CONFIG_PM_DEVICE=y
25+
- CONFIG_PM_DEVICE_RUNTIME=y

0 commit comments

Comments
 (0)