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
    amir: what are you trying to do?? You've put in a GPS line that's no longer supported (#define GPS_PROTOCOL GPS_PROTOCOL_MTK) and otherwise have all sorts of junk you don't need.

    If all you want to do is to use a lower baud rate, you only need one line in the entire file:

    #define SERIAL3_BAUD 9600
  • /*
    READ THIS.  REALLY!  READ THIS.

    First, you MUST uncomment the GPS PROTOCOL line below or the code will not compile.
    This is because we need you to tell the code which GPS module you're using, so we can load the right libraries.

    Second, there is a lot more you can do with configuration options is you want. See the APM manual for all the available options.
    */
    //-------------- REQUIRED ------------------
    #define GPS_PROTOCOL GPS_PROTOCOL_MTK // You must uncommment this line by removing the slashes ("//") in front of the "#" and select either the default (GPS_PROTOCOL_MTK) or one of the following other supported GPS modules if you're using one of them instead:

    // Other allowed options include:
    // GPS_PROTOCOL_NONE        No GPS attached
    // GPS_PROTOCOL_IMU         X-Plane interface or ArduPilot IMU.
    // GPS_PROTOCOL_MTK         MediaTek-based GPS.
    // GPS_PROTOCOL_MTK16       MediaTek-based GPS with 1.6 firmware
    // GPS_PROTOCOL_UBLOX       UBLOX GPS
    // GPS_PROTOCOL_SIRF        SiRF-based GPS in Binary mode.  NOT TESTED
    //
    //
    //----------------OPTIONAL-------------------
    //
    #define GCS_PROTOCOL            GCS_PROTOCOL_LEGACY
    //
    // The GCS_PROTOCOL option determines which (if any) ground control station
    // protocol will be used.  Must be one of:
    //
    // GCS_PROTOCOL_NONE        No GCS output
    // GCS_PROTOCOL_STANDARD    standard APM protocol
    // GCS_PROTOCOL_SPECIAL     special test protocol (?)
    // GCS_PROTOCOL_LEGACY      legacy ArduPilot protocol
    // GCS_PROTOCOL_XPLANE      HIL simulation ground station
    // GCS_PROTOCOL_IMU         ArdiPilot IMU output
    // GCS_PROTOCOL_JASON       Jason's special secret GCS protocol
    //--------------------------------------------------
    //
    #define GCS_PORT 3
    // This determines which port APM will send telemetery on. The USB port is Port 0, for when you're testing on the ground. The Xbee port is Port 3, for the field and in the air and you want to send telemetery wirelessly
    //
    //#define SERIAL0_BAUD        115200
    #define SERIAL3_BAUD        9600
    // These determine the baudrate for the telemetry port.  Default is 115200bps for Port 3.
    //
    // -------------------------------------------------
    //#define AIRSPEED_SENSOR     ENABLED
    // Are you using an airspeed sensor? Choose DISABLED if not.

     

    Thank You,Chris.

  • 3D Robotics
    amir: as I responded in the two other places you cross-posted this, you've probably put a typo in the file. Post your APM_config.h file and I'll show you where.
  • Hi,
    I want to change my telemetry baund rate of my ardupilotmega with arduino but after i open ArduPilotMega.pde and define baund rate in APM_Config.h when i select verify or upload i receive these two error:


    ArduPilotMega:76: error: expected constructor, destructor, or type conversion before '(' token
    ArduPilotMega:77: error: expected constructor, destructor, or type conversion before '(' token

    i'm working with win7-64 bit.
    Thank You.

  • Hi Guys. I too was having the famous " avrdude: stk500_getsync(): not in sync: resp=0x00
    avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00" error.

    I have just re-flowed some of the joints on my board with more solder and it now works fine. I am no electronics whizz and don't do much soldering so I was being extra careful when originally building my board. Turns out I was just a little too frugal with the solder. I hope this can help some of you still having issues.

    Cheers,

    Rup
  • I was powering ArduPilot through Multiplex BL-20 ESC, which gave out 5.64 volts. Had this very problem and fought with it a loooong time, only to find out it works if I power the ArduPilot through 4 alkaline batteries. I think this is why I got the battery holder pack amongst lots of other things :). Additionally, I also needed a timed reset - so it could be about something AND that.

    In summary: if you've tried everything in the list, try another power source. Like batteries. The batteries can be plugged to the same IN3 connector where you'd plug the ESC. Doing so, you don't want to switch any jumpers.
  • Hi all,

    I'm new to this ardupilot project and had encounter a problem in uploading the code. The error messages displayed on the IDE are

    avrdude: stk500_get sync(): not in sync: resp=0x00
    avrdude: stk500_disable(): protocol error, expect = 0x14, resp=0x51

    This is the list of hardware that I had:

    ATMega328 Thermopile based ardupilot board
    Ardupilot Shield Kit V1 (red)
    EM406 GPS module
    AttoPilot XYZ Horizon Sensor
    FTDI cale from diydrones store

    I had checked everyone listed in this blog post but I still got that error message.

    Another observation is that before loading the code, I was able to get the correct factory setting combination of the flashing LED as described in the manual. http://code.google.com/p/ardupilot/wiki/LedDisplay

    However, after my attempt to load the code - although unsuccessful as suggested by the IDE error message - the LEDs no longer flashes in the factory setting combination. In fact only the power LED remained on, the GPS lock, GPS and Stat LEDs are off, and the MUX and Mode LED are flashing in a irregular fashion. This is not the combination is not found in the manual.

    I had been tinkering with this for a while and couldn't figure out what is the problem. So I decided to seek help here.
  • Admin
    Connecting the ground and signal pin is what happens in proper binding jumper( pin 1 and 3). If done other wise you may end up shorting the power bus at the worst . This looks similar to binding process of spectrum rx.
  • 3D Robotics
    Brad, that's not the way bind plugs work. If you look at the device, it only electrically links the two outside holes. The center one is not connected. It's not like a jumper cap, which what I hope you're using.
  • wait, why would that be a problem. he is connecting the two male post together with a jumper. please explain cause i might have the same problem
This reply was deleted.