-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrf fromtree] tests: drivers: spi: Add negative test cases
Extend test coverage by adding tests that check invalid use of the SPI API. Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no> (cherry picked from commit 5e4bbd5)
- Loading branch information
1 parent
253ee08
commit 6c515dd
Showing
6 changed files
with
442 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(spi_error_cases) | ||
|
||
FILE(GLOB app_sources src/*.c) | ||
|
||
target_sources(app PRIVATE ${app_sources}) |
72 changes: 72 additions & 0 deletions
72
tests/drivers/spi/spi_error_cases/boards/nrf52840dk_nrf52840.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&pinctrl { | ||
spi3_default_alt: spi3_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 1, 1)>, | ||
<NRF_PSEL(SPIM_MISO, 1, 3)>, | ||
<NRF_PSEL(SPIM_MOSI, 1, 5)>; | ||
}; | ||
}; | ||
|
||
spi3_sleep_alt: spi3_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 1, 1)>, | ||
<NRF_PSEL(SPIM_MISO, 1, 3)>, | ||
<NRF_PSEL(SPIM_MOSI, 1, 5)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
spi1_default_alt: spi1_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIS_SCK, 1, 2)>, | ||
<NRF_PSEL(SPIS_MISO, 1, 4)>, | ||
<NRF_PSEL(SPIS_MOSI, 1, 6)>, | ||
<NRF_PSEL(SPIS_CSN, 1, 8)>; | ||
}; | ||
}; | ||
|
||
spi1_sleep_alt: spi1_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIS_SCK, 1, 2)>, | ||
<NRF_PSEL(SPIS_MISO, 1, 4)>, | ||
<NRF_PSEL(SPIS_MOSI, 1, 6)>, | ||
<NRF_PSEL(SPIS_CSN, 1, 8)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
}; | ||
|
||
dut_spi: &spi3 { | ||
status = "okay"; | ||
pinctrl-0 = <&spi3_default_alt>; | ||
pinctrl-1 = <&spi3_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
overrun-character = <0x00>; | ||
cs-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; | ||
dut_spi_dt: test-spi-dev@0 { | ||
compatible = "vnd,spi-device"; | ||
reg = <0>; | ||
spi-max-frequency = <200000>; | ||
}; | ||
}; | ||
|
||
dut_spis: &spi1 { | ||
compatible = "nordic,nrf-spis"; | ||
status = "okay"; | ||
def-char = <0x00>; | ||
pinctrl-0 = <&spi1_default_alt>; | ||
pinctrl-1 = <&spi1_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
dut_spis_dt: test-spis-dev@0 { | ||
compatible = "vnd,spi-device"; | ||
reg = <0>; | ||
spi-max-frequency = <200000>; | ||
}; | ||
}; |
78 changes: 78 additions & 0 deletions
78
tests/drivers/spi/spi_error_cases/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&pinctrl { | ||
spi22_default_alt: spi22_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 1, 13)>, | ||
<NRF_PSEL(SPIM_MISO, 1, 11)>, | ||
<NRF_PSEL(SPIM_MOSI, 1, 9)>; | ||
}; | ||
}; | ||
|
||
spi22_sleep_alt: spi22_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 1, 13)>, | ||
<NRF_PSEL(SPIM_MISO, 1, 11)>, | ||
<NRF_PSEL(SPIM_MOSI, 1, 9)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
spi21_default_alt: spi21_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIS_SCK, 1, 12)>, | ||
<NRF_PSEL(SPIS_MISO, 1, 10)>, | ||
<NRF_PSEL(SPIS_MOSI, 1, 8)>, | ||
<NRF_PSEL(SPIS_CSN, 1, 14)>; | ||
}; | ||
}; | ||
|
||
spi21_sleep_alt: spi21_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(SPIS_SCK, 1, 12)>, | ||
<NRF_PSEL(SPIS_MISO, 1, 10)>, | ||
<NRF_PSEL(SPIS_MOSI, 1, 8)>, | ||
<NRF_PSEL(SPIS_CSN, 1, 14)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
}; | ||
|
||
&gpio2 { | ||
status = "okay"; | ||
}; | ||
|
||
dut_spi: &spi22 { | ||
status = "okay"; | ||
pinctrl-0 = <&spi22_default_alt>; | ||
pinctrl-1 = <&spi22_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
overrun-character = <0x00>; | ||
cs-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>; | ||
dut_spi_dt: test-spi-dev@0 { | ||
compatible = "vnd,spi-device"; | ||
reg = <0>; | ||
spi-max-frequency = <200000>; | ||
}; | ||
}; | ||
|
||
dut_spis: &spi21 { | ||
compatible = "nordic,nrf-spis"; | ||
status = "okay"; | ||
def-char = <0x00>; | ||
pinctrl-0 = <&spi21_default_alt>; | ||
pinctrl-1 = <&spi21_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
dut_spis_dt: test-spis-dev@0 { | ||
compatible = "vnd,spi-device"; | ||
reg = <0>; | ||
spi-max-frequency = <200000>; | ||
}; | ||
/delete-property/rx-delay-supported; | ||
/delete-property/rx-delay; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CONFIG_SPI=y | ||
CONFIG_SPI_SLAVE=y | ||
CONFIG_GPIO=y | ||
CONFIG_POLL=y | ||
CONFIG_SPI_ASYNC=y | ||
CONFIG_SPI_EXTENDED_MODES=y | ||
CONFIG_ZTEST=y |
Oops, something went wrong.