I wrote my code in Arduino IDE.Then i imported the .ino file to Atmel 7 studio.Next i build it and using the AVR dude i dumped .hex to arduino 2560 using ICSP pins on the board.
Now after the dump was successful.
As i need some changes in code .If i go back to Arduino IDE to upload file it says:
avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer An error occurred while uploading the sketch
May i find proper solution to this problem?? please
After uploading via ISP the bootloader has gone and the bootloader is necessary for uploading via USB/serial port.
You have to upload the bootloader back (via ISP of course) to repair this functionality.
Attached file? Post the commend you've used. Which programmer you have? More than 1hr? Something went really wrong. It has no sense to wait so long.
Start again from the beginning. Be consistent in proceeding. First of all test the communication between the ATmega and programmer. You can test it with readings or just "do nothing" or -v command from the CMD (modify the command from the log) because writes wear MCU's FLASH memory. Whole memory should be readable without errors.
Read avrdude help for meaning of particular switches.
What are you trying to flash? It should be .hex file and not 'any' file. Are sure that the temp file is intel hex? Did you check the command? The HEX has some format and if it is not HEX it obtains rubbish.
Try it directly from command line: avrdude -cUSBasp -pATmega2560 -vv for test if it can connect to the MCU**,** avrdude -cUSBasp -pATmega2560 -Uflash:w:filename.hex:i for write, use the bootloader hex.
Try and post an output.
avrdude: verification error, first mismatch at byte 0xe000
0xff != 0x0d
This is probably OK, and a consequence of your programming being not-quite smart enough to handle the 256k of memory (since it failed in "verify" rather than during write.) Can you upload sketches now?
It's also possible that your programmer was able to erase your 2560, but not re-program the bootloader
if i try to erase chip...programmer says "successful".
if i try to program any of the .hex file from the USBasp programmer it takes much longer time
and fails to upload.....and arduino 2560 board isn't responding at all but power led and led_pin13 is glowing.
May not be damaged. The L LED can glow due to oscillation on OA which drives LED. It can happen if the pin 13 is in tri-state so OA's input is in the 'air', e.g. no bootloader (raw chip symptom).
As @westfw wrote, it is possibe that your USBasp cannot handle 256k of memory. Check the web for similar problems, probably FW upgrade could solve it.
Try if it is able to upload ArduinoISP sketch to the Arduino via ISP. If yes, you could upgrade FW on the USBasp with the Arduino an then to bootload the Arduino with fixed USBasp. But be careful and check everything twice!!! Use readings first before you decide to write into USBasp!