Atmel ATSTK500 500 Starter kit and development system. ATSTK500 ATSTK500 Hoja De Datos

Los códigos de productos
ATSTK500
Descargar
Página de 31
28
AVR061 
2525B–AVR–04/03
Devices Combining the 
Fuse and Lock Bits on 
Readback
Some devices combine readback of the the Fuse and Lock bits in the same command
and response. The proper command to use is the Cmnd_STK_READ_LOCK command.
The parts currently using this combined approach are:
AT90S1200
AT90S2313
AT90S2323
AT90S2343
AT90S4414
AT90S8515
AT90S4434
AT90S8535
ATtiny22
Check the pseudo-code in the following sections for comments on how to extract the
Fuse bits and Lock bits from the returned value.
Reading and Writing the 
Fuse and Lock Bits in 
Serial Mode
Writing and reading the Lock bits and Fuse bits in Serial mode is currently done using
the Cmnd_STK_UNIVERSAL command. This command requires that the ISP com-
mands is properly formatted from the PC. These commans are not all of the simple kind.
The following pseudo-code sections illustrates how the Cmnd_STK_UNIVERSAL com-
mand may be used. The function:
UniversalCommand(UCHAR byte1, UCHAR byte2, UCHAR byte3, UCHAR *byte4) 
is used in the pseudo-code. byte1 - byte4 should be set to contain the bitstream giving
the command and data. On return, byte4 will contain the last eight bit of the clocked-out
bitstream from the ISP interface. See the description of the Cmnd_STK_UNIVERSAL
command in earlier sections for more details.
Reading the Lock Bits
if (m_pDevice->ucLockBytes >= 1)
UniversalCommandNew(0x58, 0, 0, &data)
// Some parts combine Fuses and Locks in same byte on readback. To get the
// correct Lock bits from these parts, we need to mask away the bits that are
// not Lock bits. We also shift the Lock bits to the position described in the 
// lock bits appendix section.
// Note: The same masking of the data must be done when reading the Lock bits
// in Parallell mode.
if (part does combine Fuse and Lock bits)
{
lock_byte = 0xff;
if (! (data & 0x80))
lock_byte &= 0xfd;
if (! (data & 0x40))
lock_byte &= 0xfb;
}