
6
0943E–AVR–08/08
AVR910
Table 6 shows an example reading the Device Code from an AT90S1200.
Flash Program
Memory Access
When the part has been identified, it is time to start accessing the Flash memory. A Chip Erase
should be performed before programming the Flash memory. Depending on the target device
the Flash is programmed using “Byte” or “Page” mode.
For devices with Byte Programming mode each Flash location is dressed and programmed indi-
vidually. In Page Programming mode, a temporary Page buffer is first filled, and then
programmed in one single write cycle. This mode reduces the total Flash programming time. A
device will only have one of these modes available. A device with Byte Programming mode do
not have the Page Programming option. A device with Page Programming mode of the Flash
will, however, use byte programming for the EEPROM memory.
Regardless if the device uses Byte Programming mode or Page Programming mode the Flash
will be read one byte at the time using the “Read Flash Program Memory” command. The com-
mand sends a memory address ($aa bb) to select a 16-bit word, and selects low or high byte
with the H bit in the command byte (0 is low, 1 is high byte). The byte stored at this address is
then returned from the target AVR microcontroller in byte 4.
Usually, each 16-bit word in Flash contains one AVR instruction. Assuming the instruction stored
at address $104 is “add r16,r17”, the op-code for this instruction would be stored as $0F01.
Reading address $104 serially, the expected result returned in byte 4 will be $0F from the high
Table 4. Allowed Device Codes
Address
Code
Valid Codes
$00
Vendor Code
$1E indicates manufactured by Atmel
$00 indicates the device is locked, see below
$01
Part Family and Flash Size
$9n indicates AVR with 2
n
kB Flash memory
$02
Part Number
Identifies the part, see the file avr910.asm for a
complete listing of supported devices
Table 5. Part Number Identification Examples
Part Family and Flash Size
Part Number
Part
$90
$01
AT90S1200
$91
$01
AT90S2313
$92
$01
AT90S4414
$93
$01
AT90S8515
$FF
$FF
Device Code Erased (or Target Missing)
$01
$02
Device Locked
Table 6. Example, Reading the Device Code From an AT90S1200, Code $1E 90 01 Expected
Action
MOSI, Sent to
Target AVR
MISO, Returned from
Target AVR
Read Vendor Code at Address $00
$30 xx 00 yy
$zz 30 xx 1E
Read Part Family and Memory Size at $01
$30 nn 01 mm
$yy 30 nn 90
Read Part Number at Address $02
$30 xx 02 yy
$mm 30 xx 01