BAT32G1x9 user manual | Chapter 35 FLASH control
1148 / 1149
Rev.1.02
35.4.2
Chip erase
chip erase, the erase time is implemented by hardware and can also be configured via FLCERCNT. The
operation process is as follows:
1)
Set up FLERMD. ERMD0 is 1'b 1, select chip erase mode;
2)
Set FLPROT to 0xF1 to de-protect FLOPMD. Then set FLOPMD1 to 0x55 and FLOPMD2 to 0xAA
3)
Write arbitrary data to any address in the flash area of the code.
4)
Software query status register FLSTS. OVF, when OVF=1, indicates that the erase operation is
complete.
5)
Before proceeding to the next operation, the software sets "1" to clear FLSTS.
35.4.3
Word program
word programming, write time is implemented by hardware and can also be configured via PROCNT. The
operation process is as follows:
1)
Set FLPROT to 0xF1 to de-protect FLOPMD. Then set FLOPMD1 to 0xAA and FLOPMD2 to 0x55
2)
Writes the appropriate data to the destination address.
3)
Software query status register FLSTS. OVF, when OVF=1, indicates that the write operation is
complete.
4)
Before proceeding to the next operation, the software sets "1" to clear FLSTS.
35.5 Flash read
The fastest finger frequency supported by flash built into this device is 32 MHz. When the HCLK
frequency exceeds 32MHz, the hardware inserts a 1 wait period when the CPU accesses flash.
35.6 Considerations for FLASH operations
⚫
Flash memory has strict time requirements for the control signal of erasing and programming operation,
and the timing of the control signal is not qualified, which will cause the erase operation and
programming operation to fail. The setting of the erase and write parameters can be implemented by
hardware, or it can be modified by modifying the parameter registers; When using internal high-speed
OCO, MAINOSC/ external input clock = 20M, it is recommended to use hardware-set erase and write
parameters without setting parameter registers.
⚫
If the wipe and write operation is performed from within FLASH, the CPU stops taking the finger and
the hardware automatically waits for the operation to complete before proceeding to the next
instruction. If the operation is performed from the RAM, the CPU does not stop taking the finger and
can now proceed to the next instruction.
⚫
While FLASH is in programming, if the CPU executes the instruction to enter a deep sleep, the system
will wait for the programming action to end before entering a deep sleep.