xspi_quad_polling_transfer#
Overview#
The xspi_quad_polling_transfer example shows how to use the XSPI driver with polling 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. The flash is configured for quad transfers, then the following operations are performed at multiple transfer sizes (64, 128, 256 bytes):
Sector Erase (4KB)
Page Program
IP Read and verify
AHB Read and verify
After all tests complete, the flash is reset back to standard SPI mode.
Expected output#
XSPI Quad I/O polling 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
--- Test: 128 bytes ---
IP read verify: PASS
AHB read verify: PASS
--- Test: 256 bytes ---
IP read verify: PASS
AHB read verify: PASS
--- Test: 512 bytes ---
IP read verify: PASS
AHB read verify: PASS
XSPI Quad I/O polling 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).
The flash-ops object (xspi_quad_flash_ops.c) and the XSPI driver object 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
Connect a USB cable between the host PC and the MCU-Link USB port on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
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) polling example started!
4-byte address mode entered.
QPI (4-4-4) mode enabled.
Flash vendor ID: 0xEF
--- Test size: 64 bytes ---
IP read: PASS
AHB read: PASS
--- Test size: 128 bytes ---
IP read: PASS
AHB read: PASS
--- Test size: 256 bytes ---
IP read: PASS
AHB read: PASS
XSPI QPI SDR (4-4-4) polling 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
Connect the USB-C cable to the debug USB port on the board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
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.
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 polling 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 polling example finished.
Flash reset to default SPI mode.