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

  • So am I supposed to use these values if uploading via arduino?  Setting the board type in tools didn't seem to help.

    anything else?

  • Thanks Jack,  Will do.

  • Not sure we support the Arduino 1.0 yet I would try Arduino 22 with patch I know it works I just used it yesterday without a problem.

     

    Jack

  • Hey Everyone,

    Just downloaded and installed all the newest code to allow me to compile ArduPlane.  The version of Arduino is 1.0 relax so it should have the ability to compile the full ArduPlane.  The following are the errors I'm getting.

     

    In file included from C:\Users\John\Documents\Arduino\libraries\FastSerial/BetterStream.h:16,
    from C:\Users\John\Documents\Arduino\libraries\FastSerial/FastSerial.h:56,
    from ArduPlane.cpp:27:
    C:\Users\John\Documents\Arduino\libraries\FastSerial/../AP_Common/AP_Common.h:19:20: error: wiring.h: No such file or directory
    In file included from ArduPlane.cpp:32:
    C:\Users\John\Documents\Arduino\libraries\I2C/I2C.h:34:22: error: WProgram.h: No such file or directory
    In file included from ArduPlane.cpp:27:
    C:\Users\John\Documents\Arduino\libraries\FastSerial/FastSerial.h:119: error: conflicting return type specified for 'virtual void FastSerial::write(uint8_t)'
    C:\Users\John\Documents\Arduino 1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
    In file included from ArduPlane.cpp:32:
    C:\Users\John\Documents\Arduino\libraries\I2C/I2C.h:70: error: 'boolean' has not been declared
    C:\Users\John\Documents\Arduino\libraries\I2C/I2C.h:71: error: 'boolean' has not been declared
    C:\Users\John\Documents\Arduino\libraries\I2C/I2C.h:101: error: 'boolean' has not been declared

    Has anyone been able to compile this without moving files all around?

  • Use the 1.2 code and you will have no problems.  I just got an ardustation, spent several days messing with the code upload function and kept getting errors.  I then tried the 1.2 version and got no errors and the firmware runs great.  I guess there are a few fixes, but for now this is better than only getting mav errors...

  • 3D Robotics

    Jippie: try Arduino 023. I don't think we support 1.0 yet. 

  • Hi!

    I'm using the ArduImu V2 as a sensor. I've downloaded the ArduImu code version 1.8.2 from the googlecode page. I want to upload the code to the ArduImu and followed the instructions from here https://code.google.com/p/ardu-imu/wiki/Code. When I compile the code in the Arduino 1.0 IDE, I get the following error:

    In file included from arduimu.cpp:14:
    /Users/Jippie/Desktop/arduino/libraries/FastSerial/FastSerial.h:105: error: conflicting return type specified for 'virtual void FastSerial::write(uint8_t)'
    /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'

    Do you have any idea what this error means? I'm working on a mac with the latest version of the Arduino IDE.

    Thanks! Jippie

  • 3D Robotics

    Jason: did you email tech support? If so, please PM me with the details and I'll make sure they get it. 

  • Angela - I haven't resolved my issue.  Based on one of your earlier comments, I looked at the soldering job of the 2560 chip itself and it doesn't look the greatest either however I don't see any obvious bridges or defects.  I need to get a magnifying glass so I can look at it a little closer.

     

    I bought my board directly from DIY Drones.  I contacted their tech support two weeks ago to see the about the possibility of swapping it out and getting a new one, but haven't heard back.

  • Chris:  Update, The issue is certainly with my board.  I borrowed a friend's APM/oilpan and have had no issues with getting code to upload to it with both Arduino and mission planner (though mission planner is asking for flight gear version 2.5 which as far as I can find is not yet available--there's a thread here:  http://code.google.com/p/arducopter/wiki/QuadHil?wl=en that needs addressing).  Until I hear back from the seller I will be using my friend's board. 

    As for my board, when plugged in the blue ppm light comes on, the yellow mux light, and the red light under Inputs (amd?) on the APM.  I wonder if it is an issue with the pins of the 2560 on my board--my friend's board has a 2560 with nice shiny pins, while mine are dull (looks like grey spots where the metal appears thin), and pins 4&5 and possibly 6&7 seem to have solder bridges. Thanks Chris!

This reply was deleted.