loading

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

<p>Hi! </p><p>I keep struggling with this! We're getting this error ..</p><p>avrdude: no programmer has been specified on the command line or the config file</p><p> Specify a programmer using the -c option and try again</p><p>Error while burning bootloader.</p><p>I was wondering if you encountered this?</p>
<p>try modern approach to this problem: <a href="http://playground.arduino.cc/Main/ArduinoOnOtherAtmelChips" rel="nofollow"> http://playground.arduino.cc/Main/ArduinoOnOtherA...</a></p><p>MiniCore includes m8</p>
<p>Had to look out for hours and finally got successful.<br>The method which I followed has been summarised in the following instructable:<br><a href="https://www.instructables.com/id/ATmega8-As-Arduino-using-Internal-8Mhz-Crystal" rel="nofollow">https://www.instructables.com/id/ATmega8-As-Arduino-using-Internal-8Mhz-Crystal</a></p>
<p>Arduino: 1.6.11 (Windows 7), Board: &quot;Atmega8 Optoboot&quot;</p><p><em><strong>Warning: Board arduino:avr:atmega8o doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA8O</strong></em></p><p><em><strong>Build options changed, rebuilding all</strong></em></p><p><em><strong>avr-g++: error: atmega8o.build.f_cpu=16000000L: No such file or directory</strong></em></p><p><em><strong>exit status 1</strong></em></p><p><em><strong>Error compiling for board Atmega8 Optoboot.</strong></em></p>
<p>Try two things: change files in new IDE's locations:</p><p>C:\Users\YourPrfile\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.15</p><p>and this version of board for boards.txt (It's based on new IDE, you have to select board and cpu)</p><p>###############################################################</p><p>atmegang.name=ATmega8 optiboot</p><p>m8o.upload.tool=avrdude1<br>m8o.upload.protocol=arduino<br>m8o.upload.speed=19200</p><p>m8o.bootloader.tool=avrdude1<br>m8o.bootloader.unlock_bits=0x3F<br>m8o.bootloader.lock_bits=0x0F</p><p>m8o.build.mcu=m8o<br>m8o.build.f_cpu=16000000L<br>m8o.build.board=AVR_NG<br>m8o.build.core=arduino<br>m8o.build.variant=standard</p><p><br>## ATmega8 optiboot CPU<br>## ------------------------------<br>m8o.menu.cpu.atmega8=ATmega8</p><p>m8o.menu.cpu.atmega8.upload.maximum_size=7168<br>m8o.menu.cpu.atmega8.upload.maximum_data_size=1024</p><p>m8o.menu.cpu.atmega8.bootloader.low_fuses=0xbf<br>m8o.menu.cpu.atmega8.bootloader.high_fuses=0xdc<br>m8o.menu.cpu.atmega8.bootloader.file=optiboot/optiboot_atmega8.hex</p><p>m8o.menu.cpu.atmega8.build.mcu=atmega8</p><div>##############################################################</div>
<p>Can I do this without the crystal configuration? (using only the internal clock of atmega8-16 pu)</p>
<p>Yes, but with deferent configuration: fuses and freq. Also you should connect crystal for burning to avoid possibility of bricking uC. <br>Maybe you could make &quot;stand alone&quot; 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 </p>
<p>Oh! Better buy a crystal then :)<br><br>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. <br><br>It's my first time working with uCs ^^;</p>
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
Are quite simple to understand
<p>Hi Vidmo,</p><p>A simple question if I may to ask...</p><p>So, this process is for the ATMEGA8-16PU version only, or?</p><p>Kind regards</p>
<p>It should work with all atmega8 / 8L family. Be sure to check and set fuses correctly. Wrong fuses may brick your uC.<br></p><p>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...):</p><p>atmega8optiboot.name=ATmega8 (optiboot, 16Mhz XTAL)<br><br>atmega8optiboot.upload.protocol=arduino<br>atmega8optiboot.upload.maximum_size=7680<br>atmega8optiboot.upload.speed=115200<br><br>atmega8optiboot.bootloader.low_fuses=0xBF<br>atmega8optiboot.bootloader.high_fuses=0xCC<br>atmega8optiboot.bootloader.path=optiboot<br>atmega8optiboot.bootloader.file=optiboot_atmega8.hex<br>atmega8optiboot.bootloader.unlock_bits=0x3F<br>atmega8optiboot.bootloader.lock_bits=0x0F<br><br>atmega8optiboot.build.mcu=atmega8<br>atmega8optiboot.build.f_cpu=16000000L<br>atmega8optiboot.build.core=arduino<br>atmega8optiboot.build.variant=standard</p><p>So probably my solution would work as well for 8A, but, again remember to check fuses.</p>
<p>Hey Vidmo,</p><p>Please, don't confuse me now!</p><p> I'm talking only about ATMEGA8-16PU, did you used the same MCU in this project?</p><p>Kind regards</p>
Yes in this instructable I used atmega8-16PU. I should have write that.
<p>Thank you for the clear answer! ;)</p>
thank you for this great instruction it works great
<p>Cool project. If you have any more pictures of the process, we would love to see them.</p>
<p>As you suggested I added some pictures and also some thoughts.</p>
<p>Awesome! The most pictures you have the easier it is for people for follow along and replicate what you did. </p>

About This Instructable

6,243views

29favorites

License:

More by Vidmo:Arduino ATtiny Fan or Any DC Motor  PWM Speed Controller Programming Arduino Due and MKR1000 With Atmel Studio ASF Turn Arduino's serial converter into AVRISP mkII clone  
Add instructable to: