Datasheet

Table Of Contents
Figure 28-3. Addressing the Flash During SPM
(1)
PROGRAM MEMORY
0115
Z - REGISTER
BIT
0
ZPAGEMSB
WORD ADDRESS
WITHIN A PAGE
PAGE ADDRESS
WITHIN THE FLASH
ZPCMSB
INSTRUCTION WORD
PAGE
PCWORD[PAGEMSB:0]:
00
01
02
PAGEEND
PAGE
PCWORDPCPAGE
PCMSB
PAGEMSB
PROGRAM
COUNTER
Note: 
1. Fo the different variables used in the figure, see the table of the different variables used and the
Mapping to the Z-pointer in the boot loader parameters section.
2. PCPAGE and PCWORD are listed in table Number of Words in a Page and number of Pages in the
Flash in the Signal Names section.
Related Links
Signal Names on page 331
ATmega32A Boot Loader Parameters on page 323
28.8. Self-Programming the Flash
The program memory is updated in a page by page fashion. Before programming a page with the data
stored in the temporary page buffer, the page must be erased. The temporary page buffer is filled one
word at a time using SPM and the buffer can be filled either before the Page Erase command or between
a Page Erase and a Page Write operation:
Alternative 1, fill the buffer before a Page Erase
Fill temporary page buffer
Perform a Page Erase
Perform a Page Write
Alternative 2, fill the buffer after Page Erase
Perform a Page Erase
Atmel ATmega32A [DATASHEET]
Atmel-8155I-ATmega32A_Datasheet_Complete-08/2016
317