Pages: [1] 2   Go Down
Author Topic: Need help with bootloader and fuse options for an Atmega328p-AU SMD chip  (Read 1228 times)
0 Members and 1 Guest are viewing this topic.
NY, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
 


* atmega328p SMD 1.jpg (167.72 KB, 1024x682 - viewed 43 times.)

* atmega328p avrmkII.jpg (225.32 KB, 1024x680 - viewed 41 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:


* MKii_path.jpg (56.78 KB, 960x720 - viewed 36 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

NY, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

NY, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

NY, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

NY, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

NY, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!


* DSC_0004.jpg (156.76 KB, 1024x682 - viewed 27 times.)

* DSC_0006.jpg (122.21 KB, 1024x680 - viewed 30 times.)
« Last Edit: February 06, 2014, 11:18:03 pm by ryemac3 » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeeaaaahhh
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

NY, USA
Offline Offline
Newbie
*
Karma: 1
Posts: 48
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6792
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1] 2   Go Up
Jump to: