zephyr/samples/drivers/memc
Daniel DeGrasse 33f90e1eab samples: drivers: memc: support PSRAM on RW612 while using XIP mode
RW612 has one FLEXSPI controller, which is capable of supporting
multiple external devices on one board. However, care must be taken when
configuring the FLEXSPI to use multiple devices, as if the FLEXSPI is
configured incorrectly in XIP mode it will fail to read from the
external flash, and the chip will crash.

Make the following changes to the RW configuration for the MEMC sample,
in order to support executing from flash while accessing PSRAM:
- initialize the FLEXSPI MEMC driver first, before the flash or PSRAM
  drivers are initialized
- force the FLEXSPI MEMC driver to reconfigure the FLEXSPI at boot, so
  we can configure the DQS sampling mode for the PSRAM on port B
- only configure the PSRAM pins during FLEXSPI init, so XIP is not
  disrupted
- configure the flash device at boot. This is required so that the MEMC
  driver will not replace the LUTs programmed in the FLEXSPI by the
  bootrom, as it would otherwise not be aware of their existence.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-14 18:21:57 -04:00
..
boards samples: drivers: memc: support PSRAM on RW612 while using XIP mode 2024-05-14 18:21:57 -04:00
src samples: driver: memc: Fix print argument 2024-03-26 10:48:18 -04:00
CMakeLists.txt
prj.conf
README.rst samples: drivers: memc: Fix README 2024-03-26 10:48:18 -04:00
sample.yaml hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00

.. zephyr:code-sample:: memc
   :name: Memory controller (MEMC) driver

   Access memory-mapped external RAM

Overview
********

This sample can be used with any memory controller driver that
memory maps external RAM. It is intended to demonstrate
the ability to read and write from the memory mapped region.

Note that the chosen region (set by ``sram-ext`` dt alias node) should not
overlap with memory used for XIP or SRAM by the application, as the sample
would overwrite this data


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

This application can be built and executed on an RT595 EVK as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/memc
   :host-os: unix
   :board: mimxrt595_evk/mimxrt595s/cm33
   :goals: run
   :compact:

To build for another board, change "mimxrt595_evk/mimxrt595s/cm33" above to that
board's name.

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

.. code-block:: console

  *** Booting Zephyr OS build zephyr-v3.2.0-2686-gd52d828c2bdc ***
  Writing to memory region with base 0x38000000, size 0x800000

  Check (0/8191) passed!
  Check (1/8191) passed!
  ...
  Check (8190/8191) passed!
  Check (8191/8191) passed!

  First 1KB of Data in memory:
  \=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=
  00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
  10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
  20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
  ....

  Read data matches written data