Skip to content

Commit

Permalink
tests: drivers: spi: nordic: add fast SPI to overlays
Browse files Browse the repository at this point in the history
SPIM12x have more capabilities than SPIM13x,
so it should be tested separately.

Signed-off-by: Nikodem Kastelik <[email protected]>
  • Loading branch information
nika-nordic committed Jun 5, 2024
1 parent 8561ea2 commit efb59b2
Show file tree
Hide file tree
Showing 12 changed files with 346 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
owned-channels = <7>;
};

dut_spi: &spi130 {
&spi130 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi130_default_alt>;
Expand All @@ -63,6 +63,7 @@ dut_spi: &spi130 {
dut_spi_dt: test-spi-dev@0 {
compatible = "vnd,spi-device";
reg = <0>;
spi-max-frequency = <DT_FREQ_M(8)>;
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
#include "nrf54h20dk_nrf54h20_common.dtsi"

&dut_spi {
&spi130 {
memory-regions = <&cpuapp_dma_region>;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
*
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
spi121_default_alt: spi121_default_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
<NRF_PSEL(SPIM_MISO, 7, 0)>,
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
};
};

spi121_sleep_alt: spi121_sleep_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
<NRF_PSEL(SPIM_MISO, 7, 0)>,
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
low-power-enable;
};
};

spis131_default_alt: spis131_default_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
<NRF_PSEL(SPIS_MISO, 1, 9)>,
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
<NRF_PSEL(SPIS_CSN, 0, 11)>;
};
};

spis131_sleep_alt: spis131_sleep_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
<NRF_PSEL(SPIS_MISO, 1, 9)>,
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
<NRF_PSEL(SPIS_CSN, 0, 11)>;
low-power-enable;
};
};
};

&gpio0 {
status = "okay";
};

&spi121 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi121_default_alt>;
pinctrl-1 = <&spi121_sleep_alt>;
pinctrl-names = "default", "sleep";
overrun-character = <0x00>;
memory-regions = <&dma_fast_region>;
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
dut_spi_dt: test-spi-dev@0 {
compatible = "vnd,spi-device";
reg = <0>;
spi-max-frequency = <DT_FREQ_M(8)>;
};
};

dut_spis: &spi131 {
compatible = "nordic,nrf-spis";
status = "okay";
def-char = <0x00>;
pinctrl-0 = <&spis131_default_alt>;
pinctrl-1 = <&spis131_sleep_alt>;
pinctrl-names = "default", "sleep";
memory-regions = <&cpuapp_dma_region>;
/delete-property/rx-delay-supported;
/delete-property/rx-delay;
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
#include "nrf54h20dk_nrf54h20_common.dtsi"

&dut_spi {
&spi130 {
memory-regions = <&cpurad_dma_region>;
};

Expand Down
21 changes: 19 additions & 2 deletions tests/drivers/spi/spi_controller_peripheral/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,53 @@ common:
platform_allow: |
nrf52840dk/nrf52840 nrf54l15pdk/nrf54l15/cpuapp nrf54h20dk/nrf54h20/cpuapp
nrf54h20dk/nrf54h20/cpurad
integration_platforms:
- nrf52840dk/nrf52840
tests:
drivers.spi.spi_mode0:
extra_configs:
- CONFIG_TESTED_SPI_MODE=0
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/250khz.overlay"
integration_platforms:
- nrf52840dk/nrf52840

drivers.spi.spi_mode1:
extra_configs:
- CONFIG_TESTED_SPI_MODE=1
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/500khz.overlay"
integration_platforms:
- nrf52840dk/nrf52840

drivers.spi.spi_mode2:
extra_configs:
- CONFIG_TESTED_SPI_MODE=2
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/1mhz.overlay"
integration_platforms:
- nrf52840dk/nrf52840

drivers.spi.spi_mode3:
extra_configs:
- CONFIG_TESTED_SPI_MODE=3
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/2mhz.overlay"
integration_platforms:
- nrf52840dk/nrf52840

drivers.spi.spi_4MHz:
extra_configs:
- CONFIG_TESTED_SPI_MODE=2
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/4mhz.overlay"
integration_platforms:
- nrf52840dk/nrf52840

drivers.spi.spi_8MHz:
extra_configs:
- CONFIG_TESTED_SPI_MODE=1
extra_args: EXTRA_DTC_OVERLAY_FILE="boards/8mhz.overlay"
integration_platforms:
- nrf52840dk/nrf52840

drivers.spi.spi_fast:
extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay"
platform_exclude:
- nrf52840dk/nrf52840
- nrf54l15pdk/nrf54l15/cpuapp
- nrf54h20dk/nrf54h20/cpurad
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
*
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
spi121_default_alt: spi121_default_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
<NRF_PSEL(SPIM_MISO, 7, 0)>,
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
};
};

