The purpose of this article is to:
- Brief introduction to the external serial memory controllers integrated within the STM32 microcontrollers (MCUs).
- Explain how to configure the peripheral
- List all the available resources to help users get started
1. What is external serial memory controller?
As application complexity increases, driven by the demand for richer, more intuitive graphical user interfaces (GUIs and HMIs) and advanced processing capabilities, these requirements necessitate higher data throughputs and impose additional demands on the often-limited MCU on-chip memory. To meet these challenges, STMICROELECTRONICS offers several MCUs that embed external serial memory controllers capable of interfacing and communicating with external serial memories. These controllers include QUADSPI, OCTOSPI, HSPI, and XSPI.
Quad Serial Peripheral Interface (QUADSPI) is the first interface introduced by STMICROELECTRONICS, which has x4 IO lines. They then expanded their portfolio with the Octal Serial Peripheral Interface (OCTOSPI), which has x8 IO lines; the Hexadeca Serial Peripheral Interface (HSPI), which has x16 IO lines; and Extended Serial Peripheral Interface (XSPI), which has x16 IO lines.
Refer to the product datasheet and reference manual to see which interface is implemented and the available pins.
2. Peripherals overview
These controllers have been specifically designed to communicate with serial PSRAMs, serial NAND and serial NOR flash memories, HyperRAM™ and HyperFlash™ memories, targeting single, dual, quad, octal, or 16-bit memories.
These controllers provide communication with external serial memory in Master mode.
Supported Features
The external serial memory peripheral integrated into STM32 MCUs offer several key features, below are the main features:
- OCTOSPI, HSPI, and XSPI are designed to support JESD251C protocol
- Support high speed (>60MHz)
- Functional modes: indirect, automatic status-polling, and memory-mapped
- Support eXecute In Place (XIP)
- SDR (single-data rate) and DTR (double-transfer rate) support
- Data strobe support (DQS)
- Integrated FIFO for reception and transmission
- 8-, 16-, and 32-bit data accesses allowed
- DMA protocol support
- Supports the following protocols with associated frame formats, allowing compatibility with almost all memory available on the market
- The regular-command frame format with the command, address, alternate byte, dummy cycles, and data phase
- The HyperBus™ frame format to support HyperRAM™ and HyperFlash™ memories.
For a complete list of features refer to the product reference manuals.
Supported Devices
Vendor | Memory reference | Voltage |
---|---|---|
APMEMORY | APS1604M-3SQR | 2.7-3.6 |
Infineon | S25FL512S | 3-3.3 |
Macronix | MX25L6445E | 2.7-3.6 |
APMEMORY | APS6408L-OB | 2.7-3.6 |
Macronix | MX25LM51245G | 2.7-3.6 |
ISSI | IS66WVH8M8ALL-166B1LI | 1.7-1.95 |
WINBOND | W955D8MBYA | 1.7-1.95 |
APMEMORY | APS25608/16N‐OBRx | 1.62-1.98 |
WINBOND | W958D6NBMA | 1.7-2.0 |
3. Configuring peripherals
Before any data can be transferred to or from the external memory, the peripheral needs to be configured. This configuration can be accomplished using the STM32CubeMX graphical tool, with additional manual adjustment if needed.
The configuration steps are generally similar for all peripherals, but there is specific difference for the OCTOSPI, HSPI, and XSPI peripherals compared to the QSPI.
Configuration steps
- Under connectivity, select the available peripheral on your desired product
- Select the memory mode you wish to use, the mode depends on the memory and its communication protocol
- Select and configure the pins. Ensure that the pins used are dedicated for the serial external serial memory controller. Refer to the product datasheet for more details
- Configure the system and the external serial memory controller clock.
- Configure the controller parameter, these parameters depend on the used memory and its communication protocol
4. STMicroelectronics resources
ST provides resources to help users understand these controllers and quickly start their applications.
Below is a list of the available resources and their links:
- Applications note:
AN4670 Quad-SPI interface on STM32 microcontrollers and microprocessors
AN5050 Getting started with Octo-SPI, Hexadeca-SPI, and XSPI Interface on STM32 MCU
- Examples
Preconfigured examples for supported MCUs are available to help users get started quickly. These examples can be found under: Examples can be found under:
STM32Cube_FW_xx\Projects\STM32xxx\Examples\
- Middleware
Middleware components are also provided to streamline the integration and usage of these peripherals in various application. One such component is the External Loader. This middleware facilitates the programming, erasing, and reading of external memory devices. For more detailed about the External loader users can refer to the following wiki and the available projects:
Wiki page: Getting started with STM32 and External Memory
External loader examples on GitHub: https://github.com/STMicroelectronics/stm32-external-loader
- Drivers
Based on the selected MCU, users can refer to available resources provided in the STM32Cube Firmware package. Drivers and BSP component drivers can be found under:
STM32Cube_FW_xx\Drivers\STM32xxxx_HAL_Driver STM32Cube_FW_xx\Drivers\BSP\Components
5. Acronyms and definitions
Term | Definition |
---|---|
QUADSPI | Quad Serial Peripheral Interface |
OCTOSPI | Octal Serial Peripheral Interface |
HSPI | Hexadeca Serial Peripheral Interface |
XSPI | Extended Serial Peripheral Interface |
OCTOSPIM | OCTOSPI IO manager |
XSPIM | XSPI IO manager |
SDR | Single data rate |
DTR | Double data rate |