Using the new Arduino Mega 2560 with Arduino 0019 on Ubuntu

I should state that this post is only applicable to the arduino 0019 IDE version and later versions should solve issues here, however at the time of writing such versions have not been released.

Today I was happy to take delivery of one of the first new arduino megas which utilise the atmega2560 and replace the ftdi chip with a more versatile ATMEGA 8U2. The websocket server I've been writing is getting a bit heavy for the arduino duemilanove I used up to now at around 20kb so I decided it was time to upgrade. However I had failed to notice that a version of the arduino IDE  (0020) had not been released for Linux at the same time as the hardware. This was a bit of an oversight on my part but I think it was a bit silly of the arduino team to release the hardware without mentioning it.

In this post I intend to briefly outline things I've tried that can make it work at least a bit...

Arduino Mega 2560

<!--more-->

Hardware

The main improvement, for me, of this new arduino over the old mega is the double memory capacity which allows me to grow a bit further after the duemilanove. Most noticeable on arrival is the new packaging which is a nice touch and makes the product feel like a commercial product rather than some underground toy.

However it's not all good, the quality of production of this board seems to have dropped slightly, it having a significant amount of flux on the chip, not a major issue, I just like things to be perfect!

Software

This is where all hell breaks loose. The arduino mega 2560 and arduino uno require the new version 0020 of the IDE to work correctly, this is not yet available on linux due to rxtx problems, when I ordered I stupidly assumed that there would be the same software support that had always been there but sadly not, so I tried a few things to try and make it work, with varying amounts of success:

Run the IDE under Windows XP in a virtual machine

While I could put up with this for a week or two it's not ideal..and proved far from reliable.

I duly downloaded and installed the windows version of arduino 0020, I already have a virtual machine set up with XP and usb set up, so I piped through the usb port for the arduino, it was detected by windows and appeared to install correctly however when attempting to upload the blink sketch (which compiles fine) I get errors from avrdude:

avrdude: stk500v2recv(): checksum error avrdude: stk500v2recv(): checksum error avrdude: verification error, first mismatch at byte 0x0268 0x68 != 0xb1 avrdude: verification error; content mismatch

After retrying sometimes I was able to upload a sketch, but not reliably, sometimes it just hanging on upload. At this point I didn't really know what to do,  so I tried it on a real windows computer and it worked fine...but that is not a workable solution for me so I tried a more radical approach:

Modify the Arduino 0019 IDE to work

I did not have high hopes here as there is obviously a reason if the arduino team are having issues with 0020 on linux. However I had limited success.

I took the hardware/arduino/boards.txt file from the new windows arduino 0020 ide and pasted it into the corresponding place in the 0019 IDE on linux, the arduino mega 2560 (and uno) now appear in the boards menu. All good so far but in removing the ftdi chip the arduino moved its default location moving from /dev/ttyUSB0 to /dev/ttyACM0, to compenste for this I made a symlink between the locations sudo ln -s /dev/ttyACM0 /dev/ttyUSB0 after inserting the arduino usb lead into the computer.

Now when starting the ide there is a delay of several seconds longer than usual with no errors shown, sketches can be opened and compiled for the mega 2560 but everytime the tools menu is accessed there is the same hanging of the program for several seconds while the serial ports are searched. Despite these problems sketches can be uploaded most of the time, others the arduino just hangs...

Edit: Since writing this post I've noticed that there were 5 instances of avrdude running left over from my messing about collectively maxing out my quad core processor so there are definitely  still issues to be resolved!

That's as far as I got...hoping for a better solution soon...