Skip to main content
DavePfz
Associate III
June 29, 2026
Question

Using QSPI with FreeRTOS

  • June 29, 2026
  • 2 replies
  • 17 views

I am trying to adapt the QSPI Flash (QSPI_MemoryMapped) example found in the STM32WB5MM-DK to run with FreeRTOS. My hardware uses different ports for the QSPI connection but all has been set up through the ST32CubeMX program.

What I did then was to copy the code from the example into my project as a FreeRTOS task. However, the code pulls in some header files that don’t make sense to me. For example: stm32wbxx_hal_tim_ex.h results in the error “unknown type name 'HAL_StatusTypeDef”

I’m not sure why this is happening, or even why this header file is being pulled int, I so would appreciate any pointers. My guess is that is has to do the the HAL timer versus the FreeRTOS timer, but even then don’t know were to look!

Since I am using the flash without a fie system, maybe the QSPI_ReadWrite_DMA or QSPI_ReadWrite_IT would be better. If so, please suggest...

Thanks

2 replies

DavePfz
DavePfzAuthor
Associate III
June 29, 2026

I don’t know if this solves all of my problems, but I can now compile without errors. The order of the include files is important. It must be:

#include "stm32wbxx_hal.h"

#include "stm32wbxx_hal_def.h”

Still open to suggestions!

Pavel A.
June 29, 2026

> Still open to suggestions!

In memory-mapped mode, the QSPI controller automatically reads the flash, there are no interrupts that need attention of the program. 

But note that QSPI flash in memory-mapped mode is not writable. If you need to write, you switch to “indirect” mode, do the write and return to the memory-mapped mode. Obviously, the code doing this cannot run off the memory-mapped flash. Any RTOS task that can touch the memory-mapped area needs to be blocked during this time.