Go Down

Topic: Burning a Bootloader using AVR Studio 4 & Pololu AVR programmer (Read 2434 times) previous topic - next topic

bpospick

Ok, I'm a newbie and could use help in making sense of burning bootloaders.

I built a board with a brand new ATmega328P [in hopes of making a Duemilanove-like Arduino from scratch].  Using the instructions on the Arduino.cc website to burn the bootloader using a known good Duemilanove, resulted in lots of frustration - cryptic error messages.  Called an engineer friend who brought over his oscilloscope and found that the virgin 328P wasn't oscillating since the fuses had yet to be burned.  Using AVR Studio 4 and a Pololu AVR programmer (emulates a AVRISP v2 according to their website) we were able to get it to make squiggly lines on the scope - it's now oscillating!  One step closer ...

Now I'm confused as to the next steps.  There are dozens of tutorials on the web, but the more I read, the more I get confused. Partly because my board isn't exactly like the tutorials, or the tutorial uses a different programmer. HW:  328P, 16 MHz resonator, will eventually link to a FT232RL to be just like a Duemilanove.

The boards.txt file in the arduino-1.0/hardware/arduino directory describes the fuses, lock bits, and the hex file (ATmegaBOOT_168_atmega328.hex) for the bootloader.  Can I just takes this hex file and upload it using the AVR Studio 4 & the AVRISP programmer? If so, what are the steps?  NB:  I'm paranoid about smoke testing or permanently locking another uC.

The fuse settings shown in the Read command (AVR Studio) don't exactly match what's listed in the boards.txt file.  I've tried to match them, but can't find any reference to the "unlock" bits in the 328P manual.  Any thoughts?

If there is a simpler way to load the bootloader and set the fuses, please let me know.

Coding Badly


Does this help...
http://arduino.cc/forum/index.php/topic,61776.0.html

bpospick

Well, this is kind of where I started from (http://arduino.cc/en/Tutorial/ArduinoToBreadboard) and found no joy. 

I'll experiment with this tonight; however I was really looking for a way to upload the bootloader on the new board using the AVR Studio.  I conceptually understand that the bootcode hex file gets programmed starting at memory location $3C00 ... at least according to the fuse setting.

I'm confused as to the difference between Optiboot and the file that is listed in the boards.txt file.  If anyone has a simple explanation, I'd appreciate it.

Finally, does this method program the fuses & lock bits as well?

NB, perhaps I should just "assume a miracle occurs" and be happy that it works.  But one side of my brain - can't remember which - wants to know the details.


Coding Badly

I'll experiment with this tonight; however I was really looking for a way to upload the bootloader on the new board using the AVR Studio.


Roughly the steps are (order may not be correct; listed from memory)...

* Change the lock bits so the bootloader area can be written
* Upload the bootloader
* Change the lock bits so the bootloader is protected
* Change the fuse bits

Quote
I'm confused as to the difference between Optiboot and the file that is listed in the boards.txt file.  If anyone has a simple explanation, I'd appreciate it.


Which file listed in boards.txt?

Quote
Finally, does this method program the fuses & lock bits as well?


Yes.

Coding Badly


This may help...
http://arduino.cc/forum/index.php/topic,76248.msg614604.html#msg614604

westfw

Quote
The difference between Optiboot and the file that is listed in the boards.txt file.


Optiboot is used on the Arduino Uno and is .../hardware/arduino/bootloaders/optiboot/optiboot_atmega328.hex
Duemilanove and earlier arduinos used a different bootloader, from .../hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex

You can use either one in your custom board, BUT:

  • They're different sizes, so you'll have to set the bootloader-related fuse bits differently depending on which one you use.

  • You'll need to use the appropriate "board type" from the IDE menu when uploading sketches.  Call it an Uno if you loaded optiboot, or a "Duemilanove w/ 328" if you loaded ATmegaBOOT.



Go Up