Datasheet

10
AVR079
8133A-AVR-04/08
Table 4-7. Command format.
Field Size Values Description
Command ID 1 byte CMD_PROGRAM_FLASH_ISP Command id
NumBytes 2 byte Total number of bytes to program, MSB first
mode 1 byte XML: mode * Mode byte*
delay 1 byte XML: delay
Delay, used for different types of programming
termination, according to mode byte
cmd1 1 byte
Command 1 (Load Page, Write Program
Memory)
cmd2 1 byte Command 2 (Write Program Memory Page)
cmd3 1 byte Command 3 (Read Program Memory)
poll1 1 byte XML: pollVal1 Poll Value #1
poll2 1 byte XML: pollVal2 Poll Value #2 (not used for flash programming)
Data N bytes N data
Mode byte
The mode parameter is essential for how this command works. The bits in the mode
byte have the following meanings:
Table 4-8. Mode byte, bit descriptions.
Bit # Description Mode
0
Word/Page Mode
(0 = word, 1 =
page)
1 Timed delay
2 Value polling
3 RDY/BSY polling
Word Mode
4 Timed delay
5 Value polling
6 RDY/BSY polling
7 Write page
Page Mode
The Word/Page Mode bit selects if the device supports page programming or not.
The command bytes are different for word and page mode. In word mode, the ISP
commands Write Program Memory and Read Program Memory are used. In page
mode, Load Page, Write Program Memory Page and Read Program Memory are
used. The read instruction is used if Value Polling is specified in the mode bit. The
Low/High byte selection bit (3
rd
bit in the Load Page, Write Program Memory
commands) is handled by STK600, so leave this bit cleared. The instruction values
are found in the SPI Serial Programming Instruction Set found in the device
datasheet.
According to the mode, different termination methods are selected – Timed delay,
Value polling or RDY/BSY polling.
For paged operation, the Write page bit decides if a Write Program Memory Page
command should be issued after the data has been loaded into the page buffer. For