Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)
Target Amount: $2000
Amount Raised: $1159
Top Donor: C.C. $100
Created on: 23 January 2013
Part 1 of the ATtiny2313 Tutorial
All aspects of development will be covered, including hardware interfacing, software development, internal peripherals, fuse programming and more. An electronic breadboard will be used to build the circuits in this tutorial series.
In order to follow this series of tutorials on the ATtiny2313, you will need to have some experience in the following fields.
It is assumed that you have some basic knowledge of electronics and that you can build breadboard circuits. If not, learn about electronics and how to build breadboard circuits in the Start Electronics Now course.
To be able to do your own software development, you will need to be able program in the C programming language. If you do not know the C programming language, then it is still possible to follow the tutorials as you will be able to load the C program examples to the microcontroller without having to write your own programs.
An ATtiny2313 microcontroller in a dual inline package (DIP) is needed (this package is called PDIP in the Atmel literature – Plastic Dual Inline Package). It is recommended to get the ATtiny2313 microcontroller with part number ATTINY2313-20PU.
Other electronic components such as LEDs, resistors, capacitors, etc. are also needed. The required components will be listed in each part of this tutorial as needed in each part.
An electronic breadboard and wire links are needed for building the circuits.
A 5V (five volt) power supply is required for powering the circuits. The 5V from a PC power supply can be used.
In order to load a program to the ATtiny2313, a programming device is needed. This device is connected to the USB port of a PC. The header of the programming device is then connected to certain pins of the ATtiny2313 in order to load a program to it.
There are several AVR programming devices to choose from. Some are for programming the AVR microcontroller only, but others have debugging capabilities as well. Some popular programmers are listed below.
The AVRISP mkII is an AVR programmer from Atmel for in-system programming (ISP) of AVR microcontrollers. This programmer does not have any debugging capabilities.
The AVR Dragon is an AVR programmer from Atmel for in-system programming, debugging and high-voltage programming (HV programming). HV programming is used to reset certain internal fuse bits of the AVR that ISP programmers can't reset.
The AVR Dragon is a good choice of programmer as it has more capabilities than a plain ISP programmer.
Be aware that the AVR Dragon is not supplied with any cables. You will need to buy a standard USB cable (not the miniature type) as well as a ribbon cable with a 6-pin (2 by 3 pin) IDC female header on each end. That will be fine for use on this course.
There are two other ribbon cables that can also be plugged into the AVR Dragon. One is for the JTAG connector which is used on some AVR microcontrollers (not the ATtiny2313) and is a 10-pin header (2 by 5 pins). The other ribbon cable is for connecting to the 20-pin (2 by 10) HV programming header and is needed only if doing HV programming.
There are several AVR programmers that can be built at home (for ISP programming only, not for debugging). There is one that works from the PC parallel port and one that works from the PC serial port. Do a search on the Internet to find these.
Another home built AVR programmer that works from a USB port is the open source USBtinyISP. You can build this programmer yourself from scratch or buy a kit and build it.
These home built programmers may need other software to be loaded in order to use them and may not be able to be used directly from within the Atmel AVR Studio software that we will be using in this course.
Atmel Studio version 6.0 is the software development environment and toolchain used in this course. This course was designed and tested using Atmel Studio 6.0 running on Windows 7.
Other versions of Atmel Studio and other versions of Windows should also work.
To get the required software installed and to test program the hardware, follow the article Starting AVR 8-bit Development on this website.
This article uses the AVRISP mkII to program a ATtiny2313 microcontroller circuit that flashes an LED on and off. If you are using the AVR Dragon instead, just select the AVR Dragon in the Atmel Studio settings instead of the AVRISP mkII. For other programmers, you will need to follow their specific software requirements and usage instructions.
Once you have followed the above article, you will have the software and hardware installed and tested. You will then be ready to follow the rest of the parts of this tutorial.