So, after spending about 7 hours today figuring this out, I figured I would make a short tutorial. The information on how to this was very scattered, and some was not even documented (I had to look at some of the arduino configuration files). Now, what I wanted to do was use my existing programmed ATMega328p in a duemillanove to program another blank ATmega in a project, like
computer=>duemillanove=>blank or pre-programmed ATmega
This is nice because you don't need to buy any extra gear for programming, not an ICSP circuit OR a usb-serial converter for a boarduino. I used AVRdude, but things never seemed to work properly. Here's how I got it working on my mac. On the hardware side, I had a duemillanove loaded with arduinoISP, and this was hooked up to my boarduino. This is the standard setup for bootloading a blank ATmega chip over ICSP. Attatch pins 13, 12, and 11 on both the master and slave. Attach master pin 10 to slave reset pin. Attach ground on both units. That's the easy part, software was a lot trickier. First, one tutorial said to use fink to download AVRdude, but this IS NOT the latest version, and the config file does not include support for the atmega328 chip. I used macports, and that gave me version 5.8 with support for the atmega328p. So, I finally got support for that chip. But now it gave me a connection error! Some more internet research showed that I should set the baud rate to 57600, as opposed to leaving it unspecified. This appeared to work, and gave me a success message on AVRdude. But this would only produce really weird stuff, like the master arduino executing the program somehow without losing the bootloader, or the slave ATmega blinking slowly. Finally, I looked at some internal configuration files for uploading firmware over arduinoISP (note how the arduino app has a separate option for arduino as isp and avrisp) and the file showed that the ideal baud rate was actually 19200. So, in a last-ditch effort, I tried running AVRdude with this baud rate and success!
The command I used was
avrdude -p m328p -b 19200 -P /dev/tty.usbserialA900adK4 -c avrisp -U flash:w:/Applications/applet/testapplication.cpp.hex
the format is :
avrdude -p [chip code, if you don't know yours type something random in its place and a list will show up] -b [baud rate] -P [connection port] -c [programmer type, arduinoISP is avrisp] -U [memory type, most likely flash]:[just use w for programming]:[.hex file to upload]
I hope this can help you out and maybe save you some cash, I saved myself like 30 bucks on an ISP programmer and another 20 on a serial board for arduino. It's worth noting that if you install a program this way, it will erase the boot loader. This means 2 things:
1:there will be instant start-up, unlike bootloaded arduinos which have a slight delay
2:the arduino will NOT be programmable over serial unless you re-install the bootloader by hooking everything up and in the arduino app choosing tools>burn bootloader>w/ arduino as isp with the correct serial port and target board selected.
Now, another important part of this is how to get the .hex files after the arduino 0018 update. In the preferences.txt file (look it up on arduino.cc to find it), you have to add the line build.path=applet or something similar, in my case it will build in /Applications/applet/. This makes finding the files much easier.
this is a pretty hasty tut and I probably forgot some stuff, but I hope it will save somebody the frustration I experienced ;D
will