Need help with bootloader and fuse options for an Atmega328p-AU SMD chip

I picked up some SMD Atmega328p-AUs from SparkFun. I'm working on a little clock project. I put one together and attempted to load the bootloader via Atmel Studio 6 with my AVRISPmkII. Studio 6 saw my chip and I was able to burn the bootloader, however I think I messed up my fuse/crystal options and bricked the chip.

I decided to put another one together, but I'm asking for help before I brick it. I thought I could just load the optiboot bootloader for the 328 that comes with the Arduino IDE. Is that the correct option? I googled for the fuse bits but I'm so confused as to what to use for low, high and extended.

I have a 16MHz crystal attached, but I don't see an option to pick that as my crystal. It looks like Atmel Studio only goes up to 8MHz, so I must be doing something wrong.

See the attached pictures for my project and setup. Any advice would be great. Thanks.

Bootload it from the IDE. Select Uno as the board type. That will set the fuses for 16 MHz xtal and also select the correct bootloader (both are specified boards.txt)
Drivers for the MKii are buried in the IDE:

Sorry, but that's not working for me. Windows won't accept that driver. I turned off that annoying "not digitally signed" garbage and it still won't accept the driver. So I can't use the AVRISPmkII with the Arduino IDE. It only works with Atmel Studio. Any idea how to get it to run on OS X? I'd rather use it with the Arduino IDE on my Mac. I'm using my kids' PC for Atmel Studio, but I'd rather not if I can get away with it.

Anyone know how to set the fuses, etc with Atmel Studio?

I'm not a mac user, can't help you there.

I don't want to install/open Atmel studio, I think it'll mess up the driver for me in the IDE.

Trying to install that driver so it'll work with the Arduino IDE totally buggered it with Atmel Studio. Now it does't work at all. I'll have to try and reinstall the driver tomorrow.

Anyone else know the fuse settings and how to set the crystal to 16 MHz using Atmel Studio?

When I used it in the past, there were like 3 or 4 steps:
loading the eeprom (not typically done)
loading fuse bits
loading the lock bits (typically left unlocked)
loading the bootloader into flash.

I recall all sections were pretty identifiable.
Use the fuse settings from the boards.txt file.
Point to the bootloader file.

I already tried that. However, I don't see an option in the list for a 16 Mhz crystal. It looked like it only goes to 8MHz. It think that's how I bricked the last Atmega.

If you enter the fuse settings at the bottom here
http://www.engbedded.com/fusecalc
I think it will show you what fuses are set to 1 or 0, and you can transfer that into Atmel Studio.
I recall you are correct tho, the highest is described as 8 MHz, altho the part is spec'ed to work up to 20 MHz.

I decided to put another one together, but I'm asking for help before I brick it. I thought I could just load the optiboot bootloader for the 328 that comes with the Arduino IDE. Is that the correct option?

No, the optiboot bootloader is 'hard coded' to only function correctly at 16MHz. You must find a 328P bootloader code hex file that was hardwired to run at 8Mhz. Not sure if there is a optiboot bootloader coded to run correctly at 8Mhz? There are others that are but not as small as optiboot so fuse setting need to be different for the larger bootloader code.

I have a 16MHz crystal attached. So that would be fine. I guess at this point it might be easier to just ditch Atmel Studio and load the bootloader from my Uno set up an ISP and breadboard my clock.

ryemac3:
I have a 16MHz crystal attached. So that would be fine. I guess at this point it might be easier to just ditch Atmel Studio and load the bootloader from my Uno set up an ISP and breadboard my clock.

That's always worked for me. Atmel Studio has it's uses I guess, but it's not as simple as just using the standard procedures that work with the arduino IDE.

Good news. I was able to set up my Uno as an ISP and burn the bootloader to my chip that way. I chose "Uno" as the board and it worked fine. I was then able to upload the blink sketch to it with my FTDI adapter, attach and LED, and watch it blink. Success!

Yeeaaaahhh

What's great too is I went back to the first board that I thought I bricked and attempted to load the bootloader using the same method. It took it! I guess it wasn't bricked after all. I must have just gotten it into a non-running state using Atmel Studio, but not in a way that I couldn't reprogram it.

I'm so confused as to what to use for low, high and extended.

If you look in "boards.txt" ( .../hardware/arduino/boards.txt) it contains pretty obvious statements like:

uno.name=Arduino Uno
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
[color=purple]uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05[/color]
uno.bootloader.path=optiboot

Cool, thanks. I eventually did find out about that text file and those parameters, but even with that I still had the problem of not being able to set the frequency to 16MHz to match my crystal. Using my Arduino as an ISP did the trick.

The clock works great!

Very Cool... And Very Good looking as well...

Doc