
AT32F413
Series Reference Manual
2022.06.27
Page 67
Rev 2.00
Address
Bit
Description
[31: 24]
nData3[7: 0]: Inverse code of Data3[7: 0]
0x1FFF_F818
[7: 0]
Data4[7: 0]: User data 4
[15: 8]
nData4[7: 0]: Inverse code of Data4[7: 0]
[23: 16]
Data5[7: 0]: User data 5
[31: 24]
nData5[7: 0]: Inverse code of Data5[7: 0]
0x1FFF_F81C
[7: 0]
Data6[7: 0]: User data 6
[15: 8]
nData6[7: 0]: Inverse code of Data6[7: 0]
[23: 16]
Data7[7: 0]: User data 7
[31: 24]
nData7[7: 0]: Inverse code of Data7[7: 0]
0x1FFF_F820
[7: 0]
EXT_FLASH_KEY0[7
:
0]
:
External memory ciphertext access area encryption
key byte 0
The situations for non-encryption includes:
Both EXT_FLASH_KEYx and nEXT_FLASH_KEYx are 0xFF (namely default
erase status)
Write 0x00 to EXT_FLASH_KEYx
Write 0xFF to EXT_FLASH_KEYx
That is, {nEXT_FLASH_KEYx, EXT_FLASH_KEYx } are all 0xFFFF, 0xFF00
and 0x00FF.
[15: 8]
nEXT_FLASH_KEY0[7: 0]: Inverse code of EXT_FLASH_KEY0[7: 0]
[23: 16]
EXT_FLASH_KEY1[7: 0]: External memory ciphertext encryption key byte 1
[31: 24]
nEXT_FLASH_KEY1[7: 0]: Inverse code of EXT_FLASH_KEY1[7: 0]
0x1FFF_F824
[7: 0]
EXT_FLASH_KEY2[7: 0]: External memory ciphertext encryption key byte 2
[15: 8]
nEXT_FLASH_KEY2[7: 0]: Inverse code of EXT_FLASH_KEY2[7: 0]
[23: 16]
EXT_FLASH_KEY3[7: 0]: External memory ciphertext encryption key byte3
[31: 24]
nEXT_FLASH_KEY3[7: 0]: Inverse code of EXT_FLASH_KEY3[7: 0]
0x1FFF_F828
[7: 0]
EXT_FLASH_KEY4[7: 0]: External memory ciphertext encryption key byte 4
[15: 8]
nEXT_FLASH_KEY4[7: 0]: Inverse code of EXT_FLASH_KEY4[7:0]
[23: 16]
EXT_FLASH_KEY5[7: 0]: External memory ciphertext encryption key byte 5
[31: 24]
nEXT_FLASH_KEY5[7: 0]: Inverse code of EXT_FLASH_KEY5[7: 0]
0x1FFF_F82C
[7: 0]
EXT_FLASH_KEY6[7: 0]: External memory ciphertext encryption key byte 6
[15: 8]
nEXT_FLASH_KEY6[7: 0]: Inverse code of EXT_FLASH_KEY6[7: 0]
[23: 16]
EXT_FLASH_KEY7[7: 0]: External memory ciphertext encryption key byte 7
[31: 24]
nEXT_FLASH_KEY7[7: 0]: Inverse code of EXT_FLASH_KEY7[7: 0]
5.2 Flash memory operation
5.2.1
Unlock/lock
After reset, main memory is protected, by default. FLASH_CTRL cannot be written. Write and erase
operation can be performed only when the Flash memory is unlocked.
Unlock procedure:
Flash memory block can be unlocked by writing KEY1 (0x45670123) and KEY2 (0xCDEF89AB) to the
FLASH_UNLOCKx register.
Note: Writing incorrect key sequence leads to a bus error and the Flash memory is also locked
until the next reset.
Lock procedure:
Flash memory block can be locked by setting the OPLK bit in the FLASH_CTRLx register.
5.2.2
Erase operation
Erase operation must be done before programming. Flash memory erase includes mass erase and page
erase.
Page erase
Any page in the Flash memory can be erased with page erase function. Below should be followed during
page erase:
Check the OBF bit in the FLASH_STS register to confirm that there is no other programming
operation in progress;
Write the page to be erased in the FLASH_ADDR register
Set the SECERS and ERSTR bit to 1 in the FLASH_CTRL register to enable page erase
Wait until the OBF bit becomes “0” in the FLASH_STS register. Read the EPPERR bit and ODF bit