GD32F20x User Manual
49
2.3.6.
Main flash programming
The FMC provides a 32-bit word/16-bit half word programming function which is used to
modify the main flash memory contents. The following steps show the register access
sequence of the word programming operation.
Unlock the FMC_CTLx registers if necessary.
Check the BUSY bit in FMC_STATx registers to confirm that no flash memory operation
is in progress (BUSY equals to 0). Otherwise, wait until the operation has finished.
Set the PG bit in FMC_CTLx registers.
Write a 32-bit word/16-bit half word to desired absolute address (0x08XX XXXX) by
DBUS.
Wait until all the operations have been finished by checking the value of the BUSY bit in
FMC_STATx registers.
Read and verify the Flash memory by using a DBUS access if required.
When the operation is executed successfully, the ENDF in FMC_STATx registers is set, and
an interrupt will be triggered by FMC if the ENDIE bit in the FMC_CTLx registers is set. Note
that the word/half word programming operation checks the address if it has been erased. If
the address has not been erased, PGERR bit in the FMC_STATx registers will be set when
programming the address except 0x0. Note that the PG bit must be set before the word/half
word programming operation. Additionally, the program operation will be ignored on
erase/program protected pages and WPERR bit in FMC_STATx is set. In these conditions, a
flash operation error interrupt will be triggered by the FMC if the ERRIE bit in the FMC_CTLx
registers is set. The software can check the PGERR bit or WPERR bit in the FMC_STATx
registers to detect which condition occurred in the interrupt handler. The following
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...