Programming and Uploading Bootloader to ATMEGA8L using Arduino IDE

Hi All, I have been working with ATMEGA8L lately and I have issues trying to upload it using my Arduino IDE. I have already managed to use the ATMEGA8U-16 and it works GREAT with the mini core boards definition. Since this ONE I am trying right now is OLDER and I need to be able to work with it - I am trying my best using the Arduino IDE using USBasp. Each and everytime I try I am getting Errors reffering my Clock, My USBasp and all kind of errors.

I have tried to add myself a board definition to Arduino IDE and still I am getting Errors: Basing it on an older configuration (Arduino NG or older w/ ATmega8):

atmega8.name=Arduino NG or older w/ ATmega8

atmega8.upload.protocol=arduino
atmega8.upload.maximum_size=7168
atmega8.upload.speed=19200

atmega8.bootloader.tool=avrdude
atmega8.bootloader.low_fuses=0xdf
atmega8.bootloader.high_fuses=0xca
atmega8.bootloader.path=atmega8L
atmega8l.bootloader.file=ATmega8L.hex
atmega8.bootloader.unlock_bits=0x3F
atmega8.bootloader.lock_bits=0x0F

atmega8.build.mcu=atmega8
atmega8.build.f_cpu=8000000L
atmega8.build.core=arduino
atmega8.build.variant=standard

With no luck at all Also I have been trying to use another settings - That I have found online:

###################
#### ATmega8L  ####
###################

# General
8l.name=ATmega8L
8l.upload.tool=avrdude
8l.upload.maximum_data_size=1024
8l.bootloader.tool=avrdude
8l.bootloader.unlock_bits=0x3f
8l.bootloader.lock_bits=0x0f
8l.bootloader.low_fuses=0xdf
8l.bootloader.high_fuses=0xca
8l.bootloader.low_fuses=0b{bootloader.bod_bits}{bootloader.sut_cksel_bits}
8l.build.core=MCUdude_corefiles
8l.build.variant=standard
8l.build.board=AVR_ATmega8
8l.build.mcu=atmega8

# Bootloader select
8l.menu.bootloader.true=Yes
8l.menu.bootloader.true.upload.maximum_size=7680
8l.menu.bootloader.true.upload.protocol=arduino
8l.menu.bootloader.true.bootloader.bootrst_bit=0
8l.menu.bootloader.true.bootloader.file=optiboot_flash/atmega8L/ATmega8L.hex

8l.menu.bootloader.false=No
8l.menu.bootloader.false.upload.maximum_size=8192
8l.menu.bootloader.false.bootloader.bootrst_bit=1
8l.menu.bootloader.false.bootloader.file=empty/empty.hex

# Brown out detection - This is the first part of the low fuse bit concatenation
8l.menu.BOD.2v7=2.7v
8l.menu.BOD.2v7.bootloader.bod_bits=10
8l.menu.BOD.4v0=4.0v
8l.menu.BOD.4v0.bootloader.bod_bits=00
8l.menu.BOD.disabled=Disabled
8l.menu.BOD.disabled.bootloader.bod_bits=11

# Compiler link time optimization
8l.menu.LTO.Os=Disabled (default)
8l.menu.LTO.Os.compiler.c.extra_flags=
8l.menu.LTO.Os.compiler.c.elf.extra_flags=
8l.menu.LTO.Os.compiler.cpp.extra_flags=
8l.menu.LTO.Os.ltoarcmd=avr-ar

8l.menu.LTO.Os_flto=Enabled
8l.menu.LTO.Os_flto.compiler.c.extra_flags=-Wextra -flto
8l.menu.LTO.Os_flto.compiler.c.elf.extra_flags=-w -flto
8l.menu.LTO.Os_flto.compiler.cpp.extra_flags=-Wextra -flto
8l.menu.LTO.Os_flto.ltoarcmd=avr-gcc-ar

# Clock frequencies - This is the second part of the low fuse bit concatenation
8l.menu.clock.16MHz_external=16 MHz external
8l.menu.clock.16MHz_external.upload.port=UART0
8l.menu.clock.16MHz_external.upload.speed=115200
8l.menu.clock.16MHz_external.bootloader.sut_cksel_bits=111111
8l.menu.clock.16MHz_external.bootloader.high_fuses=0b1100010{bootloader.bootrst_bit}
8l.menu.clock.16MHz_external.build.f_cpu=16000000L

