2026-04-06 11:06 PM - last edited on 2026-04-07 1:37 AM by Gyessine
Hi,
I am using the STM32U5G9 and trying to control a QSPI Flash (MX25L51245GXDI) using the HSPI peripheral.
I am confused about which official HAL library and functions I should use for this specific configuration. Since the hardware is named HSPI but the Flash is QSPI, it is unclear which driver is the intended one.
Could you please clarify which of the following should be used?
HAL_SPI_... (Standard SPI functions)
HAL_XSPI_... (Expanded SPI functions)
HAL_QSPI_... (Quad SPI functions)
HAL_OSPI_... (Octo-SPI functions)
There is no stm32u5xx_hal_hspi.c provided in the firmware package, and using HAL_QSPI_... or HAL_SPI_... functions with the HSPI1 instance results in type-casting errors and compilation failures.
Please provide the official recommendation on which HAL driver is mandatory for driving a 4-line Quad SPI Flash through the HSPI interface on the STM32U5G9 series.
Best regards,
Solved! Go to Solution.
2026-04-07 1:48 AM
Hello @luisfynn1
To communicate with a Quad‑SPI Flash using the HSPI peripheral, you should use the XSPI HAL driver, which provides the firmware functions to manage the OctoSPI/HSPI (XSPI) interface.
The XSPI peripheral can be configured to run in Quad mode (4 I/O lines), which is the recommended configuration for driving an external Quad‑SPI Flash connected to HSPI1.
2026-04-07 1:48 AM
Hello @luisfynn1
To communicate with a Quad‑SPI Flash using the HSPI peripheral, you should use the XSPI HAL driver, which provides the firmware functions to manage the OctoSPI/HSPI (XSPI) interface.
The XSPI peripheral can be configured to run in Quad mode (4 I/O lines), which is the recommended configuration for driving an external Quad‑SPI Flash connected to HSPI1.