Datasheet

ADE5166/ADE5169/ADE5566/ADE5569 Data Sheet
Rev. D | Page 112 of 156
Note that after the PROTKY has been activated by a reset, any
further changes to the protection require the new 8-bit protection
key to be written to the PROTKY SFR prior to issuing the ECON
command. The PROTKY SFR is cleared automatically when the
ECON 0x08 command is issued and, therefore, the user must
ensure that the correct value is written to the PROTKY SFR
each time that the protection scheme is changed.
The most significant bit of 0xF7FF is used to enable the lock
mechanism for the watchdog (see the Watchdog Timer section
for more information).
The following code provides an example of how the write/erase
protection can be enabled on the first page and the PROTKY set
to 0xA3. Note that to activate the following protection, the part
requires a reset.
; enable write/erase protection on the first
page only
MOV EDATA, #0FEH ; clear bit WP 0
MOV EADRL, #0F0H ; write address to F7F0h
MOV FLSHKY, #3BH ; enable flash access
MOV ECON, #08H ;issue protection
command
;enable write/erase protection on last page
(this is required for any protection to be
activated)
MOV EDATA, #0F7H ; clear bit WP123
MOV EADRL, #0FFH ; write address to F7FFh
MOV FLSHKY, #3BH ; enable flash access
MOV ECON, #08H ;issue protection
command
;set up PROTKY to A3h
MOV EDATA, #0A3H ; set PROTKY to A3h
MOV EADRL, #0EBH ; write address to F7EBh
MOV FLSHKY, #3BH ; enable flash access
MOV ECON, #08H ; issue protection
command
Note that after the PROTKY is changed to 0xA3, as shown in
the preceding example code, all future modifications of the pro-
tection scheme require that the PROTKY SFR be set to 0xA3
prior to issuing the ECON protection command.
07411-124
PROTKY
0xF600
0xF7EB
0xF7EF
0xF7FF
WDOG
LOCK
WP
123
WP
122
WP
121
WP
120
WP
115
WP
114
WP
113
WP
112
WP
119
WP
118
WP
117
WP
116
WP
107
WP
106
WP
105
WP
104
WP
111
WP
110
WP
109
WP
108
WP
11
WP
10
WP
9
WP
8
WP
15
WP
14
WP
13
WP
12
WP
3
WP
2
WP
1
WP
0
WP
7
WP
6
WP
5
WP
4
RP
108–111
RP
104–107
RP
100–103
RP
96–99
RP
64–67
RP
68–71
RP
72–75
RP
76–79
RP
80–83
RP
84–87
RP
88–91
RP
92–95
RP
32–35
RP
36–39
RP
40–43
RP
44–47
RP
48–51
RP
52–55
RP
56–59
RP
60–63
RP
0–3
RP
4–7
RP
8–11
RP
12–15
RP
16–19
RP
20–23
RP
24–27
RP
28–31
RP
120–123
RP
116–119
RP
112–115
PROTECTION KEY
Figure 96. Flash Protection in Page 124