Datasheet
219
ATtiny828 [DATASHEET]
8371A–AVR–08/12
1. Either, fill the buffer before a Page Erase:
1. Fill temporary page buffer
2. Perform a Page Erase
3. Perform a Page Write
2. Or, fill the buffer after Page Erase:
1. Perform a Page Erase
2. Fill temporary page buffer
3. Perform a Page Write
When using alternative 1, the boot loader provides an effective read-modify-write feature, which allows the user software
to first read the page, do the necessary changes, and then write back the modified data. If alternative 2 is used, it is not
possible to read the old data while loading since the page is already erased.
If only a part of the page needs to be changed, the rest of the page must be stored (for example in the temporary page
buffer) before the erase, and then be re-written.
The temporary page buffer can be accessed in a random sequence.
It is essential that the page address used in both the Page Erase and Page Write operation is addressing the same page.
21.8.1 Addressing the Flash During Self-Programming
The Z-pointer is used to address the SPM commands.
Since the Flash is organized in pages (see Table 94 on page 232), the Program Counter can be treated as having two
different sections. One section, consisting of the least significant bits, is addressing the words within a page, while the
most significant bits are addressing the pages. This is shown in Figure 92, below.
Bit 151413121110 9 8
ZH (R31) Z15 Z14 Z13 Z12 Z11 Z10 Z9 Z8
ZL (R30) Z7Z6Z5Z4Z3Z2Z1Z0
76543210