AN4429
Application note
RPC56xx and SPC56xx C90FL Flash recovery in case of brownout
during Flash erase operation
Introduction
The RPC56xx and SPC56xx families of devices have internal Flash used for code and data.
The following RPC56xx and SPC56xx devices use C90FL technology they are for internal
Flash:
•
RPC56ELxx
•
RPC564Axx
•
SPC56xLxx
•
SPC564Axx
If, on C90FL Flash, there is an accidental power loss or supply voltage drop or unexpected
reset (in general called brownout) that happens during a Flash erase operation, the Flash
blocks erased are left a not deterministic state.
This application note describes how to recover the C90FL Flash block(s) interrupted during
an erase operation in case of such brownouts.
January 2015
DocID025710 Rev 2
1/14
www.st.com
Contents
AN4429
Contents
1
2
C90FL Flash erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Issue caused by brownout during Flash erase . . . . . . . . . . . . . . . . . . . 4
2.1
2.2
Recover from non-correctable ECC errors . . . . . . . . . . . . . . . . . . . . . . . . . 4
Recover from depleted bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Appendix A Example script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Appendix B Example code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2/14
DocID025710 Rev 2
AN4429
C90FL Flash erase operation
1
C90FL Flash erase operation
C90FL Flash erase operation consists of multiple steps as shown in
Figure 1
which is
implemented by the C90FL Flash memory controller hardware. First, all bits in the selected
Flash block(s) are programmed in order to verify the level that allows the erase function to
start at consistent state. Then the erase step deletes all bits. Since the erase is a bulk
operation in which an erase pulse moves all the bits in a Flash block, some bits are over-
erased, for example, under the compaction of check up or under a software program of
verify level. At the compaction step the over-erased columns are compacted back to reduce
column leakage. And finally all the bits below software program verify level are
reprogrammed with very low gate, in order to avoid overshoot of erase verify level for any
bits. As a result, when an erase operation is completed, all the bits in the selected blocks
have their threshold voltage within a pre-defined window, between erase verify level and
software program verify level.
Figure 1. C90FL Flash erase operation flow
DocID025710 Rev 2
3/14
13
Issue caused by brownout during Flash erase
AN4429
2
Issue caused by brownout during Flash erase
If there is an accidental power loss or supply voltage drop or unexpected reset on C90FL
Flash, (i.e., brownout) that occurs during a Flash erase operation, the Flash blocks that are
erased are left a not deterministic state, but it depends on the step where the erase
operation has been interrupted.
Typically to recover the Flash block(s) that are interrupted to a working state again, users
can simply perform an erase operation on the Flash block(s). However, there are two cases
that require special attention.
2.1
Recover from non-correctable ECC errors
If a brownout occurs during Flash erase operation the bits in the block(s) remain and non-
correctable ECC (error correcting code) errors appear. Note that in C90FL Flash, a single-
bit error correction and double-bit error detection (SEC-DED) ECC code are used.
For example, if the brownout occurs during the program step in the erase operation, many
Flash pages, including the corresponding ECC bits, are left programmed. Note that all zeros
are not a valid ECC codeword, and hence this causes non-correctable ECC errors when
they are reading those Flash block(s). Similarly the brownout can occur after the program
step but in the middle of the erase step.
Even at this state, the Flash block(s) can still be erased to recover it. However, some Flash
programmer tools (e.g. Lauterbach) may read Flash while executing a code from RAM
before performing an erase operation. As a result, it generates ECC error and hence an
exception, and if the Flash programmer tool does not have proper exception handler
implemented, it may cause the code execution to hang in the Flash programmer tool and
thus cause the erase operation to fail.
So to recover from this state, users need to be aware of possible Flash programmer tool
failure for erase operation caused by Flash ECC exception. Users can either use the
FlashErase function provided in the RPC56xx/SPC56xx C90FL Flash Standard Software
Driver to erase the interrupted Flash block(s), or use Nexus/JTAG debugger script to simply
toggle the low-level Flash register bits to perform the erase operation. Please refer to
Appendix A
for an example Lauterbach Trace32 script for erasing C90FL Flash.
2.2
Recover from depleted bits
It is also possible that a brownout during Flash erase operation leave the bits in the Flash
block(s) erased at an over-erased or depleted state. For instance, if the brownout occurs
after the erase step but before the compaction and software program step to complete, it is
possible to be left in that state.
Depending on how much depleted the bits are, the excessive column leakage caused by the
bits might cause the following program operation to fail due to suppressed drain bias. Note
that the first step in an erase operation is a program step, and thus for this case, the erase
operation to recover the interrupted Flash block(s) might fail. This appears to users as if the
Flash block(s) cannot be erased and recovered.
4/14
DocID025710 Rev 2