English
Language : 

C8051F52X Datasheet, PDF (107/220 Pages) Silicon Laboratories – 8/4/2 kB ISP Flash MCU Family
C8051F52x-53x
13. Flash Memory
On-chip, re-programmable Flash memory is included for program code and non-volatile data storage. The
Flash memory can be programmed in-system through the C2 interface or by software using the MOVX
write instruction. Once cleared to logic 0, a Flash bit must be erased to set it back to logic 1. Flash bytes
would typically be erased (set to 0xFF) before being reprogrammed. The write and erase operations are
automatically timed by hardware for proper execution; data polling to determine the end of the write/erase
operations is not required. Code execution is stalled during Flash write/erase operations. Refer to
Table 13.2 for complete Flash memory electrical characteristics.
13.1. Programming The Flash Memory
The simplest means of programming the Flash memory is through the C2 interface using programming
tools provided by Silicon Laboratories or a third party vendor. This is the only means for programming a
non-initialized device. For details on the C2 commands to program Flash memory, see Section “22. C2
Interface” on page 217.
To protect the integrity of Flash contents, the VDD monitor must be enabled to the higher setting
(VDMLVL = '1') and selected as a reset source if software contains routines which erase or write
Flash memory. If the VDD monitor is not enabled, any erase or write performed on Flash memory
will cause a Flash Error device reset.
The VDD monitor must be enabled before it is selected as a reset source. Selecting the VDD monitor
as a reset source before it is enabled and stabilized may cause a system reset. The procedure for re-
enabling the VDD monitor and configuring the VDD monitor as a reset source is shown below:
Step 1. Enable the VDD monitor (VDMEN bit in VDM0CN = ‘1’).
Step 2. Wait for the VDD monitor to stabilize (see Table 12.1 for the VDD Monitor turn-on time).
Note: This delay should be omitted if software contains routines which erase or
write Flash memory.
Step 3. Select the VDD monitor as a reset source (PORSF bit in RSTSRC = ‘1’).
13.1.1. Flash Lock and Key Functions
Flash writes and erases by user software are protected with a lock and key function. The Flash Lock and
Key Register (FLKEY) must be written with the correct key codes, in sequence, before Flash operations
may be performed. The key codes are: 0xA5, 0xF1. The timing does not matter, but the codes must be
written in order. If the key codes are written out of order, or the wrong codes are written, Flash writes and
erases will be disabled until the next system reset. Flash writes and erases will also be disabled if a Flash
write or erase is attempted before the key codes have been written properly. The Flash lock resets after
each write or erase; the key codes must be written again before a following Flash operation can be per-
formed. The FLKEY register is detailed in SFR Definition 13.2.
Rev. 0.3
107