atmega161-4pi ATMEL Corporation, atmega161-4pi Datasheet - Page 115

no-image

atmega161-4pi

Manufacturer Part Number
atmega161-4pi
Description
8-bit Microcontroller With 16k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
EEPROM Write Prevents
Writing to SPMCR
Reading the Fuse and Lock
bits from Software
1228D–AVR–02/07
Note that an EEPROM write operation will block all software programming to Flash.
Reading the Fuse and Lock bits from software will also be prevented during the
EEPROM write operation. It is recommended that the user check the status bit (EEWE)
in the EECR Register and verify that the bit is cleared before writing to the SPMCR
Register.
It is possible to read both the Fuse and Lock bits from software. To read the Lock bits,
load the Z-pointer with $0001 and set the BLBSET and SPMEN bits in SPMCR. If an
LPM instruction is executed within three CPU cycles after the BLBSET and SPMEN bits
are set in SPMCR, the Lock bits will be written to the destination register. The BLBSET
and SPMEN bits will auto-clear upon completion of reading the Lock bits or if no
LPM/SPM instruction is executed within three/four CPU cycles. When BLBSET and
SPMEN are cleared, LPM will work as described in “Constant Addressing Using the
LPM Instruction” on page 16 and in the Instruction Set manual.
The algorithm for reading the Fuse bits is similar to the one described above for reading
the Lock bits. But when reading the Fuse bits, load $0000 in the Z-pointer. When an
LPM instruction is executed within three cycles after the BLBSET and SPMEN bits are
set in the SPMCR, the Fuse bits can be read in the destination register as shown below.
Fuse and Lock bits that are programmed will be read as zero.
Bit
Bit
7
7
BOOTRST
6
6
SPIEN
BLB12
5
5
BLB11
SUT
4
4
BLB02
3
3
CKSEL[2]
BLB01
2
2
ATmega161(L)
CKSEL[1]
LB2
1
1
CKSEL[0]
LB1
0
0
R0/Rd
R0/Rd
115

Related parts for atmega161-4pi