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 all,

    I am using the latest Arduino and trying to compile Arduplane 2.50, and kept getting a compile error related to the Pins_Arduino.h and Arduino.h files which had the same prototypes and function declations for:

    ---------------------------

    extern const uint16_t PROGMEM port_to_mode_PGM[];

    #define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) )

    -----------------------------

    plus around 6 other related declarations.

     

    This caused an error: "previous declaration of 'const uint16_t port_to_mode_PGM" compile error.

    I got around it by commenting out the duplicated entries in the pins_arduino.h file and it compiled OK.

     

    This seems odd that I had to do this. What am I doing wrong????

    Steve

     

  • hello,

    I'm having problems compiling the firmware in ARduino. I believe I followed all the instructions in the manual. I tried several versions and several Arduinos and I always get this error:

    AP_Var not defined in AP_Var.cpp

    Haven't looked much through the code because I believe it should compile in the first run since I didn't modify anything.

    Anyone know what might be the issue?

    Thank you

  • Hi everyone,
    Does anybody work on Linux with Arduino ? I am trying to compile the 2.5.3 ArduCopter with Arduino 1.0 on Ubuntu (don't have any Windows setup) but it doesn't work.
    I can't find the Arduino 022 with the DIY Drones patch for Linux.
    Thanks
    Jean-Philippe Hell

  • Hi, Im using ArduIMU V3 . When Im uploading latest firmware ArduIMU 1.9 im getting these errors below :

    conflicting return type specified for 'virtual void FastSerial::write(uint8_t)'

    As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.


    Please help me solve this error while uploading firm ware to board

    3692373204?profile=original

  • Still Looking...

    Does anyone know how to get the HUD to function in the Mission Planner when compiling and uploading with Arduino

  • 3D Robotics

    Addy: what code are you trying to compile?

  • Is there a setting for the config file to turn on the HUD in Mission Planner?  The manual states that the code can be loaded via mission planner or arduino.  When I use Mission Planner for the download the HUD works fine.  When I download via arduino the HUD is not active.

    Please help.

  • I got the same issues while compiling. all the steps were followed as it should be for the library. anyone know please help me out.

  • P.S.

    All this is just to help me to understand the system better.  I can have a base to compare to while I make small changes an additions of my own code.

  • Jack,  that worked.  Thanks for the help.

    Please let me know if I'm missing something.  I feel so stupid right now because I'm the guy the usually doesn't read the instructions to "put the bike together"  I'm an ME and have designed laser systems/ embedded motion control systems etc.  I've been with my company for over 24 years.  I'm not the dimmest bulb out there.

    What I'm looking to do is to be able to upload the compiled ArduPlane code via arduino and have it run just like it does when I upload it from within APM Planner.

    I've followed what instructions I could find and on my own was able to see that I had to set the APM_Config.h up to run the board but now when I load it I don't get an active OSD

    HELP?

This reply was deleted.