Datasheet

160
7701F–AVR–10/12
Atmel ATtiny24/44/84 [Preliminary]
20.4.1 EEPROM Write Prevents Writing to SPMCSR
Note that an EEPROM write operation will block all software programming to flash. Reading
the fuses and lock bits from software will also be prevented during the EEPROM write opera-
tion. It is recommended that the user check the status bit (EEPE) in the EECR register and
verify that the bit is cleared before writing to SPMCSR.
20.4.2 Reading the Lock and Fuse Bits from Software
It is possible to read both the lock and fuse bits from software. To read the lock bits, load the
Z-pointer with 0x0001 and set the RFLB and SPMEN bits in SPMCSR. When an LPM instruc-
tion is executed within three CPU cycles after the RFLB and SPMEN bits are set in SPMCSR,
the value of the lock bits will be loaded in the destination register. The RFLB and SPMEN bits
will auto-clear upon completion of reading the lock bits, or if no LPM instruction is executed
within three CPU cycles, or if no SPM instruction is executed within four CPU cycles. When
RFLB and SPMEN are cleared, LPM will work as described in the instruction set summary.
The algorithm for reading the fuse low byte (FLB) is similar to the one described above for
reading the lock bits. To read the fuse low byte, load the Z-pointer with 0x0000 and set the
RFLB and SPMEN bits in SPMCSR. When an LPM instruction is executed within three cycles
after the RFLB and SPMEN bits are set in the SPMCSR, the value of the fuse low byte will be
loaded in the destination register as shown below. See Table 21-5 on page 165 for a detailed
description and mapping of the fuse low byte.
Similarly, when reading the fuse high byte (FHB), load 0x0003 in the Z-pointer. When an LPM
instruction is executed within three cycles after the RFLB and SPMEN bits are set in the
SPMCSR, the value of the fuse high byte will be loaded in the destination register as shown
below. See Table 21-4 on page 164 for detailed description and mapping of the fuse high byte.
Lock and fuse bits that are programmed will be read as zero. Lock and fuse bits that are
unprogrammed, will be read as one.
20.4.3 Preventing Flash Corruption
During periods of low V
CC
, the Flash program can be corrupted because the supply voltage is
too low for the CPU and the Flash to operate properly. These issues are the same as for
board-level systems using flash, and the same design solutions should be applied.
Flash program corruption can occur for two reasons when the voltage is too low. First, a regu-
lar write sequence to the flash requires a minimum voltage to operate correctly. Secondly, the
CPU itself can execute instructions incorrectly if the supply voltage is too low.
Bit 76543210
Rd ––––––LB2LB1
Bit 76543210
Rd FLB7 FLB6 FLB5 FLB4 FLB3 FLB2 FLB1 FLB0
Bit 76543210
Rd FHB7 FHB6 FHB5 FHB4 FHB3 FHB2 FHB1 FHB0