Monday, April 8, 2013

Upload sketch to Arduino Mega with External Programmer

Well I just "wasted" 30 minutes of my life and thought I should share it with the world.

As I have previously mentioned, I have an Arduino Mega with what I believe is a burnt out usb to serial chip. I haven't looked seriously into fixing it, but that might be a project for the future.

Anyway, as I now have a USBtinyISP, I thought I would try to program it with that.

Attempt One:  I found THIS webpage. Apparently you can change the setting in the preferences.txt to always upload via an external programmer. Well that's no good.  I only want to do it with one board. Oh wait,

"If you would rather use an external programmer for only an individual board, you can edit the boards.txt file in the hardware/ sub-directory of the Arduino application directory. Set the board.upload.using parameter to the identifier of one of the programmers in programmers.txt."

Well there's the solution. I'll create a new board that is just a copy of the Mega2560 except with the new settings.

Attempt Two: I found the Mega 2560 part in the boards.txt and go to deciphering. This goes rather slowly until I find THIS. Then I quickly sort it out into the correct lines and change what I believe needs to be changed. 

Upload. Error. Big surprise. 

I change some more settings and reopen the IDE. I go to open the blink example and notice something.

Attempt Three: "Upload Using Programmer". There it sits write below the upload command under the file tab. It works.

I abandoned my attempts to create the edited board file. It would just be redundant now. I don't know how long that option has been there. I checked, and it is there in the oldest IDE version I have (1.0.1). So it has been there at least since last October.

There is a moral to this story. Don't assume that because Google doesn't yield an easy solution, it doesn't exist. You may have just been skimming over it in the IDE.

May you always see the obvious.
-Matthew

No comments:

Post a Comment