AVRDUDE trouble shoot

I am trying to load one of the examples through the command prompt and I get the following

C:\Users\jhsieh>avrdude -c wiring -p m2560 -P COM11 -U flash:w:blink.cpp.hex

avrdude: AVR device initialized and ready to accept instructions

Reading : ############################################## : 100% 0.03s

avrdude: Device signiture = 0x1e9801
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

                   To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: stk500v2_command(): command failed

avrdude done. Thank you.

I am using an Arduino Mega 2560, connected through USB

I had the same problem and I fixed it by adding "-D" to avrdude (disable the erase cycle to the FLASH). Maybe we have a broken FLASH or something?

The IDE uses the -D option, because the bootloader takes care of erasing each page before writing. You probably need to add the Baud rate option, -b115200.

C:\Users\jhsieh>avrdude -c wiring -p m2560 -P COM11 -b115200 -D -v -U flash:w:blink.cpp.hex