3D Robotics

Arduino debugging tips

3689308521?profile=original

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

Comments

  • 3D Robotics
    Tom,

    That is not regulated power, so the actual voltage under a current is unpredictable.

    Drew,

    You need to ground D6. The yellow status light should flash for a second (that's programming the GPS) and then the blue LED will flash until you get GPS lock. If you're not using an ESC, you should switch the power jumper. Behavior will be unpredictable if you don't get the power right.
  • Something is starting to work, just tried jumping/binding between d6 and d7 and the blue light started flashing. So I rushed outside to make sure the gps could see the sky, however within two minutes or so the blue light completely stopped.
  • The manual shows how use a bind plug with the shield. I tried binding d6 and d7 on the ardupilot (nothing happened), are those the correct pins for binding? So I take it this will not work correctly until the GPS is in binary mode?
  • Admin
    Chris,

    Drew appears to be using a 4 cell rechargeable battery so he is operating around ~5.2 vdc when fully charged which, I believe, is within spec. So he does not need to switch the power jumper. I power my Ardupilot with a 4 cell NMHi battery all the time when I am not using an ESC.

    Regards,
    TCIII
  • 3D Robotics
    Drew,

    --Have you switched the power solder jumper (since you're using a battery, not an ESC)?
    --Have you used the field setup jumper/bind plug to program the GPS into binary mode, as described in the manual?
  • I'm trying to get my gps to lock (I have the standard em406) and the lock light will not flash. I have it setup for north east mode, servo is plugged into output 1 (rudder?), power LED is illuminated, and Stat LED is flashing, battery is plugged into control input. I'm running the latest ardupilot (2.3). Help would be appreciated. Thanks!

  • 3D Robotics
    Thanks, Thomas. Just a reminder that these instructions are in the manual. RTFM!
  • Admin
    Danilo,

    Here is what you need to do: You will find two folders inside Ardupilot ver 2.2.3: one, the ArduPilot code, which will be called ArduPilot_EasyStar2[subversion] and the other just ArduPilot, which contains a .h file and readme. Move the ArduPilot folder to the \\arduino-0016\hardware\libraries folder on your PC. Since you did not load the .h file as instructed the Arduino IDE cannot compile the sketch.

    Regards,
    TCIII
  • 3D Robotics
    Check your baud rate in the IDE. It must match the GPS baud rate. 57k is the default for the EM406
  • I'm having trouble getting the debugging code to send stuff back to the IDE..
This reply was deleted.