Introduction to external serial memory with STM32

Revision as of 18:14, 18 September 2024 by Registered User (→‎STMicroelectronics resources)

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.

Caption
With xxx can be QUADSPI, OCTOSPI, HSPI, OCTOSPIM, or XSPIM
Info white.png Information
The OCTOSPI or XSPI I/O manager (OCTOSPIM or XSPIM) is a low-level peripheral, enabling an efficient OCTOSPI/XSPI pin assignment with a full I/O matrix (before alternate function map), and multiplex of single/dual/quad/octal/16-bit SPI interfaces over the same bus.

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.

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
  1. The regular-command frame format with the command, address, alternate byte, dummy cycles, and data phase
  2. The HyperBus™ frame format to support HyperRAM™ and HyperFlash™ memories.
Warning white.png Warning

Data strobe feature is not supported by the QUADSPI peripheral

HyperBus protocol is not available for QUADSPI controller since HyperBus is using 8-bit or 16-bit data mode.

For a complete list of features refer to the product reference manuals.

Supported Devices

Info white.png Information
These controllers are compatible with a range memory providers, including Macronix, Infineon, Windon, and ISSI. Thanks to the regular-command frame format flexibility and to the HyperBus protocol. Below is a brief list of memory components that have been tested with STM32 products implementing these peripherals. Nevertheless, users are recommended to verify whether or not the specific memory part chosen for their custom application meets all the criteria and requirements of these interfaces to ensure compatibility and optimal performance.
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

  1. Under connectivity, select the available peripheral on your desired product
  2. Select the memory mode you wish to use, the mode depends on the memory and its communication protocol
  3. 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
  4. Configure the system and the external serial memory controller clock.
  5. Configure the controller parameter, these parameters depend on the used memory and its communication protocol
Info white.png Information
Refer to the following application notes for a detailed description of the operation and configuration of these controllers:

Quad-SPI interface on STM32 microcontrollers and microprocessors: AN4760

Getting started with Octo-SPI, Hexadeca-SPI, and XSPI interfaces on STM32 MCUs: AN5050

4. STMicroelectronics resources

ST provides resources to help users understand these controllers and quickly start their applications.

Caption

Below is a list of the available resources and their links:

  • Applications note:

AN4760 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
No categories assignedEdit