Datasheet

216
ATtiny828 [DATASHEET]
8371A–AVR–08/12
21.4.1 RWW – Read-While-Write Section
When the boot loader is programming a page inside the RWW section, it is possible to read code from the Flash, but only
code that is located in the NRWW section.
During programming, the software must ensure that the RWW section is not read. If the software during programming
tries to read code located inside the RWW section (i.e., by a call/jmp/lpm or an interrupt), it may end up in an unknown
state. To avoid this, interrupts should either be disabled or moved to the BLS, which is always located in the NRWW
section. The RWW Section Busy bit (RWWSB) in the Store Program Memory Control and Status Register (SPMCSR) is
set as long as the RWW section is blocked for reading. After a programming is completed, the RWWSB must be cleared
by software before reading code located in the RWW section.
21.4.2 NRWW – No Read-While-Write Section
Code located in the NRWW section can be read when the boot loader is updating a page in the RWW section. When the
boot loader updates the NRWW section, the CPU is halted during the entire Page Erase or Page Write operation.
21.5 Entering the Boot Loader Program
Entering the boot loader takes place by a jump or call from the application program. This may be initiated by a trigger,
such as a command received via USART, or SPI. Alternatively, the Boot Reset fuse (BOOTRST) can be programmed so
that the reset vector is pointing to the boot loader start address, in which case the boot loader is started after a reset. See
Table 80, below.
Table 80. Boot Reset Fuse
Note: 1. “1” means unprogrammed, “0” means programmed
After the application code has been loaded, the boot program can start executing the application code.
Note that fuses cannot be changed by the MCU itself. This means that once the BOOTRST fuse is programmed, the
reset vector will always point to the boot loader and the fuse can only be changed through the serial or parallel
programming interface.
21.6 Configuring the Boot Loader
Read-While-Write (RWW) and No Read-While-Write(NRWW) sections of the Flash are constant, as shown in Table 81.
For details on these two sections, see “Read-While-Write and No Read-While-Write Flash Sections” on page 214.
Table 81. Read-While-Write and No Read-While-Write Sections of the Flash
The size of application and boot loader sections can be changed, as shown in Table 82 on page 217.
BOOTRST
(1)
Reset Vector
1 Application reset address (0x0000)
0 Boot loader (see Table 82 on page 217)
Section Flash Pages Address
Read-While-Write section (RWW) 96 0x000 - 0xBFF
No Read-While-Write section (NRWW) 32 0xC00 - 0xFFF