Introduction: How to Burn Optiboot Botloader on Atmega8 With Arduino IDE 1.6.x and 1.5.x

About: hacker working as hacker

@Edit: Try this first http://playground.arduino.cc/Main/ArduinoOnOtherA... MiniCore includes ATmega8 with optiboot.

Also somewhere in comments in new code for boards.txt for newer IDE.

I used old NG bootloader, but I have some troubles with it. It takes about 8 seconds to start Atmega, and it stucked sometimes. When I wanted to burn optiboot, I get message:

"efuse" memory type not defined for part "ATMEGA8"

This tutorial shows how to burn optiboot on Atmega8-16PU from begining to the end.

If you want to use other uC from Atmega8 family you will probably have to change fuses in boards.txt

It is not about Atmega8L nor Atmega8A. If you want to use one you will probably need to modify my code for boards.txt (I mean fuses).

Check twice if you have correct fuses for corresponding chip, because wrong fuses may brick your uC.

Pros for using optiboot:

  • Arduino starts immediately after powering
  • Arduino can be programmed faster
  • Arduino is more reliable

Step 1: Add Atmea8 Optiboot to Boards.txt

Open boards.txt, which is in: Arduino\hardware\arduino\avr (in your main Arduino folder). Do not use MS notepad it will mess everything up. WordPad is much better, but I'm pretty shure that every decent text editor will be as good.

and add at the end :

##############################################################

atmega8o.name= Atmega8 Optoboot

atmega8o.upload.tool=arduino:avrdude1

atmega8o.upload.protocol=arduino

atmega8o.upload.maximum_size=7680

atmega8o.upload.speed=115200

atmega8o.bootloader.tool=avrdude1

atmega8o.bootloader.low_fuses=0xbf

atmega8o.bootloader.high_fuses=0xdc

atmega8o.bootloader.path=optiboot

atmega8o.bootloader.file=optiboot\optiboot_atmega8.hex

atmega8o.bootloader.unlock_bits=0x3F

atmega8o.bootloader.lock_bits=0x0F

atmega8o.build.mcu=atmega8 atmega8o.build.f_cpu=16000000L

atmega8o.build.core=arduino:arduino

atmega8o.build.variant=arduino:standard

##############################################################

You heve to be shure, that lines atmega8o.bootloader.tool=avrdude1 and atmega8o.upload.tool=arduino:avrdude1, contain avrdude1 insted of avrdude.

Step 2: Change Avrdude Parameters in Platform.txt

platform.txt is in the same directory with boards.txt. You need to find section titled:

# AVR Uploader/Programmers tools

# ------------------------------

Copy default lines and paste them after old ones. Do not delete old. Chane avrdude to avrdude1 in new prorammer settings and delete "-Uefuse:w:{bootloader.extended_fuses}:m" from line titled "tools.avrdude.erase.pattern="

Or You can simply copy my code and paste it after standard programmer settings:

#####
tools.avrdude1.path={runtime.tools.avrdude.path}

tools.avrdude1.cmd.path={path}/bin/avrdude

tools.avrdude1.config.path={path}/etc/avrdude.conf

tools.avrdude1.upload.params.verbose=-v

tools.avrdude1.upload.params.quiet=-q -q

tools.avrdude1.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude1.program.params.verbose=-v

tools.avrdude1.program.params.quiet=-q -q

tools.avrdude1.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude1.erase.params.verbose=-v

tools.avrdude1.erase.params.quiet=-q -q

tools.avrdude1.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude1.bootloader.params.verbose=-v

tools.avrdude1.bootloader.params.quiet=-q -q

tools.avrdude1.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m

#####

Step 3: Connect Your Atmega8 and Burn It

Remember not to use Atmega8L with this boards.txt settings.

Burning the Bootloader
If you have a new ATmega8, you'll need to burn the bootloader onto it. You can do this using an Arduino board as an in-system program (ISP). To burn the bootloader, follow these steps: Upload the ArduinoISP sketch onto your Arduino board. (You'll need to select the board and serial port from the Tools menu that correspond to your board.) Wire up the Arduino board and microcontroller as shown in the diagram.Select "Atmega8 optiboot" from the Tools > Board menu. Run Tools > Burn Bootloader > w/ Arduino as ISP. (not ArduinoISP it is not he same.) You should only need to burn the bootloader once. After you've done so, you can remove the jumper wires connected to pins 10, 11, 12, and 13 of the Arduino board.

this was modified from original arduino.cc tutorial: arduino.cc/en/Tutorial/ArduinoToBreadboard

Only difference is that you need to select Atmega8 Optoboot from tools>board

If everything was correct your Atmega8 can be used in arduino or in your standalone projects.

Step 4: Make Something Cool

like for an example my nixie clock :)