Skip to main content
Graduate II
October 20, 2025
Solved

NOR Flash Write-While-Erase-Suspended?

  • October 20, 2025
  • 2 replies
  • 653 views

Hello,

maybe this is bit off-topic, but does anybody know if it is possible to suspend an ERASE operation and write to another (previously erased) sector?

I want to save a page in flash in case of a power outage and want to interrupt a probably ongoing ERASE.

If so, is this possible in internal flash or only in external flash?

In our design there are 2 QUAD SPI NOR flash connected to the dual QSPI- and one QUAD SPI NOR to a SPI interface of the STM32H75x. It would be surely possible to write to an idle flash while the other is busy erasing a sector. But it would be nice if write-while-erase-suspended would work on a single flash.

The documentation of flash is confusing e.g. in the MICRON flash, which is soldered on the STM32H753_EVAL board, it seems there is difference in sector erase and erase command:

regjoe_0-1760981035028.png

regjoe_1-1760981065400.png

The MACRONIX AN0247 says that programming is allowed

regjoe_2-1760981380824.png

but the datasheet says that only read is allowed in suspended state

regjoe_3-1760981677350.png

Any experience here, has anybody checked this out?

 

 

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

    Got my suspend/resume test working. I experienced two problems with the MT25QL. First, writing to flash after erase suspend works not for 4kB sectors. Now I use 64kB sector erase. Second, the program must wait for the WIP bit cleared after erase suspend before issuing a page write. It is not sufficient to wait for the erase suspend bit set only. The MT25QL maintains a negated copy of the WIP status register bit in the flag register. So both bits must be verified by reading the flag register. First I did not wait for WIP cleared and the following write did not succeed. The write seemed to be ignored because the program failure bit was not set.

    Yes, flash management is getting quite complex. Besides the mentioned EE emulation with "emergency write", in normal operation there are asynchronous accesses to flash resources from multiple threads which must be synchronized. These read/write requests also have a higher prio than the "garbage collector" running data copy and sector erases in the background. This will require a statemachine and thread synchronization.

     

     

    2 replies

    Super User
    October 20, 2025

    Yes, this feature is intended exactly for cases like yours.

    I've considered it for some project, with a flash of different type. But in the end decided to prepare the reserved blank page during the start-up, when there are no changes to save yet, so power failure at this time cannot cause any info loss.

    You can test and measure how long it takes to suspend and write. Consider that you may be unable to resume the erase and the volatile state of the flash can be lost. The erase should be repeated later, or this sector will be left in awkward state.

     

    regjoeAuthor
    Graduate II
    October 21, 2025

    Hi @Pavel A. 

    I need a sort of EE emulation layer with data buffered in RAM. A busy ERASE, run by the garbage collector, shall be killed or suspended in case of emergency shutdown in order to write the data in RAM to flash. 

    Q: Did you test the write-while-erase-suspended feature and if so, which flash did you use? I doubt all kind of flash support it.

     

    Super User
    October 21, 2025

    I've tested suspension on a parallel, memory-mapped NOR flash (IS29GL256). Reading is faster than over QSPI but programming is similarly complicated. We have a simple "journaling" method, suitable for our application. It is not based on the ST "eeprom emulation" examples. 

     

    Graduate II
    October 21, 2025

    Yes, I'd probably lean toward a journalling method too, with two 32KB or 64KB Erase Blocks, where one is typically held in an erased state ready to accommodate a small structure written in a cyclic manner.

    Shouldn't be too hard to code something. The ST EEPROM emulation is probably overkill with address and byte/word meta data.

    A small structure, with a sequence count, and perhaps an invalidation bit (knock-down to zero), that aligns well with the 256-byte page boundaries.

    Super User
    October 21, 2025

    @Tesla DeLorean  If I understand correctly the OP's problem is to write *while* some other block is erasing. This problem exists even with the journaling method, if the flash chip does not allow writes to one block while erasing other block.