ATMega328P Bootloader Help

Hello, I recently got a handful of ATMega328P chips and would like to burn the Arduino bootloader on them. I have never done this before so it will be new for me. I am unsure of the best way to do this, being that I also have an Uno (R3) and a USB to Serial FTDI cord if that helps along with a plethora of resistors and capacitors. I have tried a few different methods as in the "optiLoader" library and the "arduinoISP" library, both with no avail. the ISP has errors and the OptiLoader seems to be "missing files" and I cannot seem to progress on either of those methods as of now.

Does anyone have any suggestions on doing this with what I have available?

I thought that this was going to be a relatively simple process so if I am missing something please fill me in!

Thanks ahead of time.

LP

Thanks for the reply!

I left one small detail out is that I am using Atmel Studio 6.1.2730 on win 8.1 if that matters. When I upload the ArduinoISP sketch it gives me these errors :

pins_arduino.h:42: error: expected unqualified-id before numeric constant
pins_arduino.h:43: error: expected unqualified-id before numeric constant

Which correspond to these two lines in the .h file :
static const uint8_t MISO = 12;
static const uint8_t SCK = 13;

Could this be because of Atmel Studio. I would use the Arduino IDE but when Atmel is installed you cannot open it. Any suggestions are appreciated and thanks again.

I think there is a simple fix but I don't remember it.

It seems like there should be, also in the tutorial on here : http://arduino.cc/en/Tutorial/ArduinoISP it says "doesnt work with uno" but i dont know if that means programming FROM or TO an Uno, or simply altogether the Uno will not work with this. Thanks for the quick responses again. I will keep searching :]

What does it show in the Tutorial?
Isn't that an UNO programming a chip?

I thought so, but with these errors I'm not so sure....

I would use the Arduino IDE but when Atmel is installed you cannot open it.

That does not match my expectations, or my experience. (although, I haven't put them both on a W8.1 system. They seem to coexist happily on XP and 7.) Maybe you should debug this first...

Yes, I thought that may be an issue, but it seems I should be able to use atmel studio to do it as well.

Well, so far, you aren't close to having "burn bootloader" problems; you just haven't gotten AS6 to even compile Arduino programs. You need to get that part working before any of the bootloader tutorials will be relevant.

All the bootloader burn tutorials I know of rely on non-Atmel tools (usually avrdude) for the burn; I'm not sure that AS6 will talk to ArduinoISP directly.

jengil:
Yes, I thought that may be an issue, but it seems I should be able to use atmel studio to do it as well.

Most of this community knowledge and processes is based on using the arduino IDE, AS is a whole different universe and while I'm sure there are some members here that could get AS to work you are most likely going to have problems trying to locate needed information. Certainly using Windows 8.1 is no problem getting arduino platform and tools to work, only installing older 'unsigned' USB drivers requires special instructions but I was able to find such instructions on the web to get around that road bump.

I am re-installing the Arduino IDE now, see if I can get it to start or not :smiley: thanks for the replies.

I love the Arduino IDE, but I had to switch to Atmel Studio because I am virtually blind and I cannot see the font that Arduino IDE uses at all. I have made it 26 size font and it is still very difficult to see due to contrast, and letter thickness (apparently lots of people have this problem). Also - not to complain but the font selection is absolutely terrible on the IDE, if anyone knows a hack to change the font (not just the size) on the Arduino IDE I could consider switching back to that for all of my development needs.

Thanks again!!

Changing fonts: How to change IDE font in Windows? - Installation & Troubleshooting - Arduino Forum

I have reinstalled the Arduino IDE, and The IDE starts and still has the same errors when uploading as with Atmel Studio... Any Ideas? I know there has to be a simple way to do this as I know people have done it before.

jengil:
I have reinstalled the Arduino IDE, and The IDE starts and still has the same errors when uploading as with Atmel Studio... Any Ideas? I know there has to be a simple way to do this as I know people have done it before.

I've done this many times:

-Upload the ISP sketch to your Arduino.
-Then prepare your bare Atmega328P as shown in reply 1 tutorial.
-Check the connections twice.
-I just choose Arduino UNO as the board
-then I select programmer: Arduino as ISP
-Then select the option "burn bootloader" and viola.

Please paste here the error that Arduino IDE shows.

Alright - that is the exact process I have repeated about ten times ( the beginning steps ) this time i deleted the ISP and downloaded it again just in case, same issue. When I try to upload the ISP sketch to my Arduino this is the error message I receive:

In file included from C:\Arduino\hardware\arduino\cores\arduino/Arduino.h:213,
from ArduinoISP.pde:56:
C:\Arduino\hardware\arduino\variants\standard/pins_arduino.h:41: error: expected unqualified-id before numeric constant
C:\Arduino\hardware\arduino\variants\standard/pins_arduino.h:42: error: expected unqualified-id before numeric constant
C:\Arduino\hardware\arduino\variants\standard/pins_arduino.h:43: error: expected unqualified-id before numeric constant

These errors are BOTH on the Arduino IDE AND on Atmel Studio, so I am pretty sure that the code is the source, since the same thing is occurring on two different development environments. I never thought burning the bootloader could be such a huge hurdle to overcome. If anyone knows how to get past these errors or just another way to burn the bootloader - it is much appreciated - thanks a ton!

If it is really that much simpler to use a programmer I would consider purchasing one, but I need to get this to work first to see if its even an option I should consider. Does anyone have insight into the pros and cons of getting on of these as well?

Thanks again

Wasn't sure if anyone has seen the post in the last few days and I still have not resolved the issue. I have called and emailed Atmel and have been told to call local distributors, who tell me to call online distributor help design (digikey etc) and they tell me they don't know and to call Atmel. It seems like you all know better than the manufacturers themselves but for some reason I just cannot get this to work yet.... Any suggestions?? Thanks again

When I try to upload the ISP sketch to my Arduino this is the error message I receive:

C:\Arduino\hardware\arduino\variants\standard/pins_arduino.h:41: error: expected unqualified-id before numeric constant

You're not getting as far as "uploading" anything. The errors you are seeing are COMPILE errors that happen before the upload even starts. You shouldn't get compile errors in the core arduino files (like pins_arduino.h) when compiling the example programs (like ArduinoISP.pde) ; I don't know what is going on, and we're having enough communications issues that I'm not sure how to help (are we really on page 2 of this conversation without your telling us which version of the IDE you're using, and without anyone asking?) Which version of the IDE are you using? Do any of the trivial examples (like Blink) compile? Let's ignore Atmel studio, and bootloading, for a while and concentrate non figuring out why your Arduino IDE doesn't seem to be working at all...

