When using the LCD I/O Backpack with the ATmega8L-8AU, you need a bootloader that runs at 8 MHz.
But the one shipping with Arduino for the ATmega8 has some less than ideal settings, most annoyingly a very long startup delay and a low speed for the serial programming.
I have now made a re-compile of the bootloader with these two settings changed (about 1 second startup delay and 19200bps serial speed), which results in faster programming, and a much shorter startup time, both from power-on but also after a soft reset following programming.
All you need, is to download the .hex file and place in in the atmega8 folder under hardware/arduino/bootloaders in the Arduino environment and modify the boards.txt file to include this new bootloader.
On Mac, you have to right-click the Arduino.app and select ‘Show Package Content’ and navigate to Content/Resources/Java/hardware/arduino/bootloaders to find the atmega8 folder.
I have used the following segment in boarts.txt to reference this file in the Arduino environment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ############################################################## atmega8l.name=LCD I/O Backpack w/ ATmega8L @ 8MHz atmega8l.upload.protocol=stk500 atmega8l.upload.maximum_size=7168 atmega8l.upload.speed=19200 atmega8l.bootloader.tool=avrdude atmega8l.bootloader.low_fuses=0xdf atmega8l.bootloader.high_fuses=0xca atmega8l.bootloader.path=atmega8 atmega8l.bootloader.file=ATmega8L.hex atmega8l.bootloader.unlock_bits=0x3F atmega8l.bootloader.lock_bits=0x0F atmega8l.build.mcu=atmega8 atmega8l.build.f_cpu=8000000L atmega8l.build.core=arduino atmega8l.build.variant=standard ############################################################## |
Downloads
Below is just the .hex file, zipped up to avoid corruption. The source is the same as the source that comes with the Arduino environment (in the hardware/atmega8 folder) just adjusted to 8MHz and with a timeout of 1000000)
Tip
If you want to compile your own, you might have to use the AVR-GCC compiler from one of the older Arduino enviromnents (I used Arduino-0010 on Mac), since the newer AVR-GCC complains a bit.
Update for users of Arduino 1.0 and later
Ray has notified me about a problem when using the above instructions with Arduino 1.0. The reason for the error he is getting is a change that the Arduino team has made, which my instructions didn’t take into account. I have updated the text you need to add to the boards.txt (added the last settings line), which tells the compiler what pins settings to use, when compiling for the ATmega8L.
Update for users of Arduino 1.6 (I think) and later
Mark has notified me about a problem when using the above instructions with Arduino 1.6+. The reason for the error he is getting is a change that the Arduino team has made, which my instructions didn’t take into account. I have updated the text you need to add to the boards.txt (added the line with atmega8l.bootloader.tool=avrdude), which tells the IDE to use AVRdude to program the bootloader.
The Arduino IDE has been changed a lot recently, and since this post is somewhat popular, I might try to make a board definition that can be loaded via the Board Manager (using a custom URL in Arduino IDE 1.6.5+)
HEY THOMAS! GREAT WORK! i have a question can i use this bootloader that you have made for AVRprog? i am newbee in using bootloader on my atmega8L. and i not that good in C programming but average on assembly language. can you helped me with my project? please…advance thanks mr. thomas!=)
Hi Pekto,
I don’t think this bootloader will work with AVRprog, as far as can see, it’s meant to be used in a different way, but I must admit, I have never used AVRprog, so I might be mistaking.
This bootloader is designed to be used with AVRdude (or the Arduino environment) for serial programming and should be programmed into the chip the first time using an AVR ISP (eg. http://store.atmel.com/PartDetail.aspx?q=p:10500054)
/Thomas
sir i have a question..i saw this avprog source code .http://sourceforge.net/projects/avrprog2/?source=directory .i dont know how to edit the program..it seems like in c++ programming?? can you guide me on how to edit the baud rate of this software? i am using this bootloader http://www.dl5neg.de/bootloader/bootloader.html, while i am programming it seems like to slow for me.compared to arduino bootloaders..can you help me ? i think you have the ideas..thanks alot! waiting for your reply =)
Hi, Thomas with these board.txt settings with latest arduino v1.00, when i tried to compile a blink sketch i got the following error
\arduino-1.0-windows\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory
I am trying to use the atmega8l chips available at my place.
Can i compile the sketch for the board (which seems to be fine) Arduino NG or older /w atmega 8 and burn the HEX file on the atmega8l chip?
Hi Ray and thanks for letting me know about this issue.
I’m sorry I haven’t had time to look into it until now, but I have updated the instructions above (it’s just one additional line in the boards.txt file) to include the needed changes.
If you still have trouble compiling, feel free to drop me a line!
/Thomas
Can any1 help me in selecting board for Atmega8-L micro controller…………
What is it you want to accomplish? All you need to get the ATmega8L up and running is power a few caps and maybe a crystal. I have used them with the LCD I/O Backpack that I designed. The board layout is available for download if you want to make your own.
/Thomas
Hi, thanks for your work on the ATMEGA8L bootloader. I have a piece of hardware containing the ATMEGA8L and although I can load code with a programmer I can’t seem to get a bootloader working. With your bootloader burned but with my own fuses settings:
atmega8L.bootloader.low_fuses=0xe4
atmega8L.bootloader.high_fuses=0xca
I see the following:
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is “C:\Users\John\Documents\arduino\hardware/tools/avr/etc/avrdude.conf”
Using Port : \\.\COM14
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
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
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
———– —- —– —– —- —— —— —- —— —– —– ———
flash 33 10 64 0 yes 8192 64 128 4500 4500 0xff 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
———– —- —– —– —- —— —— —- —— —– —– ———
lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
———– —- —– —– —- —— —— —- —— —– —– ———
hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
———– —- —– —– —- —— —— —- —— —– —– ———
lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
———– —- —– —– —- —— —— —- —— —– —– ———
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
———– —- —– —– —- —— —— —- —— —– —– ———
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
avrdude: Send: A [41] . [80] [20]
avrdude: Recv:
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x41
avrdude: Send: A [41] . [81] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [01]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [82] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [12]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [98] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Hardware Version: 1992068309
Firmware Version: 1.18
Topcard : Unknown
avrdude: Send: A [41] . [84] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [85] [20]
avrdude: Recv:
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x41
avrdude: Send: A [41] . [86] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: A [41] . [87] [20]
avrdude: Recv:
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x41
avrdude: Send: A [41] . [89] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
Vtarget : 0.0 V
Varef : 357755337.3 V
Oscillator : Off
SCK period : 0.1 us
avrdude: Send: A [41] . [81] [20]
avrdude: Recv:
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x41
avrdude: Send: A [41] . [82] [20]
avrdude: Recv:
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x41
avrdude: Send: B [42] p [70] . [00] . [00] . [01] . [01] . [01] . [01] . [02] . [ff] . [00] . [ff] . [ff] . [00] @ [40] . [02] . [00] . [00] . [00] [20] . [00] [20]
avrdude: Recv:
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x42
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: Send: Q [51] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
avrdude done. Thank you.
————
I have some concerns over my reset line but have a cap & diode installed as I have seen posted elsewhere. Do you have any thoughts on my problem?
Regards, John.
Hei, could you provide the source/makefile as well? I’d like to see what you changed so I can understand a bit more..
Thanks
Well, I tried you procedure but I’m getting
Binary sketch size: 832 bytes (of a 7168 byte maximum)
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
I want to reprogram one of these Jy 3208 clock boards from Deal Extreme
LINK: http://www.dealextreme.com/p/jy-mcu-3208-lattice-clock-ht1632c-driver-with-mcu-support-secondary-development-104306
so I just bought a ATMEGA8L from digikey to experiment with. So far I haven’t even gotten the blink sample program to work on it. .
@Wesley Wortman
When programming the chips using a programmer like the AVRISPmkII or similar, I had trouble getting it to work without having a crystal or other frequency generator connected. I believe it should be possible to use these chips without a crystal (only the internal oscillator) but my attempts was unsuccessful.
I have ordered one of the boards you mentioned, and will give it a try when I get it in (will probably take some weeks). The boards look pretty nice and could be fun for various projects.
@Norwegian Shrubbery
If I can’t find it, I’ll try to recreate.
I’ll try to see if I can find them… I have changed machine a few times since, and I’m not sure everything got moved over
Can this bootloader be used for atmega8A chip ? So if I burn this bootloader I do not need to use external crystal ?
Thanks
Hi Vick,
This bootloader should also work on the ATmega8A, worst case is that you will need to recompile it, but I don’t even think that is necessary. Selecting the clock is actually not part of the boot loader, but the fuses set during programming. There are various online tools to help you find the right fuse bits to use if you want to change these, just be careful, there are also fuse bits that lock the firmware.
Hey thomas,
one simple question..
with this bootloader, is atmega8L supposed to run with internal 8Mhz xtal ?
Hi,
If I remember correctly, this is made to use an external crystal, but changing the fuses is probably all it takes to use the internal oscillator instead, though I haven’t gotten it to work correctly.
Hope it helps.
/Thomas
sir , i have atmega8L microcontroller and i want to burn arduino bootloader ,,can i burn your bootloader on this microcontroller by using arduino uno (arduino as isp),,i am new to bootlading microcontroller plz help or suggest me which cystal i have to use (16mhz or 8mhz)
Hi Rishabh,
You should be able to use an Arduino as ISP to burn the bootloader onto an ATmega8L.
If you are using the bootloader I have here on the site, you will need to use an 8 MHz crystal.
The ATmega8L chip is a special low power and low speed version, so that can’t be used with a 16 MHz crystal.
/Thomas
I have recently bought a digital rms wattmeter consisting an ATMEGA8L-8PU IC which is already programmed and working fine in digital RMS wattmeter. I bought another ATMEGA8L-8PU IC and just tried to copy the data from previous IC to the newly bought IC.
I am using Minipro universal EEPROM programmer version 6. After reading and writing the program in new IC, when i replace the original IC with the newly programmed one…..it is not working properly.
I am new in programming ATMEGA8L-8PU and i dont understand why the same program in two identical ICs are not working identically. I guess there is code protection associated with this IC. If it is code protected, is there any way to read original code.
Am I missing any step or do I need any other software or programming kit for this.
Please help.
Thanks.
Hi Suvodeep,
I haven’t tried doing a clone in that way, so unfortunately I’m unable to give any help in that area, but one thing you might have missed are the fuse settings in the AVR chip. Those are used to configure things like clock frequency, brown-out detection, etc.
I hope this might help you in the right direction!
/Thomas
I would really like to use this hack, but unfortunately I get this error message when trying to burn the bootloader: “Error while burning bootloader: missing ‘bootloader.tool’ configuration parameter”
I have downloaded and placed the .hex file in the given folder and added the ATmega8L “settings” in boards.txt
The micro controller is a ATmega8L-8PU.
Do you know how to fix this?
Hi Mark,
My guess is that for the newer versions of the Arduino IDE, you also need a
atmega8l.bootloader.tool=avrdude
in boards.txt.I haven’t tried it myself yet, but give it a go and let me know how it goes.
Hope it helps,
/Thomas
Hi Thomas.
It definitely made progress in the right direction. Thanks. Now I’m stuck with a “avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00″ which to me indicate it’s a wrong or dead micro controller I’m trying to write with the given commands.
/Mark
Hi Mark,
Hmmm… it might be issues with a crystal being connected or not connected. I remember having some trouble years ago when programming a bunch of these, but I can’t remember exactly what the problem was, but it was something with either the wrong frequency crystal or something like that preventing me from programming the MCU via ISCP. If I remember correctly, removing the crystal, made it programmable, and later I could put in the crystal again to have it run, but it’s a little fuzzy
/Thomas
If is still doesn’t work, change upload.protocol to “arduino” instead of stk500.
Hi,
I am new here, can I use an Arduino as ISP to burn the bootloader onto an ATmega8L using your file type .hex ?
if not how can I upload the bootloader into the ATmega8L ?
please help me.