Im trying to start AVRUB with atmega 644P
and getting error like below (already checked connection with test.c):
> Start download
$ Send reset command: [7E ]
> Start connect
$ <1> Send connect key: 64
: 64 d
: 77 61 69 74 69 6E 67 20 66 6F 72 20 waiting for
: 64 61 74 61 2E 0D 0A data...
$ <2> Send connect key: 64
: 64 d
: 43 C
$ <3> Send connect key: 64
: 64 d
: 43 C
V Connect success
\
|
/
-
X Too many retry!
X Update fail
Clock: 18432000
Port:1
Direction Pin: PC5
Baud rate : 9600 8n1
hex size: 3659 bajts
Fuses:
Low: 0xDE
High: 0xD8
Extended: 0xFF
Config file:
#ifndef _BOOTCFG_H_
#define _BOOTCFG_H_ 1
//define uart buffer's length
#define BUFFERSIZE 128
//system clock(Hz)
#ifndef F_CPU
#define F_CPU 18432000UL
#endif
//baudrate
#define BAUDRATE 9600
//Boot section start address(byte)
//define BootStart to 0 will disable this function
#define BootStart 2 * 0x7000UL
//verify flash's data while write
//ChipCheck will only take effect while BootStart enable also
#define ChipCheck 1
//In SafeMode, it will not jump to user application till update successfully
#define SafeMode 1
//In SafeMode, it will set a flag in EEPROM
#define FlagAddr E2END
//Bootloader launch 0:comport password 1:port level
#define LEVELMODE 0
#define LEVELPORT D
#define LEVELPIN PD7
//port level 1:High 0:Low
#define PINLEVEL 0
//max wait password time = TimeOutCnt * timeclk
//timeout count
#define TimeOutCnt 10
//basic timer interval(ms)
#define timeclk 200
//max wait data time = TimeOutCntC * timeclk
//send 'C' command count
#define TimeOutCntC 50
//password length
#define CONNECTCNT 1
//password
#if LEVELMODE == 0
unsigned char ConnectKey[] = {0x64};
#endif
//comport number: 0/1/2..
#define COMPORTNo 1
//enable watchdog
#define WDG_En 0
//enable RS485/RS422 mode
#define RS485 1
//RS485/RS422 send control port
#define RS485PORT C
#define RS485TXEn PC5
//enable LED indication
#define LED_En 0
//LED control port
#define LEDPORT D
#define LEDPORTNo PD6
//some old kind of AVR need special delay after comport initialization
#define InitDelay 0
//communication checksum method 0:CRC16 1:add up
#define CRCMODE 0
//Verbose mode: display more prompt message
#define VERBOSE 1
//prompt messages
#if VERBOSE
#if LEVELMODE
const char msg6[] = "bootloader mode.";
const char msg7[] = "application mode.";
#else
//waiting for password
const char msg1[] = "waiting for password.";
#endif
//timeout
const char msg2[] = "timeout.";
//waiting for data
const char msg3[] = "waiting for data.";
//update success
const char msg4[] = "update success.";
//update fail
const char msg5[] = "update fail.";
#endif
//enable decrypt buffer
#define Decrypt 0
//crypt algorithm
//PC1_128, PC1 Cipher Algorithm with 128 bits key
#define PC1_128 1
//PC1_256, PC1 Cipher Algorithm with 256 bits key
#define PC1_256 2
//AES_128, AES Cipher Algorithm with 128 bits key
#define AES_128 3
//AES_256, AES Cipher Algorithm with 256 bits key
#define AES_256 4
#define Algorithm PC1_128
#if Decrypt
#if (Algorithm == PC1_128) || (Algorithm == AES_128)
//Define decrypt key: 128b
unsigned char DecryptKey[16] ={
0xD0, 0x94, 0x3F, 0x8C, 0x29, 0x76, 0x15, 0xD8,
0x20, 0x40, 0xE3, 0x27, 0x45, 0xD8, 0x48, 0xAD
};
#elif (Algorithm == PC1_256) || (Algorithm == AES_256)
//Define decrypt key: 256b
unsigned char DecryptKey[32] ={
0xD0, 0x94, 0x3F, 0x8C, 0x29, 0x76, 0x15, 0xD8,
0x20, 0x40, 0xE3, 0x27, 0x45, 0xD8, 0x48, 0xAD,
0xEA, 0x8B, 0x2A, 0x73, 0x16, 0xE9, 0xB0, 0x49,
0x45, 0xB3, 0x39, 0x28, 0x0A, 0xC3, 0x28, 0x3C
};
#endif
#endif
#endif
//End of file: bootcfg.h