atmega323l ATMEL Corporation, atmega323l Datasheet - Page 183

no-image

atmega323l

Manufacturer Part Number
atmega323l
Description
Atmega323 8-bit Avr Microcontroller With 32k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
Store Program Memory
Control Register – SPMCR
1457G–AVR–09/03
Note that the page erase and page write operation is addressed independently. There-
fore it is of major importance that the Boot Loader software addresses the same page in
both the page erase and page write operation.
The LPM instruction also 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. See
page 16 for a detailed description.
The Store Program memory Control Register contains the control bits needed to control
the programming of the Flash from internal code execution.
• Bit 7 – Res: Reserved Bit
This bit is a reserved bit in the ATmega323 and always reads as zero. This bit should be
written to zero when writing SPMCR.
• Bit 6 – ASB: Application Section Busy
Before entering the Application section after a Boot Loader operation (Page Erase or
Page Write) the user software must verify that this bit is cleared. In future devices, this
bit will be set to “1” by page erase and page write. In ATmega323, this bit always reads
as zero.
• Bit 5 – Res: Reserved Bit
This bit is a reserved bit in the ATmega323 and always reads as zero. This bit should be
written to zero when writing SPMCR.
• Bit 4 – ASRE: Application Section Read Enable
Before re-entering the application section, the user software must set this bit together
with the SPMEN bit and execute SPM within four clock cycles.
• Bit 3 – BLBSET: Boot Lock Bit Set
If this bit is set at the same time as SPMEN, the next SPM instruction within four clock
cycles will set Boot Lock bits. Alternatively, an LPM instruction within five cycles will
read either the Lock bits or the Fuse bits. The BLBSET bit will auto-clear upon comple-
tion of the SPM or LPM instruction, or if no SPM, or LPM, instruction is executed within
four, respectively five, clock cycles.
• Bit 2 – PGWRT: Page Write
If this bit is set at the same time as SPMEN, the next SPM instruction within four clock
cycles executes page write, with the data stored in the temporary buffer. The page
address is taken from the high part of the Z-pointer. The data in R1 and R0 are ignored.
The PGWRT bit will auto-clear upon completion of a page write, or if no SPM instruction
is executed within four clock cycles. The CPU is halted during the entire page write
operation.
Bit
$37 ($57)
Read/Write
Initial Value
R
7
x
ASB
R
6
0
5
R
0
ASRE
R/W
4
0
BLBSET
R/W
3
0
PGWRT
R/W
2
0
ATmega323(L)
PGERS
R/W
1
0
SPMEN
R/W
0
0
SPMCR
183

Related parts for atmega323l