Skip to content

Commit b82946f

Browse files
nordic-seglcarlescufi
authored andcommitted
tests: drivers: spi: spi_slave: Extend test scope
Add possibility to test all four SPI modes (CPOL, CPHA). Add possibility to test different bitrates. Add tests that checks handling of zero length buffers on master. Signed-off-by: Sebastian Głąb <[email protected]>
1 parent 1868987 commit b82946f

File tree

13 files changed

+180
-15
lines changed

13 files changed

+180
-15
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config TESTED_SPI_MODE
5+
int "SPI mode"
6+
default 0
7+
help
8+
SPI mode value (clock polarity and phase) used in the test.
9+
0: CPOL 0 (Active high), CPHA 0 (leading)
10+
1: CPOL 0 (Active high), CPHA 1 (trailing)
11+
2: CPOL 1 (Active low), CPHA 0 (leading)
12+
3: CPOL 1 (Active low), CPHA 1 (trailing)
13+
14+
source "Kconfig.zephyr"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
In this test suite two instances of the SPI peripheral are connected together.
2+
One SPI instance works as a master, second one is configured as a slave.
3+
In each test, both instances get identical configuration (CPOL, CPHA, bitrate, etc.).
4+
5+
Four GPIO loopbacks are required (see overlay for nrf54l15pdk for reference):
6+
1. spi22-SPIM_SCK connected with spi21-SPIS_SCK,
7+
2. spi22-SPIM_MISO connected with spi21-SPIS_MISO,
8+
3. spi22-SPIM_MOSI connected with spi21-SPIS_MOSI,
9+
4. spi22-cs-gpios connected with spi21-SPIS_CSN.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&dut_spi_dt {
8+
spi-max-frequency = <1000000>;
9+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&dut_spi_dt {
8+
spi-max-frequency = <250000>;
9+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&dut_spi_dt {
8+
spi-max-frequency = <2000000>;
9+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&dut_spi_dt {
8+
spi-max-frequency = <4000000>;
9+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&dut_spi_dt {
8+
spi-max-frequency = <500000>;
9+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&dut_spi_dt {
8+
spi-max-frequency = <8000000>;
9+
};

tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
dut_spi_dt: test-spi-dev@0 {
5454
compatible = "vnd,spi-device";
5555
reg = <0>;
56-
spi-max-frequency = <4000000>;
5756
};
5857
};
5958

tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ dut_spi: &spi130 {
6363
dut_spi_dt: test-spi-dev@0 {
6464
compatible = "vnd,spi-device";
6565
reg = <0>;
66-
spi-max-frequency = <500000>;
6766
};
6867
};
6968

0 commit comments

Comments
 (0)