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

  • Hi guys,

    It is supposed to be SO EASY to use the Arduino to upload firmware. Still I fail. Makes me feel, hm, unsatisfied.

    I downloaded the Arduino, moved Libraries and ArduCopter folders into the Sketch folder (trying to follow the instructions). 3692293271?profile=originalThe libraries only contains two files:

    3692293453?profile=original


    Opened the ArduCopter.PDE from inside the Arduino.
    Selected port seems ok (com4).
    Clicked compile/upload:

    3692293471?profile=original

    Board: Aruino Mega 2560

     I get a ton of error messages, as you see.

    What do I need to do in order to be able to compile??

    Please help/
    Thanks/Tomas

    PS. I checked the Troubleshooting guide, and that is the instructions I attempted to follow. Without success :(

    https://storage.ning.com/topology/rest/1.0/file/get/3692293288?profile=original
  • 3D Robotics

    Jason,

     

    I've updated that page; thanks for the catch. It sounds like you've got a soldering error on your board.  Before you contact tech support, try another PC and another USB cable. If that doesn't help, email the store you bought it from and they may be able to help you find where you've gone wrong.

  • The instructions for loading software need updated pretty badly.  I hate to be critical, but I've tried following the instructions very explicitly only to find out for whatever reason the Mission Planner can't upload firmware to my board (I ordered the ArduPilot Mega in June, and over the last month had the time to assemble it). I've also tried using Arduino directly, but found out the filename "ArduPilotMega(version number).zip" in the code respository (as directed by http://code.google.com/p/ardupilot-mega/wiki/Code) is NOT the right file...that happens to be a very old version of the APM firmware.  As near as I can tell, ArduPlane2.24.zip is the correct file, however Arduino (0022) fails as well to load the firmware (after 10-12 mins), with several 

    avrdude: stk500_2_ReceiveMessage(): timeout
    avrdude: stk500v2_getsync(): timeout communicating with programmer

    errors. 

     

    I guess it's just a little frustrating because I can't tell if I'm doing something wrong or if I have a bad board (I posted on the pages that had assembly instructions to no avail).  I have the correct board (AT Mega 2560) and serial port selected in Arduino as well as completed all the other tips here.  I re-heated all the soldering joints to make sure they're all good and still no dice.  

    I guess my next step is to see if I can exchange the board for a different one and see if that fixes it.

    DIYDrones really is the coolest thing I've come across - I hope to get my board working quickly.

    Thanks

    JB

  • http://arduino.cc/forum/index.php?topic=65955.0  :(  Looks like I'll need to re-flash my bootloader.  FYI, DON'T try this example sketch on your ArduPilot board.

  • If on the ArduPilot board the status (yellow) light keeps blinking, and while trying to upload code you get the following error:  avrdude: stk500_recv(): programmer is not responding

     

    Did I perhaps corrupt my boot loader?  It was just fine the first 10 times I uploaded code to it.  I think I may have messed it up when I tried to upload an arduino sample program instead of the ArduPilot 2.7 code. 

     

    Ideas?

  • unfurtunetly i have may errors : like this

    3692254998?profile=original

  • 3D Robotics
    Why?? That hasn't been supported for nearly a year. We're only supporting the latest code, now 2.22. Please upgrade.

    http://code.google.com/p/ardupilot-mega/downloads/list
  • ArduPilotMega 1.02

  • 3D Robotics
    That's not correct. What version of the code are you using???
  • If i don't define GPS i'll receive this error:
    /config.h:58:3: error: #error XXX You must define GPS_PROTOCOL in APM_Config.h

     

This reply was deleted.