
378
SAM G51 [DATASHEET]
11209C–ATARM–20-Dec-13
19.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, etc.
In order to perform one of these commands, the Flash Command register (EEFC_FCR) must be written with the correct
command using the FCMD field. 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 is achieved, then the FRDY flag is
automatically set. If an interrupt has been enabled by setting the FRDY bit in EEFC_FMR, the corresponding interrupt
line of the interrupt controller is activated. (Note that this is true for all commands except for the STUI Command. The
FRDY flag is not set when the STUI command is achieved.)
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.
Table 19-2.
Set of Commands
Command
Value
Mnemonic
Get Flash descriptor
0x00
GETD
Write page
0x01
WP
Write page and lock
0x02
WPL
Erase page and write page
0x03
EWP
Erase page and write page then lock
0x04
EWPL
Erase all
0x05
EA
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