HAL XSPI How to Use

group XSPI_How_To_Use

An explanation on XSPI overall usage :

  • XSPI is the abbreviation of Expanded Serial Peripheral Interface. It’s an interface that supports most external serial memories such as serial PSRAMs, serial NAND and serial NOR flash memories, HyperRAM and HyperFlash memories, with different functional mode.

  • The XSPI I/O manager is a low-level interface that enables an efficient XSPIM pin assignment with a full I/O matrix (before alternate function map) and multiplex of single/dual/quad/octal SPI interfaces over the same bus.

This file provides firmware functions to manage the following functionalities of XSPI peripheral:

  • Initialization and De-initialization functions

  • Configuration functions

  • Command and IO operation functions

  • IRQHandler, link DMA and Callbacks functions

  • Status functions

  • Delay Block functions

  • High-speed interface and calibration functions

  • Interrupt functions

How to use the XSPI HAL module driver

Initialization and de-initialization functions:

Configuration functions

Command and IO operation functions

XSPI IRQHandler , link DMA and Callbacks functions

State functions

Clock frequency of the XSPI peripheral

XSPI Delay Block functions

XSPI High-speed interface and calibration functions

  • The purpose of High-speed interface is primary to shift data or data strobe by one quarter of octal bus clock period, with a correct timing accuracy. DLL must be calibrated versus this clock period The calibration process is automatically enabled when one of the three conditions below is met:

    • The xSPI exits Reset state

    • The Prescaler is set

    • The configuration of communication is set

  • Use HAL_XSPI_HSIC_SetConfigDelay() function to configure the delay values of the high-speed interface DLLs

  • Use HAL_XSPI_HSIC_GetConfigDelay() to retrieve the delay values of the high-speed interface DLLs

XSPI OTFDEC functions

  • The On-The Fly Decryption (OTFDEC) engine is a hardware block used to protect the confidentiality of read-only firmware libraries stored in SPI NOR flash devices. The OTFDEC performs on-the-fly decryption during XSPI memory-mapped read operation.

  • The OTFDEC public services can be used as follows :

    1. Configure the OTFDEC region with user values as mentioned below:

    2. To protect the key from any write operation, call the HAL_XSPI_OTFDEC_LockRegionKey() . When locked, it’s not allowed to write in key registers in region x. Applying new keys is then possible only after a system reset of the OTFDEC peripheral reset through the RCC.This step is optional.

    3. To protect the peripheral from any configuration, call the HAL_XSPI_OTFDEC_LockRegionConfig() . When locked, it’s not allowed to apply any new configuration or any other key for the given region. The region configuration is then possible only after a system reset of the OTFDEC peripheral reset through RCC. This step is optional.

    4. The OTFDEC can perform encryption of plain data with the HAL_XSPI_OTFDEC_Encrypt() function. Note that :

      • During the OTFDEC encryption, it is not possible to run any other XSPI operation.

      • The encrypted buffer is not programmed/written into the target external memory. It is rather available in the RAM and it is up to the user to program the target external memory with the encrypted buffer.

    5. The On the Fly Decrypt can be started for a given region using HAL_XSPI_OTFDEC_EnableRegion().

Interrupt functions