arduino micro as ISP for atmega1284

TL;DR- use the labeled hardware SPI pins and AVRdude, and life is good.

This is a tale of woe, of how I tore apart a day’s work trying to get to the bottom of something, and then solved it sitting at the bar waiting for trivia to start. Basically, I have some stuff on hand to build a breadboard version of the v4 Ourglass. I need to do this to validate my circut design, as well as measure some things about power consumption and timing (see previous post). There are a bunch of resources on how to build a “boarduino” online, but a couple of my parameters are out of the ordinary, and threw me off.

First, I’m using an Arduino Micro , which isn’t like all the other Arduino boards. The hardware SPI is on the ICSP header. So, the setup is something like:

Arduino Micro 1284p (pin numbers)
MOSI 6
MISO 7
SCK 8
D10 (reset) 9

You also need to connect the VCC, both GND pins, and AVCC; those are well known, and left as an exercise for the reader (seriously, consult the data sheet). Once everything is hooked up, you’ll need to decide how to set the fuses. I used this online fuse calculator (edit: be careful, and read around about how to set your fuses properly, I’ve bricked my chip since getting it to work by messing around). There are probably others, and of course, you can just stare at the data sheet and figure out 3 bytes yourself. I’m using the internal oscillator, and setting the brownout to 2.7 (since I’m running at 8mhz and 3v). In reality, I could probably disable this altogether, since the battery I’m using has a pretty sharp cuttoff, but it’s strongly reccomended here to leave it on if you’re using a bootloader at all (also covered more in depth here).

I picked a bootloader mostly at random, from this post about bootloading the 1284p (using an uno, which lead me to waste half a day). I may regret this; I haven’t verified that it works, but avrdude reported success loading it onto the chip at least. Edit: still waiting on the final verdict, as I need an external oscillator for serial communication.

So, in the Arduino IDE, there’s an example sketch called ArduinoISP. You’ll need to change the line “#define RESET SS” to be “#define RESET 10”. Then load it onto your micro, and you should be able to use avrdude to load your fuse configuration and bootloader. You can also use the IDE, although I haven’t tested that; you need add the hardware descriptions to your personal ~/Documents/Arduino/hardware/ (on mac) and restart the IDE to get the board type. This will also set the fuses based on what’s in the boards.txt, so make sure that reflects what you want.

Of course, since getting this more or less working, I’ve managed to brick the thing, so now I have to wait a week for another chip to come in.

Posted by Matt on 2015-01-20 06:09:38 +0000