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

  • Chris: APM2560, I did do the soldering (I have checked for stray solder for possible shorts).  From memory, a red and yellow(mux) light are on on the red APM board--let me double check the lights and confirm tomorrow (quad and parts are now in another location).  Also, either the rx or tx light (on oilpan) blinks about once every 20 s when attempting to upload with the Arduino

  • 3D Robotics

    Angela: I'm not sure I understand. That's what standard ArduCopter does, with or without telemetry. There's no need for Arduino to make that work (although you're welcome to use it if you want to play with the code anyway).

  • Chris:  btw, there is no telemetry for my quad--it's eventually supposed to autofly to waypoints using only gps.  I will need to be able to upload modified code; I do have a magnetometer. Thanks again

  • 3D Robotics

    What kind of board are you using? APM2560 or APM1280? Did you solder it yourself? What LEDs on the APM board (not IMU shield) come on when you plug in the USB?

  • Chris:  Thanks; Yes, I have tried to upload the regular code with the Mission Planner.  The Com port shows up in mission planner. After choosing Quad plane, the mission planner attempts to detect apm and cannot.  This is why I tried uploading with arduino, and I get the timeout messages as Jason did.  Then I tried the other stuff with the bootloader, after many searches through the forums.

  • 3D Robotics

    Angela: I'm not clear what you're trying to do. For regular APM use you shouldn't be touching any of this stuff, or even using the Arduino IDE at all.

     

    Let's start over. Are you just trying to load the regular code via the Mission Planner? If so, have you already gone through the regular process in the manual?

  • Hi, I am having the same issue as Jason, I am wondering if and how it was resolved? I've gone through the debugging and also re-flowed my solder....  Went as far as trying to reburn the bootloader following:  http://www.diydrones.com/profiles/blogs/tutorial-getting-those-pesky  I got stuck here at step 3, read signature.  I tried the 168 and the 328p as well as a few others, but always get a fail for entering program mode.  I tried using the avrisp mkII with Arduino to reload the bootloader, but Arduino doesn't recognize it, I get "avrdude: usbdev_open(): did not find any USB device "usb" " I remember reading in one of the forums (either diydrones or arduino) something about not having avr and arduino drivers installed at the same time, but I cannot find any other driver for the avrispmkII.

    Mission planner does not detect my APM.  Slider is pointed toward the pins, though I have tried with Arduino having the slider in both locations (I am still not completely sure where the slider should be and what it is for).

    I am using Windows 7 home premium.  This is my first board with Arduino.  I would really appreciate any help :)

     

    Thanks!

  • 3D Robotics

    Sounds like a Mac/PC thing. Anyway, if you select Yes you should be fine.

  • Gee, thanks Chris. No wonder it couldn´t compile.

    May have something to do with the extraction of the .zip. I got this alert box, and maybe I goofed it up there...

    3692293509?profile=originalBecaus then I had the two folders, but the Libraries being almost empty.

    Guess it will work better now. Thanks again!

  • 3D Robotics

    Tomas: where did you get those libraries? That "libraries" folder should have all the below files in it. Where are you getting your code???

     

    3692293449?profile=original

This reply was deleted.