Press "Enter" to skip to content

Arduino on eclipse! – Part III – Uploading

How to configure AVRDude to upload binaries to Arduino.

This tutorial is based on a Windows 64 bit system. But the fact that eclipse is multi-platform should ease the things.

Uploading compiled code to Arduino Mega2560 from Eclipse

I’ve been following a lot of different tutorials about how to make this done. But no specific information about Mega2560 the configuration of the different tools drives me crazy after one day working. (No tutorial describes exactly what I’m looking for!!) However I need to say that the official tutorial is great and you should take a look on it.

Let’s start! Open Eclipse…

Configuring AVRDude

First thing to notice, AVRDude in WinAVR is not valid for Mega2560 so you need to use the one included in Arduino IDE.

  1. On Eclipse go to menu Window>Preferences. On the Preferences windows that opens, on the left side open section AVR>Paths.
  2. On the right side of the window you will see a list, find AVRDude element. Click on it and the press the Edit… button at right of the list.
  3. A window called Change Path for AVRDude opens. Select Custom on Path source enumeration.
  4. Browse for your Arduino IDE path and from it go to ‘\hardware\tools\avr\bin’. In my case looks like:
    C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
  5. Confirm the path and Apply the changes in the Preferences window.
  6. Still in Preferences go to section AVR>AVRDude.
  7. Check the Use custom configuration file for AVRDude and Browse… to the Arduino IDE path and from there to ‘\hardware\tools\avr\etc\avrdude.conf’. In my case looks like:
    C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf
  8. On the list bellow, Programmer configurations click on the Add… button at right. A window called Edit AVRDude Programmer Configuration <Configuration name> opens.
  9. Put a configuration name and a description acording to your platform, something as Arduino Mega2560.
    This configuration is horizontal to all the projects in the same platform allways that the COM port doesn’t change, COM port could change if you connect Arduino board to other USB port!
  10. Parameter that you should change are listed here:
    • Programmer Hardware Wiring… WIRING
      Other tutorials sugest to use STK500v2 or Arduino but… NO. Please don’t. Because, as written in the file ‘avrdude.conf’:

      # http://wiring.org.co/
      # Basically STK500v2 protocol, with some glue to trigger the bootloader.
    • Override default port ‘\\.\<arduino COM port>’, in my case looks like:
      \\.\COM15
    • Override default baudrate 115200
    • Other options -v -v
      This option will enable verbose mode, useful to see what is happening on the Eclipse console.

Configuring the project

The general configuration for the AVRDude is done, but still some other changes should be applied to our project.

  1. Open the Project>Properties.
  2. Navigate to setcion AVR>AVRDude on the left tree.
  3. Select Programmer page on the right side of the window.
  4. Set Programmer configuration to the configuration that we have created on previous steps.
  5. Now, and this is important, go to Advanced page. And check the Auto Chip Erase Cycle (-D) option!
    No tutorial that I’ve checked has this step, and this will crash the uploading procedure with next output.

    avrdude: erasing chip
    avrdude: stk500v2_command(): command failed
    
    avrdude done. Thank you.
  6. Navigate to section AVR>Target Hardware on the left tree again.
  7. Set next parameters
    • MCU Type ATmega2560
    • MCU Clock Frequency 16 000 000 (six zeroes)
  8. Apply and confirm the configuration.

If everything went good you now can use the AVR upload  button (The hardest-to-configure button of the world.).

You can make auto-upload when building if you check Project>Properties>C/C++ Build>Settings>Additional Tools in Toolchain>AVRDude.

This is my first post (yes, I started with part II) and tutorial on this blog! So… Hello world!

2 Comments

  1. maria bote alonso maria bote alonso 20th October 2014

    Wow, it’s so interesting. Thank you for to share with us

Leave a Reply