22.4.3 Flash Commands

The EEFC offers a set of commands to manage programming the Flash memory, locking and unlocking lock regions, consecutive programming, locking and full Flash erasing, and so on.

The commands are listed in the following table.

Table 22-1. Set of Commands
CommandValueMnemonic
Get Flash Descriptor0x00GETD
Write Page0x01WP
Write Page and Lock0x02WPL
Erase Page and Write Page0x03EWP
Erase Page and Write Page and then Lock0x04EWPL
Erase All0x05EA
Erase Pages0x07EPA
Set Lock Bit0x08SLB
Clear Lock Bit0x09CLB
Get Lock Bit0x0AGLB
Set GPNVM Bit0x0BSGPB
Clear GPNVM Bit0x0CCGPB
Get GPNVM Bit0x0DGGPB
Start Read Unique Identifier0x0ESTUI
Stop Read Unique Identifier0x0FSPUI
Get CALIB Bit0x10GCALB
Erase Sector0x11ES
Write User Signature0x12WUS
Erase User Signature0x13EUS
Start Read User Signature0x14STUS
Stop Read User Signature0x15SPUS

To execute one of these commands, select the required command using the FCMD field in the Flash Command register (EEFC_FCR). As soon as EEFC_FCR is written, the FRDY flag and the FVALUE field in the Flash Result register (EEFC_FRR) are automatically cleared. Once the current command has completed, the FRDY flag is automatically set. If an interrupt has been enabled by setting the bit EEFC_FMR.FRDY, the corresponding interrupt line of the interrupt controller is activated (This is true for all commands except for the STUI command. The FRDY flag is not set when the STUI command has completed).

All the commands are protected by the same keyword, which must be written in the eight highest bits of EEFC_FCR.

Writing EEFC_FCR with data that does not contain the correct key and/or with an invalid command has no effect on the whole memory plane, but the FCMDE flag is set in the Flash Status register (EEFC_FSR). This flag is automatically cleared by a read access to EEFC_FSR.

When the current command writes or erases a page in a locked region, the command has no effect on the whole memory plane, but the FLOCKE flag is set in EEFC_FSR. This flag is automatically cleared by a read access to EEFC_FSR.

Figure 22-7. Command State Chart