29.4.3 Flash Commands

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

The commands are listed in the following table.

Table 29-1. Set of Commands
CommandValueMnemonic
Get Flash descriptor0x00GETD
Write page0x01WP
Write page and lock0x02WPL
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
Suspend0x17SUSP
Resume0x18RES
Send cryptographic key0x19SCK

In order 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 is automatically cleared, except for the GETD command. The FVALUE field in the Flash Result register (EEFC_FRR) is also automatically cleared. Once the current command has completed, the FRDY flag is automatically set, except for the STUI and STUS commands. If an interrupt was enabled by setting the bit EEFC_FMR.FRDY, the corresponding interrupt line of the interrupt controller is activated.

Write and Erase commands can be suspended by writing the Suspend (SUSP) command in EEFC_FCR. Only read access to the Flash is permitted during suspended commands. The suspended command can be later resumed by writing a Resume command (RES) in EEFC_FCR.

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 memory plane, but does set the FCMDE flag in the Flash Status register (EEFC_FSR). This flag is automatically cleared by a read access to EEFC_FSR.

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

Figure 29-7. Command State Chart