2020-10-24 07:38 PM
Hi ST,
I'm using STM32H723 with mx25lm51245g to test XIP feature, we want to run the program in the external flash, in the meantime we want to write/erase external flash.
We found that once the XIP feture is enabled (memory mapped mode), if we try to write the flash, HAL_OSPI_Command() will return HAL_OSPI_STATE_BUSY_MEM_MAPPED.
As per the STM32H723 reference manual, it supports to read and write in memory mapped mode, did I get it wrong?
Best Regards,
Yuting
2020-11-12 06:40 AM
Hi @yyou.1
Concerning the OCTOSPI , it support both read and write in memory mapped mode but not simultaneously.
I suggest you to program the external memory from the internal flash. So you will XIP from external memory , then jump to internal flash in order to program the external memory then jump back to XIP.
Bouraoui
2020-11-12 11:00 AM
I believe the BUSY reporting here is simply a software-interlock.
You'll have to tread carefully so the memory mapped space is not active during erase/write operations.
2020-11-12 01:57 PM
Besides implementation related restrictions in HAL:
For normal SPI flash, it is (almost) infeasible to do memory mapped writes: First, write enable command must be sent, this is not possible in memory mapped mode. If you do this in indirect read/write mode, then switch to memory mapper write, the data sent during a single write operation must belong to a single page with strictly sequential addresses. In particular, no other accesses but writes within this page are possible. Afterwards, either you must wait for the specified worst case page programing time or poll the flash's write in progress flag - during this period, the flash is completely inaccessible for any read or write.
Memory mapped write would work smoothly only for SPI RAM. For flash one would need an interface able to send a sequence of instructions (and respect the flash's page structure).. The OctoSPI can issue only a single instructioon for a memory mapped access.