8l.menu.clock.20MHz_external=20 MHz external
8l.menu.clock.20MHz_external.upload.port=UART0
8l.menu.clock.20MHz_external.upload.speed=115200
8l.menu.clock.20MHz_external.bootloader.sut_cksel_bits=111111
8l.menu.clock.20MHz_external.bootloader.high_fuses=0b1100010{bootloader.bootrst_bit}
8l.menu.clock.20MHz_external.build.f_cpu=20000000L

8l.menu.clock.18_432MHz_external=18.432 MHz external
8l.menu.clock.18_432MHz_external.upload.port=UART0
8l.menu.clock.18_432MHz_external.upload.speed=115200
8l.menu.clock.18_432MHz_external.bootloader.sut_cksel_bits=111111
8l.menu.clock.18_432MHz_external.bootloader.high_fuses=0b1100010{bootloader.bootrst_bit}
8l.menu.clock.18_432MHz_external.build.f_cpu=18432000L

8l.menu.clock.12MHz_external=12 MHz external
8l.menu.clock.12MHz_external.upload.port=UART0
8l.menu.clock.12MHz_external.upload.speed=57600
8l.menu.clock.12MHz_external.bootloader.sut_cksel_bits=111111
8l.menu.clock.12MHz_external.bootloader.high_fuses=0b1100010{bootloader.bootrst_bit}
8l.menu.clock.12MHz_external.build.f_cpu=12000000L

8l.menu.clock.8MHz_external=8 MHz external
8l.menu.clock.8MHz_external.upload.port=UART0
8l.menu.clock.8MHz_external.upload.speed=38400
8l.menu.clock.8MHz_external.bootloader.sut_cksel_bits=111111
8l.menu.clock.8MHz_external.bootloader.high_fuses=0b1100010{bootloader.bootrst_bit}
8l.menu.clock.8MHz_external.build.f_cpu=8000000L

8l.menu.clock.8MHz_internal=8 MHz internal
8l.menu.clock.8MHz_internal.upload.port=UART0
8l.menu.clock.8MHz_internal.upload.speed=38400
8l.menu.clock.8MHz_internal.bootloader.sut_cksel_bits=100100
8l.menu.clock.8MHz_internal.bootloader.high_fuses=0b1101010{bootloader.bootrst_bit}
8l.menu.clock.8MHz_internal.build.f_cpu=8000000L

8l.menu.clock.1MHz_internal=1 MHz internal
8l.menu.clock.1MHz_internal.upload.port=UART0
8l.menu.clock.1MHz_internal.upload.speed=9600
8l.menu.clock.1MHz_internal.bootloader.sut_cksel_bits=100001
8l.menu.clock.1MHz_internal.bootloader.high_fuses=0b1101010{bootloader.bootrst_bit}
8l.menu.clock.1MHz_internal.build.f_cpu=1000000L

On both I am getting Errors and can NOT make a Bootloader uploaded at all. As I have mentioned I have already managed to upload and code ATMEGA8-16PU and I have issues with [u]ATMEGA8L-8PU[/u]. :confused: :(

I would be happy if you could assist me on how to make this board work using USBasp and Arduino IDE. I have a USBasp Develop board that I use with ATMEL ATMEGA8-16PU boards and I want to be able to use it with these boards as well. Most common error that I get is sck error - sometime I am asked to use -F (forcing) and I wouyld be happy to know why?

Please do assist on this issue and I would be happy to have also be able to program the ATMEGA8L-8PU with our beloved Arduino IDE. :)

Thanks Aryeduino.

Regarding errors encountered during Burn Bootloader, please do this:

  • (In the Arduino IDE) File > Preferences
  • Check the checkbox next to "Show verbose output during: upload
  • Click “OK”
  • Tools > Burn Bootloader
  • After the Burn Bootloader process fails, you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button.
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the Burn Bootloader output between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If you have upload errors, post that verbose output too.

Arduino: 1.8.9 (Windows 7), Board: "ATmega8, Yes (UART0), BOD 2.7V, LTO disabled, 16 MHz external"

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\roei\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.2/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega8
         Chip Erase delay              : 10000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           efuse          0     0     0    0 no          0    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Error while burning bootloader.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.