This preview shows page 1. Sign up to view the full content.
Unformatted text preview: tails on available instructions, please refer to the Serial Programming section of the
datasheet. Enable Memory
Access When the Reset pin is first pulled active, the only instruction accepted by the SPI interface is
“Programming Enable”. Only this command will open for access to the Flash and EEPROM
memories, and without this access, any other command issued will be ignored. Table 3 shows
an example where memory access is enabled in the first command sent to the chip.
Table 3. Example, Enabling Memory Access and Erasing the Chip
MOSI, Sent to
Target AVR MISO, Returned from
Target AVR Programming Enable $AC 53 xx yy $zz AC 53 xx Read Device Code $1E at Address $00 $30 nn 00 mm $yy 30 nn 1E Action After a “Programming Enable” command has been sent to the target, access is given to the nonvolatile memories of the chip according to the current setting of the protecting Lock bits.
The target AVR microcontroller will not respond with an acknowledge to the “Programming
Enable” command. To check if the command has been accepted by the target AVR microcontroller, the device code could be read. The device code is also known as the signature bytes.
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. Table 4 shows what the expected result will be.
. Table 5 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 valued 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”. 5
0943E–AVR–08/08 Table 6 shows an example reading the Device Code from an AT90S1200.
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 2n kB Flash memory $02 Part Number Identifies the part, see the fil...
View Full Document
- Three '12