MCUXpresso SDK Documentation

xspi_quad_edma_transfer

xspi_quad_edma_transfer#

Overview#

The xspi_quad_edma_transfer example shows how to use the XSPI driver with EDMA to access a Quad SPI NOR flash device.

In this example, XSPI will send data and operate the external Quad NOR flash connected with XSPI. Then the following operations are performed:

  • Sector Erase (4KB)

  • Page Program via EDMA

  • EDMA Read and verify

  • AHB Read and verify

After all tests complete, the flash is reset back to standard SPI mode.

Expected output#

XSPI EDMA example started!
Flash vendor ID: 0xEF
Erasing Serial NOR over XSPI...
Erase done.
Erase verify (EDMA read) - OK.
Page program done.
==> EDMA program+read: PASS.
==> AHB program+read: PASS.
XSPI EDMA example finished.
Flash reset to default SPI mode.

Supported Boards#

FRDM-IMXRT700
Hardware requirements
  • Mini/micro USB cable

  • FRDM-IMXRT700 board

  • Personal Computer

Board settings

No special settings are required. XSPI0 is used, which connects to the on-board W25Q25PWZEIM Quad SPI NOR flash (32MB). EDMA (DMA0, channels 0/1) is used for page program transfers.

The flash-ops object (xspi_quad_flash_edma_ops.c) and the XSPI/EDMA driver objects are placed in SRAM by the custom linker scripts so that erase/program operations do not stall instruction fetch from the same flash.

Prepare the Demo
  1. Connect a USB cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

When the example runs successfully, you can see similar output in the terminal:

XSPI QPI SDR (4-4-4) EDMA example started!
4-byte address mode entered.
QPI (4-4-4) mode enabled.
Flash vendor ID: 0xEF
Erasing Serial NOR over XSPI...
Erase done.
Erase verify (EDMA read) - OK.
Page program done.
==> EDMA program+read: PASS.
==> AHB program+read: PASS.
XSPI QPI SDR (4-4-4) EDMA example finished.
Flash reset to default SPI mode.
MIMXRT2660EVK
Hardware requirements
  • USB-C cable

  • MIMXRT2660-EVK board

  • Personal Computer

Board settings

No special settings are required. The example drives the on-board W25H512NWEAM QSPI NOR flash on XSPI0 (the boot flash) in Quad I/O (1-4-4) mode.

Prepare the Demo
  1. Connect the USB-C cable to the debug USB port on the board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Build the debug (RAM) target and download the program to the target board with a debugger. The example erases and programs a test sector at the 1 MB offset of the boot flash, so it must run from RAM, not XIP.

  4. Launch the debugger in your IDE to begin running the demo.

Running the demo

When the example runs successfully, the following message is displayed in the terminal (one test block per size):

XSPI Quad I/O EDMA example started!
4-byte address mode entered.
Quad I/O mode enabled.
Flash vendor ID: 0xEF

--- Test: 64 bytes ---
  IP read verify: PASS
  AHB read verify: PASS
...
XSPI Quad I/O EDMA example finished.
Flash reset to default SPI mode.