ADE5166_08 AD [Analog Devices], ADE5166_08 Datasheet - Page 100

no-image

ADE5166_08

Manufacturer Part Number
ADE5166_08
Description
Single-Phase Energy Measurement IC with 8052 MCU, RTC, and LCD Driver
Manufacturer
AD [Analog Devices]
Datasheet
ADE5166/ADE5169
The lower 62 bytes are available to the user for program storage
or as nonvolatile data memory. They are segmented into 124 pages
of 512 bytes each. It is up to the user to decide which flash memory
is to be used for data memory. It is recommended that each page
be dedicated solely to program or data memory so that an
instance does not arise where the program counter is loaded
with data memory instead of an opcode from the program
memory or where program memory is erased to update a byte
of data memory.
The flash memory can be protected from read or write/erase access.
The protection is implemented in the upper page of user program
memory. The last sixteen bytes from this page are used to con-
figure the write/erase protection for each of the pages. The
remaining four bytes are used for configuring read protection of
the flash memory. The read protection is selected in groups of
four pages. Finally, there is a byte used to store the key required
for modifying the protection scheme. If any code protection is
required, the page of information memory must be write/erase
protected at a minimum.
Thus, it is recommended that if code protection is enabled, the
last page of user accessible flash memory should be used only to
store data that does not need modification in the field. If the
firmware requires protection and may need updating in the
future, the last page should be reserved for constants used by
the user code that do not require modification during
emulation or debug.
Page 0 through Page 122 are, therefore, available for general
program and data memory use. It is recommended that Page 123
be used for constants or code that do not require future modifica-
tions. Note that the last 20 bytes of page 123 are reserved for the
flash memory protection and are, therefore, unavailable to the user.
Rev. 0 | Page 100 of 148
USING THE FLASH MEMORY
The 62 bytes of flash memory are configured as 124 pages, each
comprising 512 bytes. As with the other ADE5166/ADE5169
peripherals, the interface to this memory space is via a group of
registers mapped in the SFR space. The flash data SFR, (EDATA,
Address 0xBC) holds the byte of data to be accessed. The byte of
flash memory is addressed via the EADRH SFR (Address 0xC7)
and the EADRL SFR (Address 0xC6).
Table 103. Flash SFRs
SFR
ECON
FLSHKY
PROTKY
EDATA
EADRL
EADRH
ECON is an 8-bit flash control SFR (Address 0xB9) that can be
written to with one of five flash memory access commands to
trigger various read, write, erase, and verify functions. Figure 89
demonstrates the steps required for access to the flash memory.
EADRH
PROTECTION KEY
Figure 89. Flash Memory Read/Write/Erase Protection Block Diagram
FLSHKY
EADRL
ADDRESS
FLASH
Address
0xBA
0xBB
0xBC
0xC6
0xC7
0xB9
DECODER
ADDRESS
FLSHKY = 0x3B?
COMMAND
0xFF
0xFF
Default
0x00
0x00
0x00
0x00
PROTECTION
DECODER
ECON
Bit
Addressable
No
No
No
No
No
No
ALLOWED?
ACCESS
Description
Flash control
Flash key
Flash
protection key
Flash data
Flash low byte
address
Flash high byte
address
TRUE: ACCESS
FALSE: ACCESS
ALLOWED
ECON = 0
DENIED
ECON = 1

Related parts for ADE5166_08