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”.
Address | Code | Valid codes |
---|---|---|
$00 | Vendor Code |
$1E indicates manufactured by Atmel. |
$01 | Part Family and Flash Size | $9n indicates AVR with 2n kB Flash memory |
$02 | Part Number | Identifies the part, see the file avr910.asm for a complete listing of supported devices |
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 |
Action | MOSI, sent to the target AVR | MISO, 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 |