avrdude error: out of sync

521 views Asked by At

I'm having problems uploading a simple hello world program to my Arduino Mega 2560. I checked whether it would work when using the IDE, and it does. I do not, however, want to use the IDE. (I had to chmod a+rw /dev/ttyACM0 to make it work, by the way.)

The error is well-known and much discussed on the net. None of the solutions I found so far apply to me though, because I'm using the makefile rather than the IDE, and I'm on Linux. The Makefile I'm using:

ARDUINO_DIR            = /usr/share/arduino
TARGET                 = test
ARDUINO_LIBS           =
MCU                    = atmega2560
F_CPU                  = 16000000
ARDUINO_PORT           = /dev/ttyACM0
AVRDUDE_ARD_BAUDRATE   = 115200
AVRDUDE_ARD_PROGRAMMER = arduino

include /usr/share/arduino/Arduino.mk

The source compiles fine, but during the upload-phase, avrdude is complaining:

/usr/share/arduino/hardware/tools/avr/../avrdude -q -V -D -p atmega2560 -C /usr/share 
/arduino/hardware/tools/avr/../avrdude.conf -c arduino -b 115200 -P /dev/ttyACM0 \
        -U flash:w:build-uno/test.hex:i
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00

I think this is a simple matter of having the flags set-up wrongly. Any ideas?

1

There are 1 answers

0
WestfW On

AVRDUDE_ARD_PROGRAMMER = arduino

the Arduino MEGA (atmega2560) uses a different bootloader than the Uno, and needs a different programmer type. Change "arduino" to "wiring" (or "stk500v2")