?? readme.stk500
字號:
$Id: README.stk500,v 1.1 2003/06/26 17:39:45 idgay Exp $NOTE: Atmel has finally released the specs for the protocol for talking to thestk500 over a serial line. Here's where to get the files: ftp://www.atmel.com/pub/atmel/avr061.zip http://www.atmel.com/atmel/acrobat/doc2525.pdfSTK500 Commands **preliminary information**---------------Extracted by Jason Kyle 20010701Updated 200201The latest version of this document can be found at www.avr1.org.Notes:- Incomplete but sufficient to make progress on free tools.- All commands are terminated by 0x20- All successful responses are framed 0x14 data 0x10 (i.e. NULL response is 0x14 0x10)- Commands invalid in current mode (i.e not in pgm mode, pgm page) give 0x14 0x13 response.STK500 BOARD COMMANDS---------------------** ?STK500Command 0x30 0x20Response 0x14 0x10Use Establish STK500 presence and UART sync. Re-send n times until response.Notes STK500 won't respond to other commands unless this has been sent.** BoardIDCommand 0x31 0x20Response 0x14 "AVR STK" 0x10Use Identify board.Notes** VTargetSetCommand 0x40 0x84 VTarget 0x20Response 0x14 0x10Use Set VTarget voltage.Notes 0x33 = 5.1V , 0x34 = 5.2V , 0x32 = 5.0V** ARefSetCommand 0x40 0x85 ARef 0x20Response 0x14 0x10Use Set ARef voltage.Notes Same count/V relationship as VTargetRead** POscSetCommand 0x40 0x86 POsc 0x20Response 0x14 0x10Use Set P parameter.Notes** NOscSetCommand 0x40 0x87 NOsc 0x20Response 0x14 0x10Use Set N parameter.Notes** SDOscSetCommand 0x40 0x89 SDOsc 0x20Response 0x14 0x10Use Set SD parameter.Notes** HWverCommand 0x41 0x80 0x20Response 0x14 0x02 0x10Use Hardware version identification.Notes** SWmajorCommand 0x41 0x81 0x20Response 0x14 0x01 0x10Use Software major version identification.Notes** SWminorCommand 0x41 0x82 0x20Response 0x14 0x07 0x10Use Software minor version identification.Notes** VTargetReadCommand 0x41 0x84 0x20Response 0x14 0x33 0x10Use Query present VTarget voltage.Notes 0x33 = 5.1V , 0x34 = 5.2V , 0x32 = 5.0V** ARefReadCommand 0x41 0x85 0x20Response 0x14 0x33 0x10Use Query present ARef voltage.Notes Same count/V relationship as VTargetRead** POscReadCommand 0x41 0x86 0x20Response 0x14 0x01 0x10Use Query present P parameter.Notes** NOscReadCommand 0x41 0x87 0x20Response 0x14 0x00 0x10Use Query present N parameter.Notes** SDOscReadCommand 0x41 0x89 0x20Response 0x14 0x01 0x10Use Query present SD parameter.Notes** DeviceParamCommand 0x42 (20 device specific bytes) 0x20Response 0x14 0x10Use Tell programmer how to program device, i.e data polling byte returns.Notes See table for more details** MagicNumberCommand 0x45 0x03 0x00 0xD7 0xA0 0x20Response 0x14 0x10Use Ask Atmel. Sent before entering programming mode.Notes This may well be a code checksum, software version requested first.STK500 PROGRAMMING COMMANDS---------------------------** EnterPgmModeCommand 0x50 0x20Response 0x14 0x10Use Enter programming mode, nRESET = low.Notes** LeavePgmModeCommand 0x51 0x20Response 0x14 0x10Use Leave programming mode, nRESET = high.Notes** EraseDeviceCommand 0x52 0x20Response 0x14 0x10Use Erase device.Notes** SetAddressCommand 0x55 AddrL AddrH 0x20Response 0x14 0x10Use Set address for read/write operationNotes Word address FLASH, Byte address EEPROM** UniversalCmdCommand 0x56 0xAC 0xFD 0x00 0xFF 0x20Response 0x14 0x00 0x10Use Sending lock and fuse bits.Notes Could probably be used for byte by byte programming of devices. The 0x00 returned is read from byte 4 SPI return value, i.e. if read program memory SPI command sent then this is the byte returned.** WriteMemoryCommand 0x64 LenH LenL 0x46 DataBytes 0x20Response 0x14 0x10Use Programming FLASH/EEPROM/PageBufferNotes Change 0x46 ("F") to 0x45 ("E") for EEPROM. Length in bytes. Written in 0x0100 chunks for 8515** ReadMemoryCommand 0x74 LenH LenL 0x46 0x20Response 0x14 DataBytes 0x10Use Reading FLASH/EEPROMNotes Change 0x46 ("F") to 0x45 ("E") for EEPROM. Length in bytes. Read in 0x0100 chunks for 8515.** GetSignatureCommand 0x75 0x20Response 0x14 0x1E 0x93 0x01 0x10Use Requesting device signature bytesNotes Response shown for 8515** ReadOscCalCommand 0x76 0x20Response 0x14 0x42 0x10Use Read current oscillator calibration valueNotes Varies between devices, 0x42 in an ATmega163L-4PI 0035COMMAND SEQUENCES-----------------Startup:?STK500 , BoardID , HWver , SWmajor , SWminorReadSignature:?STK500 , DeviceParam , SWminor , SWmajor, MagicNumber , EnterPgmMode ,GetSignature , LeavePgmModeWriteLockBits:?STK500 , DeviceParam , SWminor , SWmajor , MagicNumber , EnterPgmMode ,UniversalCmd , LeavePgmModeWriteMemory:?STK500 , DeviceParam , SWminor , SWmajor , MagicNumber , EnterPgmMode ,EraseDevice , SetAddress 0x0000 , PgmBlockMode n bytes , SetAddress 0x0000 ,ReadBlockMode n bytes , LeavePgmModeReadMemory:?STK500 , DeviceParam , SWminor , SWmajor , MagicNumber , EnterPgmMode ,SetAddress 0x0000 , ReadBlockMode n bytes , LeavePgmModeNormally memory is programmed or read in 0x0100 byte chunks, obviously if aprogram doesn't align to an 0x0100 length then there will be a < 0x0100 chunkat the end.Writing mega163. Set address to 0x0000, write 0x0100 bytes, set address to0x0080, write 0x0100 bytes etc... STK500 must auto detect end of page boundryand write current page to address specified in last setaddress cmd.Set device paramters and programming mode command for STK500851542 60 00 00 01 01 00 01 01 7f 7f 80 7f 00 00 02 00 00 00 20 00 20441442 50 00 00 01 01 00 01 01 7f 7f 80 7f 00 00 01 00 00 00 10 00 20231342 40 00 00 01 01 00 01 01 7f 7f 80 7f 00 00 00 80 00 00 08 00 20120042 33 00 00 01 01 00 01 01 ff ff 00 ff 00 00 00 40 00 00 04 00 20232342 41 00 00 00 01 00 01 01 ff ff 00 ff 00 00 00 80 00 00 08 00 20234342 43 00 00 00 01 00 01 01 ff ff 00 ff 00 00 00 80 00 00 08 00 20223342 42 00 00 01 01 00 01 01 ff ff 00 ff 00 00 00 80 00 00 08 00 20443342 51 00 00 01 01 00 01 01 ff ff 00 ff 00 00 01 00 00 00 10 00 20443442 52 00 00 01 01 00 01 01 ff ff 00 ff 00 00 01 00 00 00 10 00 20853542 61 00 00 01 01 00 01 01 ff ff 00 ff 00 00 02 00 00 00 20 00 20tiny1142 11 00 00 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 04 00 20tiny1242 12 00 00 00 01 01 01 01 ff ff ff ff 00 00 00 40 00 00 04 00 20tiny1542 13 00 00 00 01 01 01 01 ff ff ff ff 00 00 00 40 00 00 04 00 20tiny2242 20 00 00 00 01 00 01 01 ff ff 00 ff 00 00 00 80 00 00 08 00 20tiny2842 22 00 00 01 00 01 01 01 00 00 00 00 00 00 00 00 00 00 08 00 20mega3242 90 00 00 01 01 01 01 02 ff ff ff ff 00 80 04 00 00 00 80 00 20mega16142 80 00 00 01 01 01 01 01 ff ff ff ff 00 80 02 00 00 00 40 00 20mega16342 81 00 00 01 01 01 01 02 ff ff ff ff 00 80 02 00 00 00 40 00 20mega10342 b1 00 00 01 00 00 01 01 00 00 00 00 01 00 10 00 00 02 00 00 20mega12842 b2 00 00 01 01 01 01 03 ff ff ff ff 01 00 10 00 00 02 00 00 20
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -