3D Robotics

Arduino debugging tips


If you're trying to upload code with Arduino and you get an error message that looks something like this:
"Problem uploading code.....

avrdude: stk500_getsync(): not in sync: resp=0x78
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x78"

(or any other error report when uploading code, aside from the obvious ones like compile errors or choosing the wrong serial port)

Here are the most common causes and things to check.

  1. Did you check the "Set RTS on close" box in the Windows Com port, as instructed in the manual?
  2. Are you selecting the right board? For ArduPilotMega, if your board uses an ATMega1280 processor (the big chip on the APM board will say "ATmega1280") select "Arduino Mega (Atmega1280)". If you've got an ATMega2560 chip, select "Arduino Mega 2560". For the original ArduPilot and ArduIMU, choose "Arduino Duemilanove".
  3. Is the cable plugged into a USB hub? That can sometimes cause trouble. Try plugging it straight into your PC.
  4. Are you using the latest FTDI drivers? Install them if not. If you're still having trouble, try reinstalling them.
  5. Check your solder joints! It's a good idea to reheat and reflow all of the ones you did, just to be sure.
  6. Other errors that have caused this problem in the past include a power source (such as your ESC) that is putting out a voltage outside the acceptable range of 4-7v, faulty USB or FTDI cables, and corrupted FTDI drivers. When in doubt, try a different power source, a different cable or a different PC.

Additional things to check if you're using the original ArduPilot board (not ArduPilotMega):

  1. [For original ArduPilot board only] Is your FTDI cable plugged in the right way? The black wire or side marked "black" should be on ArduPilot's BLK pin.
  2. [For original ArduPilot board only] Are you using the DIYDrones or Adafruit FTDI cable? We've had trouble with other ones...
  3. [For original ArduPilot board only] Is the ArduPilot board powered on, ideally through your RC system or ESC? (You can NOT power it from the FTDI cable; this is a safety measure to avoid power conflicts.)

If those all look fine and you're still getting the error message (especially if you can successfully load code to other Arduino boards), you may have a corrupted FTDI driver or a bad FTDI cable. Try reinstalling on another PC and see if that does the trick. If it doesn't, you may need a replacement FTDI cable.

In some rare cases, a power glitch may have resulted in a corrupted ArduPilot bootloader on the ATMega chip. This tutorial will show you how to reload the bootloader. (Warning--for experts only and requires an AVR programmer. This should not be necessary for most people.)

Other problems can include "Serial port not found" (just check that you've selected the right serial port in the Tools menu. It's the one assigned when you first plugged in the FTDI cable--probably 5 or higher), and the Arduino IDE freezing (try unplugging the FTDI cable. If that doesn't work, just reboot your computer).
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • Hi Guys

    After installing  APM version of the Aruino IDE 1.0.3 and uploadet the 3.06 code i'm having serious problems.

    It's completely dead. Only the yellow LED is on.  

    And my APM 2.5 is now sending me garbage back when i connect it to MP i CLI mode. (But Yellow LED blinks when uploading from MP. But at the end it has a error saying ""Upload succeeded but verify failed: exp 2 got 26 at 78".

    And if i try to upload ANY Arduino sketch to it, i'm' getting errors return, saying it cannot confirm the uploaded code.

    And it just "came out of the blue sky" when i was programming it. 

    Is it fried or is there still hope .... Any suggestions  ?


  • Hello Chris. I have many difficulties to install APM. Arduino at the error that appears is this: variable or field 'run_cli' declared void. I've tried in several ways without success. You can give me a hint?

  • Good Day Everyone,

    I recently downloaded the arduIMU ver 1.9.8 at the repository. Also downloaded the arduino 1.0.3 in ardupilot site.

    While compiling I'm having this error.

    C:\Users\JA185141\Documents\Arduino\libraries\FastSerial/FastSerial.h:105: error: conflicting return type specified for 'virtual void FastSerial::write(uint8_t)'
    C:\Users\JA185141\Downloads\android\ArduPilot-Arduino-1.0.3-windows\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'

    please help.

  • Admin


    You may not be using the correct version of the Aruino IDE 1.0.3 to compile the code. Try this compiler: http://code.google.com/p/ardupilot-mega/downloads/detail?name=ArduP...



  • I am a first time Arduino user compiling copter 2.9.1 and got two error messages:

    Undefined reference to ‘setup’

    Undefined reference to ‘loop’


    What did I do wrong?


  • These are the warnings


  • Have I got this right?

    Have done the basic steps as described here.


    Am trying to edit the motor direction in motors library – so, have done that OK (who knows!) and re-save the AP_MotorsQuad.cpp – is that right?

    Then load Arducopter.PDE and try to verify (have not tried connecting APM yet).

    Am getting a few warnings – mostly concerning heli stuff. Should there be NO warnings at all?

    I guess if Im getting verify errors then there will also be upload errors?


    Any tips appreciated.


  • Question - I too am getting compile errors even after implementing all the tips I've read.  Do you have to have anything hooked up to just compile the code?

  • i cant downgrade  apm1 to fly my quad again i tried with arduino software but nothing

  • I also found out that in Win 7 you must set the Arduino execution file to run as administrator. Otherwise it wont upload the code and will give an error.

This reply was deleted.