I essentially built my own Arduino Uno. It has an AtMega8U2 which I was easily able to load the USB to serial firmware onto and it works great.
The main processor is an AtMega328 (not the 328p). The difference between the 328 and 328p I believe is only the power usage and the device ID on the chip.
Using Atmel Studio I was able to read the AtMega328 chip ID, voltage, erase the chip, and read/write to fuses and lock bits. I set the fuses on the chip to what I wanted and left the lock bits open. Afterwards I was still able to see and erase the chip just fine. However, no matter what I tried Optiboot would not load onto the chip. I'd get errors saying it couldn't write the program, couldn't enter programming mode, etc.
I decided to try AVRDude on another computer (without Jungo drivers installed). Unfortunately AVRDude only supports the 328p, but since they're basically the same chip I forced programming of Optiboot. It wrote to the chip, but upon verification said there was a mismatch. Now, going back to Atmel Studio, I can read the voltage and device ID but as soon as I try anything else (chip erase, read fuses, read lock bits), it throws an error and locks up. I can no longer read the device ID until I do a reset to the chip.
Any idea what's happened here? How can I recover from whatever AVRDude did to the chip and how can I successfully install Optiboot using Atmel Studio?
I believe the command I wrote to AVRDude was:
avrdude -p m328p -c avrispmkii -P usb -e -U flash:w:optiboot.hex -F
I'm using an AVRISP MkII programmer with external power supplied to the board.
Thanks for any help!