Skip to content

Commit 25fd73e

Browse files
samples: peripherals: spi_mngr: add SPI manager NOR flash sample
Add a non-blocking sample that exercises read, page program, and sector erase on the on-board external NOR flash through the SPI manager library. Buttons trigger the operations and the read result is logged as a hex dump. Wire up BOARD_EXTERNAL_MEMORY_* macros (SPIM instance, SCK/MOSI/MISO/CS and WP#/RST# strap pins) in the affected board-config.h files so the sample picks up the on-board flash automatically. Signed-off-by: Martynas Smilingis <martynas.smilingis@nordicsemi.no>
1 parent 7b45c6a commit 25fd73e

15 files changed

Lines changed: 578 additions & 2 deletions

boards/nordic/bm_nrf54l15dk/include/board-config.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,30 @@ extern "C" {
6363
#define BOARD_CONSOLE_UARTE_PIN_CTS NRF_PIN_PORT_TO_PIN_NUMBER(7, 1)
6464
#endif
6565

66+
/* External SPI memory pins. */
67+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_INST
68+
#define BOARD_EXTERNAL_MEMORY_SPIM_INST NRF_SPIM00
69+
#endif
70+
71+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_SCK
72+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_SCK NRF_PIN_PORT_TO_PIN_NUMBER(1, 2)
73+
#endif
74+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_MOSI
75+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_MOSI NRF_PIN_PORT_TO_PIN_NUMBER(2, 2)
76+
#endif
77+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_MISO
78+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_MISO NRF_PIN_PORT_TO_PIN_NUMBER(4, 2)
79+
#endif
80+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_CSN
81+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_CSN NRF_PIN_PORT_TO_PIN_NUMBER(5, 2)
82+
#endif
83+
#ifndef BOARD_EXTERNAL_MEMORY_PIN_WP
84+
#define BOARD_EXTERNAL_MEMORY_PIN_WP NRF_PIN_PORT_TO_PIN_NUMBER(3, 2)
85+
#endif
86+
#ifndef BOARD_EXTERNAL_MEMORY_PIN_RST
87+
#define BOARD_EXTERNAL_MEMORY_PIN_RST NRF_PIN_PORT_TO_PIN_NUMBER(0, 2)
88+
#endif
89+
6690
/* Application UART configuration */
6791
#ifndef BOARD_APP_UARTE_INST
6892
#define BOARD_APP_UARTE_INST NRF_UARTE30

boards/nordic/bm_nrf54lm20dk/include/board-config.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,30 @@ extern "C" {
6363
#define BOARD_CONSOLE_UARTE_PIN_CTS NRF_PIN_PORT_TO_PIN_NUMBER(19, 1)
6464
#endif
6565

66+
/* External SPI memory pins. */
67+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_INST
68+
#define BOARD_EXTERNAL_MEMORY_SPIM_INST NRF_SPIM00
69+
#endif
70+
71+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_SCK
72+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_SCK NRF_PIN_PORT_TO_PIN_NUMBER(1, 2)
73+
#endif
74+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_MOSI
75+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_MOSI NRF_PIN_PORT_TO_PIN_NUMBER(2, 2)
76+
#endif
77+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_MISO
78+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_MISO NRF_PIN_PORT_TO_PIN_NUMBER(4, 2)
79+
#endif
80+
#ifndef BOARD_EXTERNAL_MEMORY_SPIM_PIN_CSN
81+
#define BOARD_EXTERNAL_MEMORY_SPIM_PIN_CSN NRF_PIN_PORT_TO_PIN_NUMBER(5, 2)
82+
#endif
83+
#ifndef BOARD_EXTERNAL_MEMORY_PIN_WP
84+
#define BOARD_EXTERNAL_MEMORY_PIN_WP NRF_PIN_PORT_TO_PIN_NUMBER(3, 2)
85+
#endif
86+
#ifndef BOARD_EXTERNAL_MEMORY_PIN_RST
87+
#define BOARD_EXTERNAL_MEMORY_PIN_RST NRF_PIN_PORT_TO_PIN_NUMBER(0, 2)
88+
#endif
89+
6690
/* Application UART configuration */
6791
#ifndef BOARD_APP_UARTE_INST
6892
#define BOARD_APP_UARTE_INST NRF_UARTE30
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**S115**:
2+
3+
.. list-table::
4+
:header-rows: 1
5+
6+
* - Hardware platform
7+
- PCA
8+
- Board target
9+
* - `nRF54L15 DK`_
10+
- PCA10156
11+
- bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice/mcuboot
12+
* - `nRF54L15 DK`_ (emulating nRF54L10)
13+
- PCA10156
14+
- bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice/mcuboot
15+
* - `nRF54L15 DK`_ (emulating nRF54L05)
16+
- PCA10156
17+
- bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice/mcuboot
18+
* - `nRF54LM20 DK`_
19+
- PCA10184
20+
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice/mcuboot
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**S145**:
2+
3+
.. list-table::
4+
:header-rows: 1
5+
6+
* - Hardware platform
7+
- PCA
8+
- Board target
9+
* - `nRF54L15 DK`_
10+
- PCA10156
11+
- bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice/mcuboot
12+
* - `nRF54L15 DK`_ (emulating nRF54L10)
13+
- PCA10156
14+
- bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice/mcuboot
15+
* - `nRF54L15 DK`_ (emulating nRF54L05)
16+
- PCA10156
17+
- bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice/mcuboot
18+
* - `nRF54LM20 DK`_
19+
- PCA10184
20+
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice/mcuboot
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**S115**:
2+
3+
.. list-table::
4+
:header-rows: 1
5+
6+
* - Hardware platform
7+
- PCA
8+
- Board target
9+
* - `nRF54L15 DK`_
10+
- PCA10156
11+
- bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice
12+
* - `nRF54L15 DK`_ (emulating nRF54L10)
13+
- PCA10156
14+
- bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice
15+
* - `nRF54L15 DK`_ (emulating nRF54L05)
16+
- PCA10156
17+
- bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice
18+
* - `nRF54LM20 DK`_
19+
- PCA10184
20+
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
**S145**:
2+
3+
.. list-table::
4+
:header-rows: 1
5+
6+
* - Hardware platform
7+
- PCA
8+
- Board target
9+
* - `nRF54L15 DK`_
10+
- PCA10156
11+
- bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice
12+
* - `nRF54L15 DK`_ (emulating nRF54L10)
13+
- PCA10156
14+
- bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice
15+
* - `nRF54L15 DK`_ (emulating nRF54L05)
16+
- PCA10156
17+
- bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice
18+
* - `nRF54LM20 DK`_
19+
- PCA10184
20+
- bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice

doc/nrf-bm/libraries/bm_spi_mngr.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ Busy state
9898

9999
Use the :c:func:`bm_spi_mngr_is_idle` function to check whether all scheduled work has finished.
100100

101+
Sample
102+
******
103+
104+
The usage of this library is demonstrated in the :ref:`spi_mngr_sample` sample.
105+
101106
Dependencies
102107
************
103108

doc/nrf-bm/links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
.. _`How to flash an application`: https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/get_started/quick_debug.html#how-to-flash-an-application
9292
.. _`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
9393
.. _`nRF Connect for Desktop`: https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop
94+
.. _Board Configurator: https://docs.nordicsemi.com/bundle/nrf-connect-board-configurator/page/index.html
9495
.. _`additional requirements`: https://docs.nordicsemi.com/bundle/nrf-connect-desktop/page/download_cfd.html
9596
.. _`nRF Connect Device Manager`: https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-Device-Manager
9697
.. _`nRF Toolbox`: https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Toolbox

doc/nrf-bm/release_notes/release_notes_changelog.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ No changes since the latest nRF Connect SDK Bare Metal release.
3333
Boards
3434
======
3535

36-
No changes since the latest nRF Connect SDK Bare Metal release.
36+
* Added ``BOARD_EXTERNAL_MEMORY_*`` macros to **bm_nrf54l15dk** and **bm_nrf54lm20dk** ``board-config.h`` (SPIM instance, SCK/MOSI/MISO/CS and WP#/RST# strap pins) for on-board SPI external flash. Other BM development kits do not include external flash memory on the board, so their ``board-config.h`` files omit these macros.
3737

3838
Build system
3939
============
@@ -120,7 +120,7 @@ No changes since the latest nRF Connect SDK Bare Metal release.
120120
Peripheral samples
121121
------------------
122122

123-
No changes since the latest nRF Connect SDK Bare Metal release.
123+
* Added the :ref:`spi_mngr_sample` sample, demonstrating non-blocking read, page program, and sector erase on the on-board external NOR flash using the :ref:`lib_bm_spi_mngr` library.
124124

125125
DFU samples
126126
-----------
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Copyright (c) 2026 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(spi_mngr)
11+
12+
target_sources(app PRIVATE src/main.c)

0 commit comments

Comments
 (0)