2025-05-07 6:42 AM
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?
Solved! Go to Solution.
2025-05-07 12:53 PM
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
2025-05-07 6:57 AM - edited 2025-05-07 6:58 AM
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.
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-05-07 7:32 AM
Hi, I make sure to run HAL_QSPI_Abort(&hqspi); before performing other operations, but the state error persists.
2025-05-07 8:01 AM
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.
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
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-05-07 10:21 AM
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
2025-05-07 12:53 PM
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