spi121_sleep_alt: spi121_sleep_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 7, 2)>,
<NRF_PSEL(SPIM_MISO, 7, 0)>,
<NRF_PSEL(SPIM_MOSI, 7, 1)>;
low-power-enable;
};
};

spis131_default_alt: spis131_default_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
<NRF_PSEL(SPIS_MISO, 1, 9)>,
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
<NRF_PSEL(SPIS_CSN, 0, 11)>;
};
};

spis131_sleep_alt: spis131_sleep_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 1, 0)>,
<NRF_PSEL(SPIS_MISO, 1, 9)>,
<NRF_PSEL(SPIS_MOSI, 1, 5)>,
<NRF_PSEL(SPIS_CSN, 0, 11)>;
low-power-enable;
};
};
};

&gpio0 {
status = "okay";
};

&spi121 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi121_default_alt>;
pinctrl-1 = <&spi121_sleep_alt>;
pinctrl-names = "default", "sleep";
overrun-character = <0x00>;
memory-regions = <&dma_fast_region>;
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
dut_spi_dt: test-spi-dev@0 {
compatible = "vnd,spi-device";
reg = <0>;
spi-max-frequency = <DT_FREQ_M(8)>;
};
};

dut_spis: &spi131 {
compatible = "nordic,nrf-spis";
status = "okay";
def-char = <0x00>;
pinctrl-0 = <&spis131_default_alt>;
pinctrl-1 = <&spis131_sleep_alt>;
pinctrl-names = "default", "sleep";
memory-regions = <&cpuapp_dma_region>;
/delete-property/rx-delay-supported;
/delete-property/rx-delay;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
*
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
spi130_default_alt: spi130_default_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
<NRF_PSEL(SPIM_MISO, 0, 6)>,
<NRF_PSEL(SPIM_MOSI, 0, 8)>;
};
};

spi130_sleep_alt: spi130_sleep_alt {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
<NRF_PSEL(SPIM_MISO, 0, 6)>,
<NRF_PSEL(SPIM_MOSI, 0, 8)>;
low-power-enable;
};
};

spis131_default_alt: spis131_default_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 0, 1)>,
<NRF_PSEL(SPIS_MISO, 0, 7)>,
<NRF_PSEL(SPIS_MOSI, 0, 9)>,
<NRF_PSEL(SPIS_CSN, 0, 11)>;
};
};

spis131_sleep_alt: spis131_sleep_alt {
group1 {
psels = <NRF_PSEL(SPIS_SCK, 0, 1)>,
<NRF_PSEL(SPIS_MISO, 0, 7)>,
<NRF_PSEL(SPIS_MOSI, 0, 9)>,
<NRF_PSEL(SPIS_CSN, 0, 11)>;
low-power-enable;
};
};

};

&gpio0 {
status = "okay";
};

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

&cpuapp_dma_region {
status = "okay";
};

&spi130 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi130_default_alt>;
pinctrl-1 = <&spi130_sleep_alt>;
pinctrl-names = "default", "sleep";
overrun-character = <0x00>;
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
dut_spi_dt: test-spi-dev@0 {
compatible = "vnd,spi-device";
reg = <0>;
spi-max-frequency = <500000>;
};
memory-regions = <&cpuapp_dma_region>;
};

dut_spis: &spi131 {
compatible = "nordic,nrf-spis";
status = "okay";
def-char = <0x00>;
pinctrl-0 = <&spis131_default_alt>;
pinctrl-1 = <&spis131_sleep_alt>;
pinctrl-names = "default", "sleep";
memory-regions = <&cpuapp_dma_region>;
/delete-property/rx-delay-supported;
/delete-property/rx-delay;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

&spi130 {
status = "reserved";
interrupt-parent = <&cpuppr_clic>;
};

&spi131 {
status = "reserved";
interrupt-parent = <&cpuppr_clic>;
};

&shared_ram3x_region {
status = "okay";
};

&gpio0 {
status = "reserved";
};
12 changes: 0 additions & 12 deletions tests/drivers/spi/spi_error_cases/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,6 @@ ZTEST(spi_error_cases, test_unsupported_frequency)
zassert_equal(rv, -EINVAL, "Got %d instead", rv);
}

ZTEST(spi_error_cases, test_CS_unsupported_on_slave)
{
int slave_rv;
struct spi_config spis_config_invalid = spis_config;
struct gpio_dt_spec test_gpio = { DEVICE_DT_GET(DT_NODELABEL(gpio0)), 10, GPIO_ACTIVE_LOW };

spis_config_invalid.cs.gpio = test_gpio;

slave_rv = spi_transceive(spis_dev, &spis_config_invalid, tdata.stx_set, tdata.srx_set);
zassert_equal(slave_rv, -EINVAL, "Got %d instead", slave_rv);
}

ZTEST(spi_error_cases, test_spis_scattered_tx_buf_not_supported)
{
int slave_rv;
Expand Down
Loading

0 comments on commit efb59b2

Please sign in to comment.