AVR Tutorial 2: AVR Studio Quick Start Guide

You just created a hex file and you are ready to program the microcontroller with this file. To program an AVR microcontroller, you need an AVR programmer. There are plenty of AVR programmers available today. Therefore, I am suggesting that you read and follow your programmer’s user manual. For the sake of this tutorial,  I am going to demonstrate how to use a programmer to program ATmega8 using AVRISP. Please not that if you have a different programmer, read your programmer’s user manual.

Build the circuit shown below. You may use the IO Led Monitor, 28-pin AVR Breakout Board, and DIY Power Supply to build the circuit.

Connect AVRISP to ATmega8 using the AVR ISP header connector.

12. To start programming ATmega8 using AVRISP, go to the toolbar and click the Connect tool menu.

13. Next, you need to select a programmer. Under the Platform field, select AVRISP. Under the Port field, select Auto. Click the Connect button.

14. Now you see the STK500 in ISP mode with ATmega8 window. Go to the Main tab. Under the Device and Signature Bytes, select ATmega8. Then, click the Read Signature button. Verify that the signature matches selected device. If a warning dialog box appears, just follow the recommendations shown on the dialog box.

15. Go to the Fuses tab. Set the fuses as shown below and click Program. This step lets you to set how the ATmega8 will act, at what voltage and frequency will it run, and where will it get its clock source.

Below is the basic information about the fuses of ATmega8:

RSTDISBL – programming this will disable the Reset pin of ATmega8 and will use the pin as a normal IO pin.However, the ISP capability of ATmega8 will also be disabled and you can only enable it using a High-voltage programmer. Normally, it is undesirable to disable ISP capability of ATmega8 because you won’t be able to use your favorite ISP programmer anymore (unless you enable ISP using a High-voltage programmer).

WTDON – programming this will enable the Watchdog timer

SPIEN – it enables ISP.

EESAVE – if this fuse bit is programmed, EEPROM memory is saved during Flash ERASE and WRITE cycle.

BOOTSZ – this sets the size of the bootloader section located in ATmega8′s flash memory.

BOOTRST – programming this will make ATmega8 to start its program execution from its flash bootloader section. Do not enable this if you don’t have a bootloader.

BODLEVEL -  this sets at what voltage level will ATmega8 turn its brown-out protection circuitry on.

BODEN – it enables brownout detection

SUT_CKSEL – this selects the clock source, clock frequency, and startup time. In this series of tutorial, we will always use internal 8MHz RC clock oscillator as our clock source.

16. Now go to the Program tab. Check the Erase device before flash programming and Verify device after programming checkboxes. Under the flash memory field, load the hex file that you previously created. Click Program.

Congratulations! You just programmed your AVR microcontrollerr.

The video below shows the ATmega8 running after just being programmed by AVRISP.

 

Pages: 1 2 3

Speak Your Mind

*