Go Down

Topic: Need help with bootloader and fuse options for an Atmega328p-AU SMD chip (Read 1 time) previous topic - next topic

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.

CrossRoads

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:
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

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?

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

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?

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

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.

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty

Quote

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.

retrolefty


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!

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

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.

westfw

Quote
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
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05

uno.bootloader.path=optiboot

Go Up