Arduino IDE 1.0.1 and ATmega8 running at 8MHz with Optiboot

So I wanted to program the ATmega8 with USBASP, Arduino IDE and its libraries. It works fine by first adding two components to the mix: an optiboot and a new boards section.

I had to change a few fuse bits first, so that I could use the serial too (and other little details):

avrdude -c usbasp -p m8 -U hfuse:w:0xCC:m -u
avrdude -c usbasp -p m8 -U lfuse:r:lfuse.h:i -v

Here’s the appropriate Optiboot, it’s for ATmega8 running at 8MHz internal clock: Optiboot Atmega8 8MHz
Create a folder .\arduino-1.0.1\hardware\arduino\bootloaders\optiboot_atmega8_8\ and extract the file optiboot_atmega8_8.hex there inside.

Modify the file .\arduino-1.0.1\hardware\arduino\boards.txt by adding these few lines:

##############################################################
#
#  Source: http://arduino.cc/forum/index.php?topic=116404,0
#  by Perhof (Sweden)
#
atmega8_opti_8mhz.name=ATmega8 Optiboot (8MHz internal OSC)
atmega8_opti_8mhz.upload.protocol=arduino
atmega8_opti_8mhz.upload.maximum_size=7680
atmega8_opti_8mhz.upload.speed=9600
atmega8_opti_8mhz.bootloader.low_fuses=0xa4
atmega8_opti_8mhz.bootloader.high_fuses=0xcc
atmega8_opti_8mhz.bootloader.path=optiboot_atmega8_8
atmega8_opti_8mhz.bootloader.file=optiboot_atmega8_8.hex
atmega8_opti_8mhz.bootloader.unlock_bits=0x3F
atmega8_opti_8mhz.bootloader.lock_bits=0x0F
atmega8_opti_8mhz.build.mcu=atmega8
atmega8_opti_8mhz.build.f_cpu=8000000L
atmega8_opti_8mhz.build.core=arduino
atmega8_opti_8mhz.build.variant=standard
#
##############################################################

Save it and close it.

Now run Arduino 1.0.1, select the appropriate “ATmega8 Optiboot (8MHz internal OSC)” entry, upload the bootloader and finally start compiling and uploading any sketch you want.

Posted in Uncategorized