You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add SPI sample with SPIM and SPIS support.
Button 2 triggers a master transfer, LED 2 toggles on slave reception.
Includes:
- SPIM and SPIS initialization and transfer handling
- Board configuration with default pin mappings for all supported DKs
- Kconfig option for configurable message string
- Documentation with wiring guide, pin conflict notes, and testing steps
Signed-off-by: Martynas Smilingis <martynas.smilingis@nordicsemi.no>
Copy file name to clipboardExpand all lines: doc/nrf-bm/links.txt
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,7 @@
91
91
.. _`How to flash an application`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/get_started/quick_debug.html#how-to-flash-an-application
92
92
.. _`How to connect to the terminal`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/get_started/quick_debug.html#how-to-connect-to-the-terminal
93
93
.. _`nRF Connect for Desktop`: https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop
The sample initializes the **SPIM** and **SPIS** instances with the pins configured in the board's :file:`board-config.h`.
39
+
When **Button 2** is pressed, the master sends a configurable string (:kconfig:option:`CONFIG_SAMPLE_SPI_MSG`) to the slave.
40
+
The slave receives the data, logs it, and toggles **LED 2**.
41
+
42
+
User interface
43
+
**************
44
+
45
+
LED 0
46
+
Lit when the sample is initialized and ready.
47
+
48
+
LED 2
49
+
Toggles each time the SPI slave completes a reception.
50
+
51
+
Button 2
52
+
Sends a message from the local SPIM to the connected SPIS.
53
+
54
+
.. _bm_spi_wiring:
55
+
56
+
Wiring
57
+
======
58
+
59
+
The sample uses the **SPIM** and **SPIS** pins defined in the board's :file:`board-config.h` header (``BOARD_APP_SPIM_*`` and ``BOARD_APP_SPIS_*``).
60
+
61
+
.. include:: /includes/spi_board_connections.txt
62
+
63
+
Connect the four SPIM pins to the SPIS pins on the same board, matching each signal by name (SCK→SCK, MOSI→MOSI, MISO→MISO, CSN→CSN).
64
+
65
+
.. note:: Board-specific behavior
66
+
67
+
* **nRF54L15 DK** — SPI Master pins overlap with **LED 3** (P1.14, flickers during transfers) and **Button 0** (P1.13, do not press during transfers).
68
+
* **nRF54LV10 DK** — The SPI Slave pins (P0.00-P0.03) are shared with one of the debuggers virtual serial ports.
69
+
Before running the sample, open the `Board Configurator`_ app in `nRF Connect for Desktop`_ and disable the **Connect port VCOM** entry that is mapped to pins **P0.00-P0.03**, to release these pins from the debugger.
70
+
Leave the other **Connect port VCOM** entry (mapped to pins **P1.04-P1.07**) enabled, since it is the virtual serial port used to read the samples log output.
71
+
72
+
.. tip:: Two-board setup
73
+
74
+
If single-board loopback is not supported on your board by default, you can also wire the SPIM signals of one board to the SPIS signals of a second board running the same sample.
75
+
In that case, make sure to connect a common **GND** between the two boards and keep the wiring short to avoid signal integrity issues.
76
+
77
+
Building and running
78
+
********************
79
+
80
+
This sample can be found under :file:`samples/peripherals/spi/` in the |BMshort| folder structure.
81
+
82
+
For details on how to create, configure, and program a sample, see :ref:`getting_started_with_the_samples`.
83
+
84
+
Testing
85
+
=======
86
+
87
+
After building and flashing the sample, test it as follows:
88
+
89
+
1. Connect the four SPIM→SPIS signal pairs on the same board (see :ref:`Wiring <bm_spi_wiring>`).
90
+
#. Open the console log and verify that ``SPI sample initialized`` appears in the log.
91
+
#. Press **Button 2**.
92
+
#. Observe that the log shows a master "sent" entry and a slave "received" entry, both containing the :kconfig:option:`CONFIG_SAMPLE_SPI_MSG` string.
93
+
#. Observe that **LED 2** toggles on each completed reception.
0 commit comments