zephyr/samples/drivers/spi_flash
Chaitanya Tata 29f81872ce samples: drivers: spi_flash: Add nRF54H20DK support
Verified on nRF54H20DK, useful for testing external flash access.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-05-17 10:34:31 +02:00
..
boards samples: drivers: spi_flash: Add nRF54H20DK support 2024-05-17 10:34:31 +02:00
src samples: drivers: include the stm32 xspi node for running the samples 2024-05-15 10:56:04 +02:00
CMakeLists.txt cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
prj.conf samples: spi_flash: remove an unnecessary config symbol 2017-02-04 19:45:44 +00:00
README.rst hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
sample.yaml samples: drivers: include the stm32 xspi node for running the samples 2024-05-15 10:56:04 +02:00

.. zephyr:code-sample:: spi-nor
   :name: JEDEC SPI-NOR flash
   :relevant-api: flash_interface

   Use the flash API to interact with an SPI NOR serial flash memory device.

Overview
********

This sample demonstrates using the :ref:`flash API <flash_api>` on a SPI NOR serial flash
memory device.  While trivial it is an example of direct access and
allows confirmation that the flash is working and that automatic power
savings is correctly implemented.

Building and Running
********************

The application will build only for a target that has a :ref:`devicetree <dt-guide>`
``spi-flash0`` alias that refers to an entry with one of the following bindings as a compatible:

* :dtcompatible:`jedec,spi-nor`,
* :dtcompatible:`st,stm32-qspi-nor`,
* :dtcompatible:`st,stm32-ospi-nor`,
* :dtcompatible:`nordic,qspi-nor`.

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/spi_flash
   :board: nrf52840dk/nrf52840
   :goals: build flash
   :compact:

Sample Output
=============

.. code-block:: console

   *** Booting Zephyr OS build zephyr-v2.3.0-2142-gca01d2e1d748  ***

   JEDEC QSPI-NOR SPI flash testing
   ==========================

   Test 1: Flash erase
   Flash erase succeeded!

   Test 2: Flash write
   Attempting to write 4 bytes
   Data read matches data written. Good!