![GigaDevice Semiconductor GD32E23 Series User Manual Download Page 44](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794044.webp)
GD32E23x User Manual
44
Current buffer:
The current buffer is always enabled. Each time read from flash memory, 64-bit data will be
get and store in current buffer. The CPU only need 32-bit or 16-bit in each read operation. So
in the case of sequential code, the next data can get from current buffer without repeat fetch
from flash memory.
Pre-fetch buffer:
The pre-fetch buffer is enabled by setting the PFEN bit in the FMC_WS register. In the case
of sequential code, when CPU executes the current buffer data (64-bit), 32-bit needs at least
2 clocks and 16-bit needs at least 4 clocks. In this case, pre-fetch the data of next
double-word address from flash memory and store to Pre-fetch buffer. So when the CPU
finishes the current buffer and needs execute the next data, the pre-fetch buffer hits.
2.3.3.
Unlock the FMC_CTL register
After reset, the FMC_CTL register is not accessible in write mode, except for the OBRLD bit,
which is used for reloading the option byte, and the LK bit in FMC_CTL register is 1. An
unlocking sequence consists of two write operations to the FMC_KEY register can open the
access to the FMC_CTL register. The two write operations are writing 0x45670123 and
0xCDEF89AB to the FMC_KEY register. After the two write operations, the LK bit in
FMC_CTL register is set to 0 by hardware. The software can lock the FMC_CTL again by
setting the LK bit in FMC_CTL register to 1. If there is any wrong operations on the
FMC_KEY register, the LK bit in FMC_CTL register will be set, and the FMC_CTL register
will be locked, then it will generate a bus error.
The OBPG bit and OBER bit in FMC_CTL are also protected by FMC_OBKEY register. The
unlocking sequence includes two write operations, which are writing 0x45670123 and
0xCDEF89AB to FMC_OBKEY register. And then set the OBWEN bit in FMC_CTL register
to 1. The software can set OBWEN bit to 0 to protect the OBPG bit and OBER bit in
FMC_CTL register again.
2.3.4.
Page erase
The FMC provides a page erase function which is used for initializing the contents of a main
flash memory page to a high state. Each page can be erased independently without affecting
the contents of other pages. The following steps show the access sequence of the register
for a page erase operation.
Unlock the FMC_CTL register if necessary.
Check the BUSY bit in FMC_STAT register to confirm that no flash memory operation is
in progress (BUSY equal to 0). Otherwise, wait until the operation has been finished.
Write the page address into the FMC_ADDR register.