ATmega88PA Automotive Atmel Corporation, ATmega88PA Automotive Datasheet - Page 270

no-image

ATmega88PA Automotive

Manufacturer Part Number
ATmega88PA Automotive
Description
Manufacturer
Atmel Corporation
26.1.2
26.1.3
26.2
270
Addressing the Flash During Self-Programming
Atmel ATmega48PA/88PA/168PA [Preliminary]
Filling the Temporary Buffer (Page Loading)
Performing a Page Write
To write an instruction word, set up the address in the Z-pointer and data in R1:R0, write
“00000001” to SPMCSR and execute SPM within four clock cycles after writing SPMCSR. The
content of PCWORD in the Z-register is used to address the data in the temporary buffer. The
temporary buffer will auto-erase after a Page Write operation or by writing the RWWSRE bit in
SPMCSR. It is also erased after a system reset. Note that it is not possible to write more than
one time to each address without erasing the temporary buffer.
If the EEPROM is written in the middle of an SPM Page Load operation, all data loaded will be
lost.
To execute Page Write, set up the address in the Z-pointer, write “00000101” to SPMCSR and
execute SPM within four clock cycles after writing SPMCSR. The data in R1 and R0 is
ignored. The page address must be written to PCPAGE. Other bits in the Z-pointer must be
written to zero during this operation.
• The CPU is halted during the Page Write operation.
The Z-pointer is used to address the SPM commands.
Since the Flash is organized in pages (see
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
operations are addressed independently. Therefore it is of major importance that the software
addresses the same page in both the Page Erase and Page Write operation.
The LPM instruction uses the Z-pointer to store the address. Since this instruction addresses
the Flash byte-by-byte, also the LSB (bit Z0) of the Z-pointer is used.
Bit
ZH (R31)
ZL (R30)
Z15
Z7
15
7
Figure 27-3 on page
Z14
Z6
14
6
Z13
Z5
13
5
Z12
12
Z4
4
Table 28-11 on page
283. Note that the Page Erase and Page Write
Z11
11
Z3
3
Z10
10
Z2
2
299), the Program Counter
Z9
Z1
9
1
Z8
Z0
8
0
9223B–AVR–09/11

Related parts for ATmega88PA Automotive