User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 38
www.energymicro.com
Write 0xFFFFAAAA (word in flash becomes 0xFFFFAAAA)
Write 0x5555FFFF (word in flash becomes 0x5555AAAA)
Note
During a write or erase, flash read accesses not subject to read-while-write will be stalled,
effectively halting code execution from flash. Code execution continues upon write/
erase completion. Code residing in RAM may be executed during a write/erase operation
regardless of whether read-while-write is enabled or not.
7.3.6.1 Double-Word Writes
Parts with 512 kB flash or more have the ability to do double writes to the flash. This is enabled by setting
WDOUBLE in MSC_WRITECTRL, and only has effect on the main pages of the flash. When double
writes are enabled, MSC_WDATA accepts two words before a flash write is started. This is signaled
by WDATAREADY in MSC_STATUS going high again after the first word is written. When the second
word is written, the actual write begins.
7.3.6.2 Low-Power Erase
Parts with 512 KB flash or more consume twice the amount of current while doing erase operations. To
limit maximum current, the erase operation can be slowed down. Set LPERASE in MSC_WRITECTRL
to double the erase time, halving the erase current.
7.3.6.3 Low-Power Write
Parts with 512 KB flash or more consume twice the amount of current while doing write operations. To
limit maximum current, write operations can be slowed down by setting LPWRITE in MSC_WRITECTRL.
For single-word writes, this has no effect on write time, but for consecutive writes, the write-time doubles.
LPWRITE cannot be set while WDOUBLE is set.
7.3.6.4 Read-While-Write
Parts with 512 KB flash or more have the ability to read from the flash while writing to it. On these parts,
reading from the lower half of the flash is possible while writing/erasing from the upper half of the flash
and vice versa. Enable read-while-write by setting RWWEN in MSC_WRITECTRL.
The information pages can be written and erased while running from the lower half of the flash
7.3.6.5 Mass erase
A mass erase can be initiated from software using ERASEMAIN0 and ERASEMAIN1 in
MSC_WRITECMD. These commands will for devices supporting read-while-write start a masserase
on the lower and upper half of the flash respectively. For devices not supporting read-while-
write, MASSERASE0 will start a mass erase of the entire flash. Prior to initiating a mass erase,
MSC_MASSLOCK must be unlocked by writing 0x631A to it. After a mass erase has been started, this
register can be locked again to prevent runaway code from accidentally triggering a mass erase.
The regular flash page lock bits will not prevent a mass erase. To prevent software from initiating mass
erases, use the mass erase lock bits in the mass erase lock word (MLW).