I'm working with moteino mega "an Arduino clone", I upload my codes using CP2102 USB to UART bridge and it was working fine. I uploaded the same exact code earlier with no problems. But I adjusted the code and tried to upload again and it gave me this error.
avrdude: stk500_cmd(): programmer is out of sync
avr_read(): error reading address 0x0000
avrdude: failed to read all of flash memory, rc=-2
I can upload codes from examples or other sketches but not my own code, not sure why. I tried almost all the stuff I have seen online other than re-flashing the bootloader since I don't want to solder header pins to my moteino because I have space issues in this project. Is there anything that I can do to fix this or is re-flashing the bootloader the solution?
here is the complete error message, the error "avrdude: stk500_cmd(): programmer is out of sync" was repeated so many more times in row in the message but I deleted them because of the maximum limit of words in the reply
Arduino: 1.6.8 (Windows 10), Board: "MoteinoMEGA"
Board arduino:avr:elisa3 doesn't define a 'build.board' preference. Auto-set to: AVR_ELISA3
Sketch uses 19,756 bytes (15%) of program storage space. Maximum is 130,048 bytes.
Global variables use 1,400 bytes (8%) of dynamic memory, leaving 14,984 bytes for local variables. Maximum is 16,384 bytes.
C:\Users\Ahmed\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\Ahmed\AppData\Local\Arduino15\packages\Moteino\hardware\avr\1.3.0/avrdude.conf -v -patmega1284p -carduino -PCOM4 -b115200 -D -Uflash:w:C:\Users\Ahmed\AppData\Local\Temp\build6039e417932bb23b549fc7c701d5e604.tmp/Garage-draft-2.ino.hex:i
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Ahmed\AppData\Local\Arduino15\packages\Moteino\hardware\avr\1.3.0/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega1284P
Chip Erase delay : 55000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 128 0 no 4096 8 0 9000 9000 0xff 0xff
flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 5.0
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9705 (probably m1284p)
avrdude: reading input file "C:\Users\Ahmed\AppData\Local\Temp\build6039e417932bb23b549fc7c701d5e604.tmp/Garage-draft-2.ino.hex"
avrdude: writing flash (19756 bytes):
Writing |
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x0a
avrdude: stk500_cmd(): programmer is out of sync
#avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_cmd(): programmer is out of sync
# | 100% 20.57s
avrdude: 19756 bytes of flash written
avrdude: verifying flash memory against C:\Users\Ahmed\AppData\Local\Temp\build6039e417932bb23b549fc7c701d5e604.tmp/Garage-draft-2.ino.hex:
avrdude: load data flash data from input file C:\Users\Ahmed\AppData\Local\Temp\build6039e417932bb23b549fc7c701d5e604.tmp/Garage-draft-2.ino.hex:
avrdude: input file C:\Users\Ahmed\AppData\Local\Temp\build6039e417932bb23b549fc7c701d5e604.tmp/Garage-draft-2.ino.hex contains 19756 bytes
avrdude: reading on-chip flash data:
Reading | avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x31
avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x32
avrdude: stk500_cmd(): programmer is out of sync
avr_read(): error reading address 0x0000
read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x0d
avrdude done. Thank you.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.