wordboot
stk500.h
Go to the documentation of this file.
1 /*
2  * This file is part of wordboot.
3  *
4  * wordboot is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * wordboot is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with wordboot. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
26 //**** ATMEL AVR - A P P L I C A T I O N N O T E ************************
27 //*
28 //* Title: AVR061 - STK500 Communication Protocol
29 //* Filename: command.h
30 //* Version: 1.0
31 //* Last updated: 09.09.2002
32 //*
33 //* Support E-mail: avr@atmel.com
34 //*
35 //**************************************************************************
36 
37 // *****************[ STK Message constants ]***************************
38 
39 #define STK_SIGN_ON_MESSAGE "AVR STK" // Sign on string for Cmnd_STK_GET_SIGN_ON
40 
41 // *****************[ STK Response constants ]***************************
42 
43 #define Resp_STK_OK 0x10 // ' '
44 #define Resp_STK_FAILED 0x11 // ' '
45 #define Resp_STK_UNKNOWN 0x12 // ' '
46 #define Resp_STK_NODEVICE 0x13 // ' '
47 #define Resp_STK_INSYNC 0x14 // ' '
48 #define Resp_STK_NOSYNC 0x15 // ' '
49 
50 #define Resp_ADC_CHANNEL_ERROR 0x16 // ' '
51 #define Resp_ADC_MEASURE_OK 0x17 // ' '
52 #define Resp_PWM_CHANNEL_ERROR 0x18 // ' '
53 #define Resp_PWM_ADJUST_OK 0x19 // ' '
54 
55 // *****************[ STK Special constants ]***************************
56 
57 #define Sync_CRC_EOP 0x20 // 'SPACE'
58 
59 // *****************[ STK Command constants ]***************************
60 
61 #define Cmnd_STK_GET_SYNC 0x30 // ' '
62 #define Cmnd_STK_GET_SIGN_ON 0x31 // ' '
63 #define Cmnd_STK_RESET 0x32 // ' '
64 #define Cmnd_STK_SINGLE_CLOCK 0x33 // ' '
65 #define Cmnd_STK_STORE_PARAMETERS 0x34 // ' '
66 
67 #define Cmnd_STK_SET_PARAMETER 0x40 // ' '
68 #define Cmnd_STK_GET_PARAMETER 0x41 // ' '
69 #define Cmnd_STK_SET_DEVICE 0x42 // ' '
70 #define Cmnd_STK_GET_DEVICE 0x43 // ' '
71 #define Cmnd_STK_GET_STATUS 0x44 // ' '
72 #define Cmnd_STK_SET_DEVICE_EXT 0x45 // ' '
73 
74 #define Cmnd_STK_ENTER_PROGMODE 0x50 // ' '
75 #define Cmnd_STK_LEAVE_PROGMODE 0x51 // ' '
76 #define Cmnd_STK_CHIP_ERASE 0x52 // ' '
77 #define Cmnd_STK_CHECK_AUTOINC 0x53 // ' '
78 #define Cmnd_STK_CHECK_DEVICE 0x54 // ' '
79 #define Cmnd_STK_LOAD_ADDRESS 0x55 // ' '
80 #define Cmnd_STK_UNIVERSAL 0x56 // ' '
81 
82 #define Cmnd_STK_PROG_FLASH 0x60 // ' '
83 #define Cmnd_STK_PROG_DATA 0x61 // ' '
84 #define Cmnd_STK_PROG_FUSE 0x62 // ' '
85 #define Cmnd_STK_PROG_LOCK 0x63 // ' '
86 #define Cmnd_STK_PROG_PAGE 0x64 // ' '
87 #define Cmnd_STK_PROG_FUSE_EXT 0x65 // ' '
88 
89 #define Cmnd_STK_READ_FLASH 0x70 // ' '
90 #define Cmnd_STK_READ_DATA 0x71 // ' '
91 #define Cmnd_STK_READ_FUSE 0x72 // ' '
92 #define Cmnd_STK_READ_LOCK 0x73 // ' '
93 #define Cmnd_STK_READ_PAGE 0x74 // ' '
94 #define Cmnd_STK_READ_SIGN 0x75 // ' '
95 #define Cmnd_STK_READ_OSCCAL 0x76 // ' '
96 #define Cmnd_STK_READ_FUSE_EXT 0x77 // ' '
97 #define Cmnd_STK_READ_OSCCAL_EXT 0x78 // ' '
98 
99 // *****************[ STK Parameter constants ]***************************
100 
101 #define Parm_STK_HW_VER 0x80 // ' ' - R
102 #define Parm_STK_SW_MAJOR 0x81 // ' ' - R
103 #define Parm_STK_SW_MINOR 0x82 // ' ' - R
104 #define Parm_STK_LEDS 0x83 // ' ' - R/W
105 #define Parm_STK_VTARGET 0x84 // ' ' - R/W
106 #define Parm_STK_VADJUST 0x85 // ' ' - R/W
107 #define Parm_STK_OSC_PSCALE 0x86 // ' ' - R/W
108 #define Parm_STK_OSC_CMATCH 0x87 // ' ' - R/W
109 #define Parm_STK_RESET_DURATION 0x88 // ' ' - R/W
110 #define Parm_STK_SCK_DURATION 0x89 // ' ' - R/W
111 
112 #define Parm_STK_BUFSIZEL 0x90 // ' ' - R/W, Range {0..255}
113 #define Parm_STK_BUFSIZEH 0x91 // ' ' - R/W, Range {0..255}
114 #define Parm_STK_DEVICE 0x92 // ' ' - R/W, Range {0..255}
115 #define Parm_STK_PROGMODE 0x93 // ' ' - 'P' or 'S'
116 #define Parm_STK_PARAMODE 0x94 // ' ' - TRUE or FALSE
117 #define Parm_STK_POLLING 0x95 // ' ' - TRUE or FALSE
118 #define Parm_STK_SELFTIMED 0x96 // ' ' - TRUE or FALSE
119 
120 
121 // *****************[ STK status bit definitions ]***************************
122 
123 #define Stat_STK_INSYNC 0x01 // INSYNC status bit, '1' - INSYNC
124 #define Stat_STK_PROGMODE 0x02 // Programming mode, '1' - PROGMODE
125 #define Stat_STK_STANDALONE 0x04 // Standalone mode, '1' - SM mode
126 #define Stat_STK_RESET 0x08 // RESET button, '1' - Pushed
127 #define Stat_STK_PROGRAM 0x10 // Program button, ' 1' - Pushed
128 #define Stat_STK_LEDG 0x20 // Green LED status, '1' - Lit
129 #define Stat_STK_LEDR 0x40 // Red LED status, '1' - Lit
130 #define Stat_STK_LEDBLINK 0x80 // LED blink ON/OFF, '1' - Blink
131 
132 
133 // *****************************[ End Of COMMAND.H ]**************************