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.
| Command | Value | Mnemonic |
|---|---|---|
| Get Flash descriptor | 0x00 | GETD |
| Write page | 0x01 | WP |
| Write page and lock | 0x02 | WPL |
| Erase pages | 0x07 | EPA |
| Set lock bit | 0x08 | SLB |
| Clear lock bit | 0x09 | CLB |
| Get lock bit | 0x0A | GLB |
| Set GPNVM bit | 0x0B | SGPB |
| Clear GPNVM bit | 0x0C | CGPB |
| Get GPNVM bit | 0x0D | GGPB |
| Start read unique identifier | 0x0E | STUI |
| Stop read unique identifier | 0x0F | SPUI |
| Get CALIB bit | 0x10 | GCALB |
| Erase sector | 0x11 | ES |
| Write user signature | 0x12 | WUS |
| Erase user signature | 0x13 | EUS |
| Start read user signature | 0x14 | STUS |
| Stop read user signature | 0x15 | SPUS |
| Suspend | 0x17 | SUSP |
| Resume | 0x18 | RES |
| Send cryptographic key | 0x19 | SCK |
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.
