|
| 1 | +.. _storage_sample: |
| 2 | + |
| 3 | +Storage |
| 4 | +####### |
| 5 | + |
| 6 | +.. contents:: |
| 7 | + :local: |
| 8 | + :depth: 2 |
| 9 | + |
| 10 | +The Storage sample demonstrates how to configure and use storage instances with event callbacks. |
| 11 | +Depending on the configuration selected, the sample uses either the SoftDevice storage backend or the RRAM storage backend. |
| 12 | + |
| 13 | +Refer to the `Kconfig fragments`_ section for more information on configuration. |
| 14 | + |
| 15 | +Requirements |
| 16 | +************ |
| 17 | + |
| 18 | +The sample supports the following development kits: |
| 19 | + |
| 20 | +.. list-table:: |
| 21 | + :header-rows: 1 |
| 22 | + |
| 23 | + * - Hardware platform |
| 24 | + - PCA |
| 25 | + - Board target |
| 26 | + - DFU-enabled board target |
| 27 | + * - `nRF54L15 DK`_ |
| 28 | + - PCA10156 |
| 29 | + - bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice |
| 30 | + - bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice/mcuboot |
| 31 | + * - `nRF54L15 DK`_ (emulating nRF54L10) |
| 32 | + - PCA10156 |
| 33 | + - bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice |
| 34 | + - bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice/mcuboot |
| 35 | + * - `nRF54L15 DK`_ (emulating nRF54L05) |
| 36 | + - PCA10156 |
| 37 | + - bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice |
| 38 | + - bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice/mcuboot |
| 39 | + |
| 40 | +Kconfig fragments |
| 41 | +***************** |
| 42 | + |
| 43 | +By default, the sample uses the SoftDevice storage backend. |
| 44 | +To build the sample for the RRAM backend, you can use the :file:`storage-rram.conf` Kconfig fragment. |
| 45 | +To configure it for this sample, follow the steps outlined in the `Configuring and building the sample`_ section. |
| 46 | + |
| 47 | +Building and running |
| 48 | +******************** |
| 49 | + |
| 50 | +This sample can be found under :file:`samples/peripherals/storage/` in the |BMshort| folder structure. |
| 51 | + |
| 52 | +.. include:: /includes/create_sample.txt |
| 53 | + |
| 54 | +.. include:: /includes/configure_and_build_sample.txt |
| 55 | + |
| 56 | +.. include:: /includes/program_sample.txt |
| 57 | + |
| 58 | +Testing |
| 59 | +======= |
| 60 | + |
| 61 | +You can test this sample by performing the following steps: |
| 62 | + |
| 63 | +1. Compile and program the application. |
| 64 | +#. Observe that the following output is printed: |
| 65 | + |
| 66 | +* For the SoftDevice storage backend: |
| 67 | + |
| 68 | + .. code-block:: console |
| 69 | +
|
| 70 | + [00:00:00.005,789] <inf> app: Storage sample started |
| 71 | + [00:00:00.005,810] <inf> nrf_sdh: State change request: enable |
| 72 | + [00:00:00.011,214] <inf> app: Reading persisted data |
| 73 | + [00:00:00.011,232] <inf> app: output A: |
| 74 | + 48 65 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 |Hello... ........ |
| 75 | + [00:00:00.011,244] <inf> app: output B: |
| 76 | + 57 6f 72 6c 64 21 00 00 00 00 00 00 00 00 00 00 |World!.. ........ |
| 77 | + [00:00:00.011,250] <inf> app: Erasing in Partition A, addr: 0x0015B000, size: 16 |
| 78 | + [00:00:00.011,297] <inf> app: Erasing in Partition B, addr: 0x0015C000, size: 16 |
| 79 | + [00:00:00.011,304] <inf> app: Waiting for writes to complete... |
| 80 | + [00:00:00.012,370] <inf> app: Handler A: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 1 |
| 81 | + [00:00:00.013,444] <inf> app: Handler B: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 1 |
| 82 | + [00:00:00.013,468] <inf> app: output A: |
| 83 | + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........ |
| 84 | + [00:00:00.013,481] <inf> app: output B: |
| 85 | + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........ |
| 86 | + [00:00:00.013,496] <inf> nrf_sdh: State change request: disable |
| 87 | + [00:00:00.013,531] <inf> app: Writing in Partition A, addr: 0x0015B000, size: 16 |
| 88 | + [00:00:00.013,659] <inf> app: Handler A: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 0 |
| 89 | + [00:00:00.013,664] <inf> app: Writing in Partition B, addr: 0x0015C000, size: 16 |
| 90 | + [00:00:00.013,769] <inf> app: Handler B: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 0 |
| 91 | + [00:00:00.013,775] <inf> app: Waiting for writes to complete... |
| 92 | + [00:00:00.013,789] <inf> app: output A: |
| 93 | + 48 65 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 |Hello... ........ |
| 94 | + [00:00:00.013,801] <inf> app: output B: |
| 95 | + 57 6f 72 6c 64 21 00 00 00 00 00 00 00 00 00 00 |World!.. ........ |
| 96 | + [00:00:00.013,807] <inf> app: Storage sample finished. |
| 97 | +
|
| 98 | +* For the RRAM storage backend: |
| 99 | + |
| 100 | + .. code-block:: console |
| 101 | +
|
| 102 | + [00:00:00.005,783] <inf> app: Storage sample started |
| 103 | + [00:00:00.005,791] <inf> app: Reading persisted data |
| 104 | + [00:00:00.005,808] <inf> app: output A: |
| 105 | + 48 65 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 |Hello... ........ |
| 106 | + [00:00:00.005,820] <inf> app: output B: |
| 107 | + 57 6f 72 6c 64 21 00 00 00 00 00 00 00 00 00 00 |World!.. ........ |
| 108 | + [00:00:00.005,825] <inf> app: Erasing in Partition A, addr: 0x0015B000, size: 16 |
| 109 | + [00:00:00.005,835] <inf> app: Handler A: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 0 |
| 110 | + [00:00:00.005,886] <inf> app: Erasing in Partition B, addr: 0x0015C000, size: 16 |
| 111 | + [00:00:00.005,894] <inf> app: Handler B: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 0 |
| 112 | + [00:00:00.005,949] <inf> app: Waiting for writes to complete... |
| 113 | + [00:00:00.005,960] <inf> app: output A: |
| 114 | + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........ |
| 115 | + [00:00:00.005,972] <inf> app: output B: |
| 116 | + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........ |
| 117 | + [00:00:00.005,977] <inf> app: Writing in Partition A, addr: 0x0015B000, size: 16 |
| 118 | + [00:00:00.005,985] <inf> app: Handler A: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 0 |
| 119 | + [00:00:00.006,008] <inf> app: Writing in Partition B, addr: 0x0015C000, size: 16 |
| 120 | + [00:00:00.006,016] <inf> app: Handler B: bm_storage_evt: WRITE_RESULT 0, DISPATCH_TYPE 0 |
| 121 | + [00:00:00.006,042] <inf> app: Waiting for writes to complete... |
| 122 | + [00:00:00.006,053] <inf> app: output A: |
| 123 | + 48 65 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 |Hello... ........ |
| 124 | + [00:00:00.006,065] <inf> app: output B: |
| 125 | + 57 6f 72 6c 64 21 00 00 00 00 00 00 00 00 00 00 |World!.. ........ |
| 126 | + [00:00:00.006,071] <inf> app: Storage sample finished. |
| 127 | +
|
| 128 | +.. note:: |
| 129 | + |
| 130 | + The addresses may vary depending on the board target selected. |
0 commit comments