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

@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 :)

Comments

author
SamuelY16 made it! (author)2017-04-14

Hi!

I keep struggling with this! We're getting this error ..

avrdude: no programmer has been specified on the command line or the config file

Specify a programmer using the -c option and try again

Error while burning bootloader.

I was wondering if you encountered this?

author
Vidmo made it! (author)Vidmo2017-04-15

try modern approach to this problem: http://playground.arduino.cc/Main/ArduinoOnOtherA...

MiniCore includes m8

author
UtkarshVerma made it! (author)2017-04-13

Had to look out for hours and finally got successful.
The method which I followed has been summarised in the following instructable:
https://www.instructables.com/id/ATmega8-As-Arduino-using-Internal-8Mhz-Crystal

author
Vidmo made it! (author)2017-04-12

What version of IDE are you using?

Also paste here what IDE says whan you enable verbose output (file > preferences > show verbose output during: check both compilation and upload).

Or you may try simple way:

http://playground.arduino.cc/Main/ArduinoOnOtherAt...

MiniCore has ATmega8 with optiboot implemented.

author

thanks for the quick response....reverting to the previous ide version(1.0.1) helped! was finally able to blink the LED on my Atmega8's pin 18...So relieved!!

author
AshutoshK7 made it! (author)2017-03-05

Arduino: 1.6.11 (Windows 7), Board: "Atmega8 Optoboot"

Warning: Board arduino:avr:atmega8o doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA8O

Build options changed, rebuilding all

avr-g++: error: atmega8o.build.f_cpu=16000000L: No such file or directory

exit status 1

Error compiling for board Atmega8 Optoboot.

author
Vidmo made it! (author)Vidmo2017-03-05

Try two things: change files in new IDE's locations:

C:\Users\YourPrfile\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.15

and this version of board for boards.txt (It's based on new IDE, you have to select board and cpu)

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

atmegang.name=ATmega8 optiboot

m8o.upload.tool=avrdude1
m8o.upload.protocol=arduino
m8o.upload.speed=19200

m8o.bootloader.tool=avrdude1
m8o.bootloader.unlock_bits=0x3F
m8o.bootloader.lock_bits=0x0F

m8o.build.mcu=m8o
m8o.build.f_cpu=16000000L
m8o.build.board=AVR_NG
m8o.build.core=arduino
m8o.build.variant=standard


## ATmega8 optiboot CPU
## ------------------------------
m8o.menu.cpu.atmega8=ATmega8

m8o.menu.cpu.atmega8.upload.maximum_size=7168
m8o.menu.cpu.atmega8.upload.maximum_data_size=1024

m8o.menu.cpu.atmega8.bootloader.low_fuses=0xbf
m8o.menu.cpu.atmega8.bootloader.high_fuses=0xdc
m8o.menu.cpu.atmega8.bootloader.file=optiboot/optiboot_atmega8.hex

m8o.menu.cpu.atmega8.build.mcu=atmega8

##############################################################
author
MarcGo26 Productions made it! (author)2016-08-09

Can I do this without the crystal configuration? (using only the internal clock of atmega8-16 pu)

author
Vidmo made it! (author)Vidmo2016-08-11

Yes, but with deferent configuration: fuses and freq. Also you should connect crystal for burning to avoid possibility of bricking uC.
Maybe you could make "stand alone" atmega with clock by soldering it on top of uC with capacitors. I made few... (It's topic for nwew instructable :). It should look something like this: http://www.niklasroy.com/project/116/Lumenoise

author

Oh! Better buy a crystal then :)

By the way, how I change the configurations like fuses, clock settings, or frequencies? Mine is actually Atmega8A-PU and I'm pretty sure I have to change things.

It's my first time working with uCs ^^;

author
Vidmo made it! (author)Vidmo2016-08-15

I pasted configuration for 8A in comment below. You should find it in internet. What fuses actually mean can be found in atmel fuses calculator, other parameters are

author
Vidmo made it! (author)Vidmo2016-08-15

Are quite simple to understand

author
beic made it! (author)2016-06-10

Hi Vidmo,

A simple question if I may to ask...

So, this process is for the ATMEGA8-16PU version only, or?

Kind regards

author
Vidmo made it! (author)Vidmo2016-06-10

It should work with all atmega8 / 8L family. Be sure to check and set fuses correctly. Wrong fuses may brick your uC.

I found some code from 1.0 IDE's boards file for atmega8A (I didn't test it. I read that 8As have some issues with arduino...):

atmega8optiboot.name=ATmega8 (optiboot, 16Mhz XTAL)

atmega8optiboot.upload.protocol=arduino
atmega8optiboot.upload.maximum_size=7680
atmega8optiboot.upload.speed=115200

atmega8optiboot.bootloader.low_fuses=0xBF
atmega8optiboot.bootloader.high_fuses=0xCC
atmega8optiboot.bootloader.path=optiboot
atmega8optiboot.bootloader.file=optiboot_atmega8.hex
atmega8optiboot.bootloader.unlock_bits=0x3F
atmega8optiboot.bootloader.lock_bits=0x0F

atmega8optiboot.build.mcu=atmega8
atmega8optiboot.build.f_cpu=16000000L
atmega8optiboot.build.core=arduino
atmega8optiboot.build.variant=standard

So probably my solution would work as well for 8A, but, again remember to check fuses.

author
beic made it! (author)beic2016-06-10

Hey Vidmo,

Please, don't confuse me now!

I'm talking only about ATMEGA8-16PU, did you used the same MCU in this project?

Kind regards

author
Vidmo made it! (author)Vidmo2016-06-11

Yes in this instructable I used atmega8-16PU. I should have write that.

author
beic made it! (author)beic2016-06-11

Thank you for the clear answer! ;)

author
MatthiasB13 made it! (author)2016-05-31

thank you for this great instruction it works great

temp_1277466574.jpgtemp_172095094.jpg
author
DIY Hacks and How Tos made it! (author)2015-10-11

Cool project. If you have any more pictures of the process, we would love to see them.

author
Vidmo made it! (author)Vidmo2015-10-12

As you suggested I added some pictures and also some thoughts.

author

Awesome! The most pictures you have the easier it is for people for follow along and replicate what you did.