简体   繁体   中英

STM32 - QSPI Flash Read Only Problem In Memory Mapped Mode

In STM32F7 , The code is running from the internal flash (default), we can read/write data from/to internal flash.

My problem is : I want to use external QSPI flash for my code execution (Memory mapped mode). Also during this mode, I would like to use the same QSPI flash for my data storage (ie. saving some settings) while code is executing in QSPI flash. But this is not possible since ST states that in its reference document ( AN4760 ):

    In Memory-mapped mode the QUADSPI allows the access to the external 
memory for read operation through the memory mapped address region 
(from 0x9000 0000 to 0x9FFF FFFF) and allows the external memory to 
be seen just like an internal memory.

Is there any solution to my problem (write data to QSPI flash) without exiting from memory mapped mode?

Is it possible to partition QSPI flash into two parts? One is used for memory mapped mode and the other used as just read/write data into it.

Note : I don't want to jump from external flash to internal flash for write data, then jump to external flash again for executing the code.

Any help would be appreciated.

Thanks.

No it is not possible. FLASH memory, if was written before, has to be erased, then you need to enter the wirte mode and write the memory. FLASH memory is always slow to write.

The memory mapped mode is usually used to run the code from the QSPI flash, or to simplify the the read access.

I know this is an older post but for future reference:

You need to stop executing out of external flash to write to it. Maybe by copying a small code block to RAM or executing from internal flash. Then jump to executing that code. That code could disable the external flash from memory mapped mode, write your data to it and then switch it back to memory mapped mode. Obviously during this time you would need to disable any relevant interrupts and make sure there was no accesses to memory mapped flash. Also take special care not to erase and overwrite your code in external flash, unless you want to of course!

This is a similar process to writing to internal flash when you cannot execute from it while writing to it.

You can write to flash by writing to the quadspi registers. See qspi_write_cmd_addr_data() in https://github.com/micropython/micropython/blob/master/ports/stm32/qspi.c

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM