More updating firmware without using Arduino

I realised that the Arduino Uploader (featured here earlier) doesn’t work for Mega2560s.  Easy enough to fix, but I wanted something that’d work out the box so I’m recommending XLoader instead.  Works much the same way.  In fact, I’m just going to leave you with this screenshot and a couple of links.

Download XLoader from the XLoader site.

And download the precompiled firmware you want to update to (do right-click-> save target as…):

Start XLoader, load the hex file you downloaded into it, select your device (Mega(ATMEGA2560) for PolargraphSD machines, Duemilanove/Nano (ATMEGA328) for older Polargraph machines), select your COM port and press UPLOAD.
UPDATE- [minor] WARNING WILL ROBINSON.
Kongorilla points out to me that XLoader is a little unforthcoming in the event of a problem – If you load a file that isn’t a hex file, then it still goes through the charade of loading it, but then quietly announces at the end “0 bytes uploaded“.  So keep an eye on the status line to make sure it actually does what you think it’s doing.

Some interesting stuff that you probably aren’t interested in:

Note that I’m going to start uploading the compiled hex files to the SVN repository so I don’t have to faff on with updating zips and things.  The problem with this is that the hex file will not automatically be the compiled version of the code that is next to it in the repo.  I’ve still got to do that bit manually so it’ll probably be out-of-sync much of the time.

The way to check to see if the source code has been updated since the hex file has been compiled is to look at the revision numbers:

In this case, the source code (the .ino file) has been updated in the same revision as the compiled file (the .hex file).  This means that there hasn’t been any updates to the source code since the hex file was compiled.

If the source code has a higher revision number than the hex file, then the hex file is an older version and won’t reflect the changes in the source code.  You should compile it yourself (the regular way, through Arduino IDE).

6 thoughts on “More updating firmware without using Arduino

  1. For Linux and Mac users, you can open a terminal window and use the following avrdude command

    % avrdude -Cavrdude.conf -v -patmega2560 -carduino -D \
    -b 115200 -cstk500v2 -P \
    -Uflash:w::i

    where is the device (e.g., /dev/tty.usbserial-A101KW9I) and is the name of the hex file (e.g., polar1.4.hex).

    avrdude is supplied with the Arduino app and can also be downloaded from various sites such as Ada Fruit (http://www.ladyada.net/media/usbtinyisp/usbtiny-intel-macosx-avrdude-54.zip).

    • Right, really good point, thanks Dan. I’m revealing my windows-centricity (how embarrassing). And it’s worth also pointing out that XLoader and Arduino Uploader are nothing more than tools that build commandline strings for avrdude, so you can do it manually if you want to.

  2. Hmmm. The comment’s markup ate some of my command. Here’s the command in a form that it may leave intact

    % avrdude -Cavrdude.conf -v -patmega2560 -carduino -D \
    -b 115200 -cstk500v2 -Pdevice-path\
    -Uflash:w:hex-file-path:i

    where “device-path” is the device name (e.g., /dev/tty.usbserial-A101KW9I) and “hex-file-path” is the name of the .hex file.

  3. Great tip for OS X! I needed the absolute path to avrdude.conf to upgrade the firmware using Arduino’s avrdude. Here’s the command I used: /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude \
    -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega2560 -carduino -D \
    -b 115200 -cstk500v2 -P/dev/tty.usbserial-A101KV2X \
    -Uflash:w:/Users/lighm007/Documents/workspace/polargraph-read-only/embedded/branch/polargraph_server_polarshield/polargraph_server_polarshield.cpp.hex:i

    Go!

    =ml=

  4. Working on OSX

    First I did not change the board type.

    Then I tried to use XLoader on Win2k (not possible because .net V4 is not available) and on XP64 bit (not possible, too).

    Then I tried to use the command line where i wasted another hour.

    Finally I went back to installed Arduino.app copied all the files into the scetchbook directory. Still not working so I copied all the directories and content into the already existing libraries directory. Then I started arduino, opened the directory with polargraph_server_polarshield. Then using the test option. Everything was fine. So I uploaded. After maybe half a minute the touchscreen was available.

    It is up too you what you do. But I had to realize, the shortcut with precompiled firmware was – for me – a waste of time. The way it finally worked is how it is best to understand.

Leave a Reply