ADuCM310 Hardware Reference Manual
UG-549
Rev. C | Page 81 of 192
FLASH MEMORY OPERATION
Keyhole Access
Writing to flash is through keyhole access.
Keyhole access consists of the following:
•
Flash address
•
Flash data MMR
•
Command MMR
Top of Flash Blocks
The top six words of each flash block have special functionality as listed in Figure 16 and Figure 17. Therefore, normal code or data cannot
be placed here.
1
1461-
1
16
SIGNATURE. ADDRESS: 0x3FFFC
RESERVED. ADDRESS: 0x3FFF8
USER READ PROTECTION KEY 1. ADDRESS: 0x3FFF4
USER WRITE PROTECTION PATTERN 1 [31:0]. ADDRESS: 0x3FFF0
RESERVED. ADDRESS: 0x3FFEC
USERFAAKEY1 [31:0]. ADDRESS: 0x3FFE8
REST OF THE UPPERMOST PAGE IN USER SPACE
Figure 16. Uppermost Page in User Flash 1 Space
1
1461-
1
17
SIGNATURE. ADDRESS: 0x1FFFC
RESERVED. ADDRESS: 0x1FFF8
USER READ PROTECTION KEY 0. ADDRESS: 0x1FFF4
USER WRITE PROTECTION PATTERN 0 [31:0]. ADDRESS: 0x1FFF0
RESERVED. ADDRESS: 0x1FFEC
USERFAAKEY0 [31:0]. ADDRESS: 0x1FFE8
REST OF THE UPPERMOST PAGE IN USER SPACE
Figure 17. Uppermost Page in User Flash 0 Space
Writing to Flash
Each write programs 64 bits of data.
To write to a flash location, the following sequence is required:
1.
Write the address of the flash location to FEEFLADR.
2.
Write the 64 bits of data to FEEFLDATA0 and FEEFLDATA1.
3.
Write the write command to FEECMD.
After the write command is given, the controller writes to flash. CMDDONE (FEESTA[2]) indicates that the command is completed.
Note that a 64-bit location can be written to only once unless it is erased again.
Erasing Flash
User code can call the following three flash erase commands:
•
MASSERASE0: this command erases the entire user Flash 0 memory. After entering the user protection key into FEEKEY, write the
MASSERASE0 command to FEECMD.
•
MASSERASE1: this command erases the entire user Flash 1 memory. After entering the user protection key into FEEKEY, write the
MASSERASE1 command to FEECMD.
•
PAGEERASE: this command erases 2 kB of flash. The page is selected by FEEADR0. After entering the user protection key into
FEEKEY, load FEEADR0 with the page address to be erased. Finally, write the page erase command to FEECMD. CMDDONE
(FEESTA[2]) indicates that the command is complete.
During a page or mass erase sequence, the flash controller and flash block consume extra current for the duration of the flash erase sequence.