Skip to content

Commit 8819643

Browse files
ktaborowskiRobertGalatNordic
authored andcommitted
samples: add nrf spi snippet
Add snippet for nrfx spi driver Signed-off-by: Krzysztof Taborowski <[email protected]>
1 parent 36396d7 commit 8819643

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

Kconfig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,13 @@ config SIDEWALK_CRYPTO_PSA_KEY_STORAGE
188188
it must be enabled in every subsequent build.
189189
Otherwise, the keys will not be found and Sidewalk will not start.
190190

191-
if SIDEWALK_SPI_BUS
191+
config SIDEWALK_SPI_BUS_NRFX
192+
bool "Use nrfx spi bus"
193+
depends on SOC_NRF52840
194+
help
195+
Use nrfx spi bus for Sidewalk spi bus.
196+
197+
if SIDEWALK_SPI_BUS_NRFX
192198

193199
choice SIDEWALK_NRFX_SPI_INSTANCE_ID
194200
prompt "Instance of the NRX SPI driver"
@@ -219,7 +225,7 @@ config SIDEWALK_NRFX_SPI_ID
219225
default 1 if SIDEWALK_NRFX_SPI1
220226
default 2
221227

222-
endif # SIDEWALK_SPI_BUS
228+
endif # SIDEWALK_SPI_BUS_NRFX
223229

224230
config SIDEWALK_USE_PREBUILTS
225231
bool "Use prebuilt Sidewalk libraries"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&spi2 {
8+
status = "disabled";
9+
};
10+
11+
/{
12+
nrfx_spi_gpios{
13+
compatible = "gpio-keys";
14+
nrfx_spi_sck: sck {
15+
gpios = <&gpio1 0xF GPIO_ACTIVE_HIGH>;
16+
label = "spi_sck";
17+
};
18+
nrfx_spi_miso: miso {
19+
gpios = <&gpio1 0xE GPIO_ACTIVE_HIGH>;
20+
label = "spi_miso";
21+
};
22+
nrfx_spi_mosi: mosi {
23+
gpios = <&gpio1 0xD GPIO_ACTIVE_HIGH>;
24+
label = "spi_mosi";
25+
};
26+
nrfx_spi_cs: cs {
27+
gpios = <&gpio1 0x8 GPIO_ACTIVE_LOW>;
28+
label = "spi_cs";
29+
};
30+
};
31+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: spi_nrfx
2+
append:
3+
EXTRA_CONF_FILE: spi_nrfx.conf
4+
5+
boards:
6+
nrf52840dk/nrf52840:
7+
append:
8+
EXTRA_DTC_OVERLAY_FILE: boards/nrf52840dk_nrf52840.overlay
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2024 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_SIDEWALK_SPI_BUS_NRFX=y

subsys/sal/sid_pal/src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ zephyr_library_sources_ifdef(CONFIG_SIDEWALK_SW_INTERRUPTS sid_sw_interrupts.c)
6363

6464
zephyr_library_sources_ifdef(CONFIG_SIDEWALK_DELAY sid_delay.c)
6565

66-
if(CONFIG_SOC_NRF52840)
66+
if(CONFIG_SIDEWALK_SPI_BUS_NRFX)
6767
zephyr_library_sources_ifdef(CONFIG_SIDEWALK_SPI_BUS sid_pal_serial_bus_nrfx_spi.c)
6868
else()
6969
zephyr_library_sources_ifdef(CONFIG_SIDEWALK_SPI_BUS sid_pal_serial_bus_spi.c)
70-
endif() # CONFIG_SOC_NRF52840
70+
endif() # CONFIG_SIDEWALK_SPI_BUS_NRFX
7171

7272
zephyr_library_sources_ifdef(CONFIG_SIDEWALK sid_common.c)
7373

0 commit comments

Comments
 (0)