Program your attiny2313 with an Arduino

This is the second part of setting up an Arduino to program an Attiny microcontroller, in the previous parts we added support for the variety of microcontrollers. For reference purposes this is what the Attiny2313 will be like when you do this, the pins and the corresponding Arduino pins are shown

attiny2313-pinout
attiny2313-pinout

Now lets crack on with the setup

Setup attiny2313 connection with Arduino board

Connect up your Attiny2313 to your Arduino as follows

1) attiny2313 pin 1 to arduino pin 10 reset
2) attiny 2313 pin 17 to arduino pin 11 MOSI
3) attiny2313 pin 18 to arduino pin 12 MISO
4) attiny2313 pin 19 to arduino pin 13 SCK
5) attiny2313 pin 10 to arduino GND
6) attiny2313 pin 20 to arduino VCC

Here is a layout

Arduino to atttiny2313
Arduino to atttiny2313

Open the ArduinoISP program and upload the ArduinoISP program to the Arduino board to turn it into an ISP programmer. Now, open up the BLINK sketch, and upload the BLINK sketch to Attiny2313 via “Upload Using Programmer” option on the Arduino IDE as follows

1) Open ArduinoISP program.
File>Examples>ArduinoISP

2) Select the serial port.
Tools>Port>COM5 (yours may differ)

2) Select the required Arduino board, in this case we are using an Arduino Uno.
Tools>Board>Arduino Uno

3) Set the programmer type as AVRISP MKII.
Tools>Programmer>AVRISP MKII

4) Press the upload button.

5) Now your Arduino Uno is setup as the ISP programmer. Next open up the LED Blink sketch.
File>Examples>Basics>Blink

6) Select the AVR target for the Arduino ISP to program to.
Tools>Board>ATtinyx313

7) Change the Board for the Arduino ISP to program to.
Tools>Chip>ATtiny2313

8) Make sure the Clock for the Arduino ISP is set to 8Mhz.
Tools>Clock>8mhz(internal)

You can see these settings in the screenshot below

attinyx313
attinyx313

9) Set the programmer mode.
Tools>Programmer>Arduino as ISP

10) Finally, start the sketch upload to the Attiny2313 microcontroller
File>Upload

 

If you connect an LED to pin 16 of your Attiny2313 you will see an LED flash on and off