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


  • 3D Robotics
    Feri, yes that's the problem. The bind plug only connects the 1st and 3rd pin. It won't work with two adjacent pins the way you've done it. Another reason to follow the manual!
  • HI Chris
    These are the photos about my ardupilot and ardushield board

    All the connection, wiring and soldering are based on ArduPilot 2.x manual (http://docs.google.com/View?id=ddjmqgw3_43gm6gvggf)
    I removed the power solder jump because I wanted to use separate battery (not from ESC) for the board.

    I did some modifications with the bind plug connector, i'm not soldering the cable directly to the board, but I'm using male connector , you can check on the photos, do you think that might be the problem?

    Best Regards.
  • Developer
    It's strange that I don't see the text "Begin GPS Test" at the beginning of your serial window.
    Also, The output should continue, once a second until you stop it.
    If opening the serial window does not reboot the board, hit the reset button and you should see the above text. If not, something is not right with your serial port.
  • 3D Robotics
    Thanks for that. You've got the right GPS setting for the EM406 (1) so that's not the problem. I think the next thing to look at is your bind plug. Can you upload a photo of how you soldered that?

    BTW, this isn't causing the problem, but I notice that you have fake bearing turned on in the debug section, so once you get this working it will only fly in one direction.
    #define FAKE_BEARING 1
  • Hi Chris,

    this is my airframe setting file.

    i've already test the gps without the shield but using the same airframe setting and code with before (with shield). the result is just the same, my gps led (red) always turning on.


    I've downloaded your code for GPS tester and uploaded to my ardupilot board, this is what i got from serial terminal

  • Developer
    If you're interested to see what's going on with your GPS and see its raw output, try and upload this code to your Ardupilot. It's a very simple loop that outputs your GPS to the Arduino serial terminal. I think it may help you see if the output is good or if the GPS never connects. I know when I look on the scope, I can see the GPS output, whether I have a good signal or not. I can also see the lat and long values are zeros. Check out the Sirf PDF manual online and look for the GPS message that contains the term "ground_course" You'll see the actual message that Ardupilot parses.

  • 3D Robotics

    Why don't you upload your airframe file here and I'll look at it.

    Have you tried it without the shield?
  • Chris,

    I tried to modified the airframe settings and the code, but it still won't work.

    Can you help me with the airframe setting and the code? Can you share me the code for this kind of test?

  • 3D Robotics
    Feri, yes, you need to change the airframe settings for the right GPS before you connect it, or it won't lock.
  • Chris,
    I already tried your recommendation, but the result is just the same...

    Do i have to change the airframe setting before i connect the GPS direct in to ardupilot board? Or do i have to use the special code for that?

This reply was deleted.