GD32VF103 User Manual
37
Figure 2-3. Process of word program operation
Set the PG bit
Is the LK bit is 0
Perform word/half
word write by DBUS
Start
Yes
No
Unlock the
FMC_CTL
Is the BUSY bit is 0
Yes
No
Is the BUSY bit is 0
Yes
No
Finish
Note:
Reading the flash should be avoided when a program/erase operation is ongoing in the
same bank. And flash memory accesses failed if the CPU enters the power saving modes.
2.3.7.
Option bytes Erase
The FMC provides an erase function which is used to initialize the option bytes block in flash.
The following steps show the erase sequence.
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 finished.
Unlock the option bytes operation bits in FMC_CTL register if necessary.
Wait until OBWEN bit is set in FMC_CTL register.
Set OBER bit in FMC_CTL register.
Send the option bytes erase command to the FMC by setting the START bit in FMC_CTL
register.
Wait until all the operations have been finished by checking the value of the BUSY bit in
FMC_STAT register.
Read and verify the Flash memory if required using a DBUS access.