3.3 Device Code

After the “Programming Enable” command has been successfully read by the SPI interface, the programmer can read the device code. The device code will identify the chip vendor (Atmel), the part family (AVR), Flash size in kilobytes, and family member (i.e., AT90S1200). The “Read Device Code” command format is found in the Serial Programming section of the datasheet. As an example, this command will, for the AT90S1200, be [$30, $XX, $adr, $code]. Valid addresses are $00, $01, and $02. The table below shows what the expected result will be.

The next table indicates that Device Code will sometimes read as $FF. If this happens, the part device code has not been programmed into the device. This does not indicate an error, but the part has to be manually identified to the programmer.

Device code $FF might also occur if there is no target ready or if the MISO line is constantly pulled high. The programmer can detect this situation by detecting that also a command sent to the target is returned as $FF.

If the target reports Vendor Code $00, Part Family $01, and Part Number $02, both Lock bits have been set. This prevents the memory blocks from responding, and the value returned will be the byte just received from the programmer, which just happens to be the current address. To erase the Lock bits, it is necessary to perform a valid “Chip Erase”.

Table 3-2. Allowed Device Codes
AddressCodeValid codes
$00Vendor Code

$1E indicates manufactured by Atmel.
$00 indicates the device is locked, see below.

$01Part Family and Flash Size$9n indicates AVR with 2n kB Flash memory
$02Part NumberIdentifies the part, see the file avr910.asm for a complete listing of supported devices
Table 3-3. Part Number Identification Examples
Part family and flash sizePart numberPart
$90$01AT90S1200
$91$01AT90S2313
$92$01AT90S4414
$93$01AT90S8515
$FF$FFDevice Code Erased (or Target Missing)
$01$02Device Locked
Table 3-4. Example, Reading the Device Code From an AT90S1200, Code $1E 90 01 Expected
ActionMOSI, sent to the target AVRMISO, returned from the 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