The ideal help for a situation like this is a local wizard, perhaps at a hackerspace or school. You wouldn't happen to have one of those nearby?

Hellow Westy,

Thanks for the response, I am using V 1.0.5 r2 and everything else I have besides ArduinoISP sketch compiles. I actually used another set of code for the bootloader someone suggested on another post that has worked on the 328, and there is a Modified Arduino IDE that seems to work for everything but EEPROM so I can type in there and bring it over to the original IDE to compile and upload, but I still cannot use the ISP sketch due to this error. Unfortunately I am not very mobile at the time so I don't have access to hackerspace etc. I have come to a temporary solution but a simple font menu in the IDE would make my life sooo much easier! thanks again!

If your Uno has the 28 pin 328 chip, there is an extremely easy way to copy the Uno bootloader and fuses to a new chip. I have done it many times, takes a couple minutes.

Download eXtreme Burner Avr (it's free), plug your USBisp onto the ICSP header of the Uno, select Atmega 328P from Chips menu on Extreme, do a Read All, replace the 328 on your Uno with the new 328, do a Write all.

That's all there is to it. Easy as falling off a barstool.

If you don't have 328P on Chips menu (my older version did not) come back here and let me know. I will post the fix. You only need to add an item to the chips.xml file and replace the Fuselayout.xml file. You can do it with Notepad.

With eXtreme GUI software, you can also load and flash any .obj file to a chip and modify the fuses any way you want. Use Engbedded.com to calculate fuse values. I have also used it many times for flashing bootloaders onto ATMega8 chips. eXtreme GUI software is free but they beg for contributions. I was so happy to find this app after pulling my hair out for hours, I shelled out a few bucks for them.

This software worked fine on my Win7 computer, but if I remember correctly, I had to get LIBUSB0.DLL before I could run eXtreme on my Win8 laptop. For some reason, it is not included in Win8 and is needed for some USB stuff.