29.2.2 Memory Layout
A single logical RWW EEPROM page is physically stored as the page content and a header inside a single physical page, as shown in Figure 29-2.
Note: In the following memory layout example, each physical row stores the contents of one logical RWW EEPROM page. Refer to "AT03265: SAM EEPROM Emulator Service (EEPROM)" for the example of two logical EEPROM pages in one row.
Within the RWW EEPROM memory reservation section at the top of the NVM memory space, this emulator will produce the layout as shown in Figure 29-3 when initialized for the first time.
When a RWW EEPROM page needs to be committed to physical memory, the next free page in the same row will be chosen. This makes recovery simple, as the right-most version of a logical page in a row is considered the most current. With four pages to a physical NVM row, this allows for up to four updates to the same logical page to be made before an erase is needed. Figure 29-4 shows the result of the user writing an updated version of logical EEPROM page N-1 to the physical memory.
A second write of the same logical RWW EEPROM page results in the layout shown in Figure 29-5.
A third write of the same logical RWW EEPROM page results in the layout shown in Figure 29-6.
A fourth write of the same logical page requires that the RWW EEPROM emulator erase the row, as it has become full. Prior to this, the content of the unmodified page in the same row as the page being updated will be copied into the spare row, along with the new version of the page being updated. The old (full) row is then erased, resulting in the layout shown in Figure 29-7.