Skip to content
March 31, 2014 / Karthikeyan Natarajan

Programming Atmega8 using Arduino Uno (Rev3)

I started playing with Arduino Uno recently. I had bought one Atmega8L to make USBASP. But earlier I could not get burn it with Arduino as ISP.

When uploading Bootloader I got the following error.

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x11
avrdude: Send: V [56] @ [40] . [00] . [00]   [20]   [20] 
avrdude: Recv: . [12] 
avrdude: stk500_cmd(): programmer is out of sync

In order to avoid such errors, don’t use the examples>Arduino ISP. Use this file’s content

https://raw.github.com/lxkarthi/ArduinoISP/master/ArduinoISP/ArduinoISP.ino

This is because the Arduino ISP for Arduino Uno will work for 9600 baud rate only.

Today, I started with connecting atmega8 to Arduino Uno with the following diagram

Image

After connection, I chose

Board > Arduino UNO
Programmer > USBasp

Open the downloaded ArduinoISP.ino and Click Upload.

After this, I created a file  /home/karthikeyan/sketchbook/hardware/breadboard/board.txt

opti8.name=Arduino Optiboot8

opti8.upload.protocol=stk500v1
opti8.upload.maximum_size=7680
opti8.upload.speed=9600

opti8.bootloader.low_fuses=0xbf
opti8.bootloader.high_fuses=0xdc
opti8.bootloader.path=arduino:optiboot
opti8.bootloader.file=optiboot_atmega8.hex
opti8.bootloader.unlock_bits=0x3F
opti8.bootloader.lock_bits=0x0F

opti8.build.mcu=atmega8
opti8.build.f_cpu=12000000L
opti8.build.core=arduino:arduino
opti8.build.variant=arduino:standard

Close and open the Arduino IDE. Now choose

Board > Arduino Optiboot8
Programmer > Arduino as ISP

Now you can choose ‘Burn Bootloader’ or open any example and Upload.
This has been tested with Ubuntu. It will work for windows too.

If you want to test with example programs (eg. Blink), open it and choose ‘Upload using Programmer‘.

Advanced understanding:

Note that, the upload protocol is stk500v1 and speed is  9600.
‘arduino:optiboot’ means folder optiboot in /usr/share/arduino/hardware/arduino folder (arduino installed folder).
‘arduino:standard’ means variant standard in arduino installed folder.
If you want to have locally installed variant, bootloaders, cores, remove ‘arduino:’ in board.txt. Create directory structure similar to arduino installed folder at /home/karthikeyan/sketchbook/hardware/breadboard

If you get errors, in Preferences, enable verbose output for upload and check the error.
If you want to burn your own hex file (like usbasp hex file), copy the command used for burning in verbose mode and just change the file name/location.

Source: http://forum.arduino.cc/index.php?topic=89579.0
http://nirzaree.wordpress.com/2012/03/07/make-a-standalone-atmega8-circuit/
http://todbot.com/blog/2009/05/26/minimal-arduino-with-atmega8/comment-page-5/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: