root/trunk/bootloader/command.h

Revision 21, 4.5 kB (checked in by charlie, 3 years ago)

Added Peter Fleury's GPL licensed bootloader

Line 
1 //**** ATMEL AVR - A P P L I C A T I O N   N O T E  ************************
2 //*
3 //* Title:              AVR068 - STK500 Communication Protocol
4 //* Filename:           command.h
5 //* Version:            1.0
6 //* Last updated:       31.01.2005
7 //*
8 //* Support E-mail:     avr@atmel.com
9 //*
10 //**************************************************************************
11
12 // *****************[ STK message constants ]***************************
13
14 #define MESSAGE_START                       0x1B        //= ESC = 27 decimal
15 #define TOKEN                               0x0E
16
17 // *****************[ STK general command constants ]**************************
18
19 #define CMD_SIGN_ON                         0x01
20 #define CMD_SET_PARAMETER                   0x02
21 #define CMD_GET_PARAMETER                   0x03
22 #define CMD_SET_DEVICE_PARAMETERS           0x04
23 #define CMD_OSCCAL                          0x05
24 #define CMD_LOAD_ADDRESS                    0x06
25 #define CMD_FIRMWARE_UPGRADE                0x07
26
27
28 // *****************[ STK ISP command constants ]******************************
29
30 #define CMD_ENTER_PROGMODE_ISP              0x10
31 #define CMD_LEAVE_PROGMODE_ISP              0x11
32 #define CMD_CHIP_ERASE_ISP                  0x12
33 #define CMD_PROGRAM_FLASH_ISP               0x13
34 #define CMD_READ_FLASH_ISP                  0x14
35 #define CMD_PROGRAM_EEPROM_ISP              0x15
36 #define CMD_READ_EEPROM_ISP                 0x16
37 #define CMD_PROGRAM_FUSE_ISP                0x17
38 #define CMD_READ_FUSE_ISP                   0x18
39 #define CMD_PROGRAM_LOCK_ISP                0x19
40 #define CMD_READ_LOCK_ISP                   0x1A
41 #define CMD_READ_SIGNATURE_ISP              0x1B
42 #define CMD_READ_OSCCAL_ISP                 0x1C
43 #define CMD_SPI_MULTI                       0x1D
44
45 // *****************[ STK PP command constants ]*******************************
46
47 #define CMD_ENTER_PROGMODE_PP               0x20
48 #define CMD_LEAVE_PROGMODE_PP               0x21
49 #define CMD_CHIP_ERASE_PP                   0x22
50 #define CMD_PROGRAM_FLASH_PP                0x23
51 #define CMD_READ_FLASH_PP                   0x24
52 #define CMD_PROGRAM_EEPROM_PP               0x25
53 #define CMD_READ_EEPROM_PP                  0x26
54 #define CMD_PROGRAM_FUSE_PP                 0x27
55 #define CMD_READ_FUSE_PP                    0x28
56 #define CMD_PROGRAM_LOCK_PP                 0x29
57 #define CMD_READ_LOCK_PP                    0x2A
58 #define CMD_READ_SIGNATURE_PP               0x2B
59 #define CMD_READ_OSCCAL_PP                  0x2C   
60
61 #define CMD_SET_CONTROL_STACK               0x2D
62
63 // *****************[ STK HVSP command constants ]*****************************
64
65 #define CMD_ENTER_PROGMODE_HVSP             0x30
66 #define CMD_LEAVE_PROGMODE_HVSP             0x31
67 #define CMD_CHIP_ERASE_HVSP                 0x32
68 #define CMD_PROGRAM_FLASH_HVSP              0x33
69 #define CMD_READ_FLASH_HVSP                 0x34
70 #define CMD_PROGRAM_EEPROM_HVSP             0x35
71 #define CMD_READ_EEPROM_HVSP                0x36
72 #define CMD_PROGRAM_FUSE_HVSP               0x37
73 #define CMD_READ_FUSE_HVSP                  0x38
74 #define CMD_PROGRAM_LOCK_HVSP               0x39
75 #define CMD_READ_LOCK_HVSP                  0x3A
76 #define CMD_READ_SIGNATURE_HVSP             0x3B
77 #define CMD_READ_OSCCAL_HVSP                0x3C
78
79 // *****************[ STK status constants ]***************************
80
81 // Success
82 #define STATUS_CMD_OK                       0x00
83
84 // Warnings
85 #define STATUS_CMD_TOUT                     0x80
86 #define STATUS_RDY_BSY_TOUT                 0x81
87 #define STATUS_SET_PARAM_MISSING            0x82
88
89 // Errors
90 #define STATUS_CMD_FAILED                   0xC0
91 #define STATUS_CKSUM_ERROR                  0xC1
92 #define STATUS_CMD_UNKNOWN                  0xC9
93
94 // *****************[ STK parameter constants ]***************************
95 #define PARAM_BUILD_NUMBER_LOW              0x80
96 #define PARAM_BUILD_NUMBER_HIGH             0x81
97 #define PARAM_HW_VER                        0x90
98 #define PARAM_SW_MAJOR                      0x91
99 #define PARAM_SW_MINOR                      0x92
100 #define PARAM_VTARGET                       0x94
101 #define PARAM_VADJUST                       0x95
102 #define PARAM_OSC_PSCALE                    0x96
103 #define PARAM_OSC_CMATCH                    0x97
104 #define PARAM_SCK_DURATION                  0x98
105 #define PARAM_TOPCARD_DETECT                0x9A
106 #define PARAM_STATUS                        0x9C
107 #define PARAM_DATA                          0x9D
108 #define PARAM_RESET_POLARITY                0x9E
109 #define PARAM_CONTROLLER_INIT               0x9F
110
111 // *****************[ STK answer constants ]***************************
112
113 #define ANSWER_CKSUM_ERROR                  0xB0
114
Note: See TracBrowser for help on using the browser.