Skip to main content
Graduate
May 7, 2025
Solved

Writing to QSPI Memory Mapped Mode

  • May 7, 2025
  • 3 replies
  • 1179 views

I am trying to debug some functions to write to the memory mapped QSPI. When I go to debug it, I notice that before any functions even run the QPSI is in HAL_QSPI_STATE_ERROR, therefore I cannot test my code to see if is running because it is dependent on the State of the QSPI. My QSPI is a WinBond25Q128JVSQ. Is there a way to trouble shoot this?

    This topic has been closed for replies.
    Best answer by Priyank

    I was able to find a solution,

     __HAL_RCC_QSPI_FORCE_RESET();
     __HAL_RCC_QSPI_RELEASE_RESET();
     __HAL_RCC_QSPI_CLK_ENABLE();
     HAL_QSPI_Abort(&hqspi);

    thank you 

    3 replies

    Technical Moderator
    May 7, 2025

    Hello @Priyank;

     

    When the QUADSPI interface configured in memory-mapped mode, the external flash memory is seen as an internal memory but with some latency during accesses. Only read operations are allowed to the external flash memory in memory-mapped mode. 

    The indirect mode supports read and write operations. 

    For the OCTOSPI interface, the write operation is supported in memory-mapped mode. 

     

    Please look at Overall FAQs for QUADSPI/OCTOSPI/HSPI/XSPI article. This article provides some external memories tips and tricks.

    KDJEM1_0-1746626223777.png

     

    Thank you.

    Kaouthar

    PriyankAuthor
    Graduate
    May 7, 2025

    Hi, I make sure to run HAL_QSPI_Abort(&hqspi); before performing other operations, but the state error persists.

    Graduate II
    May 7, 2025

    I don't know, some of the HAL libraries are a bit broken. Check you're working with most current.

    Check the QSPI Instance contents in this condition, check that of the Peripheral itself too.

    Dump these for inspection.

    You should be able to write into the Instance State, and also abort the peripheral directly thru it's registers, see HAL_QSPI_Abort() source.

    It could also be that it doesn't see the Peripheral in an active state, ie already aborted, or this library is not fully supporting or buggy.

    Again, you don't present enough info to understand exactly what's happening, and I'm not investing the time to replicate

    Technical Moderator
    May 7, 2025

    Hi @Priyank,

     

    To clarify my last reply.

    "Writing to QSPI Memory Mapped Mode

    I am trying to debug some functions to write to the memory mapped QSPI."  

    ->The memory mapped mode is only suitable for read operation (en.STM32F7_Memory_QuadSPI.pdf), so you cannot made a write operation in memory mapped mode.

    KDJEM1_1-1746630074784.png

     

    KDJEM1_0-1746629254634.png

    Are you switching to indirect mode for write operation?

    Which STM32F7 MCU are you using? Could you share your project?

    I recommend you to look at BSP example. 

    This example provides of how to write, read and buffers compare for external flash memory using QSPI communication. For the QSPI test, one of the following flags must be defined in the preprocessor:

    - USE_STM32746G_DISCO_REVC03 : Board contains the W25Q128J QSPI component.

    - USE_STM32746G_DISCO : Board contains the N25Q128A QSPI component.(Defined by default)

     

    Thank you.

    Kaouthar

    PriyankAuthorAnswer
    Graduate
    May 7, 2025

    I was able to find a solution,

     __HAL_RCC_QSPI_FORCE_RESET();
     __HAL_RCC_QSPI_RELEASE_RESET();
     __HAL_RCC_QSPI_CLK_ENABLE();
     HAL_QSPI_Abort(&hqspi);

    thank you