I don’t have desktop with legacy ports and don’t like going to friend’s home every time I need to download something to an AVR. I asked myself “how can i build a simple diy avr USB programmer?” .
Well, actually I asked Google, and the answer was Usbtiny. Below I’m describing my simplified Usbtiny programmer.
It’s basically an extremely cut version of UsbTinyISP by Ladyada.When I went to build the v2.0 of the programmer, I’ve made it first on breadboard, and everything ran perfectly and it was able to do the job nicely. Next, I started removing sidekicks.
First, I’ve removed the 74HC125 buffer and gave direct programming lines to the target, and it did worked. Next, I’ve removed few other resistor and capacitor and left only the essential ones.
I’ve converted the ISP connector and USB connector to pin headers and after doing my job, it is left with the main Attiny2313 IC, one 12Mhz crystal, and four resistors. It looks like the v1.0 of Usbtiny but it has even less parts count. The Usbtiny v2.0 has total 17 discrete parts, except connectors and the Usbtiny v1.0 has 15 discrete parts. In my modified version, there is 6 discrete parts (less than 40%),
- Attiny2313 main IC
- 12Mhz crystal
- 3.3K reset pullup resistor
- 1.5K D- pullup resistor
- USB bus resistor 2x 68R.
With this minimum surrounding, everything worked correctly. I could have fabricated one small PCB for this but it’s so small and tiny, that I made it on a small piece of veroboard.
I’ve customized the pin layout of the ISP header to meet the sequence I needed. It’s VCC-GND-MISO-MOSI-SCK-RST.
I’ve used this one to program Attiny2313, Atmega8, Atmega32 everything worked nicely. There’s no filtering capacitor in the circuit, nor there is 18-22pf grounding capacitors for the crystal, but everything is greatly working.
I stripped down the hardware much and removed the two indicator LEDs which were for
1. Programming : Surely, I know when I am programming, so no need of the LED, and
2. USB OK: If device didn’t initialized properly and connected to USB, I’ll get error from avrdude as “Error: Could not find USBtiny device (0×1781/0xc9f)” , what’s the need of the LED then.
Next, I’ve thought to minify the program, but then thought that was unnecessary. The firmware being 2046bytes, fits tightly into the 2048bytes space in Attiny2313. Minifying the code will make it fit in lesser space, but that space would never come useful in any user’s project. Hence I’ve selected the v2.0 firmware as default.
Note: To burn the firmware to Attiny2313, you’ll need another programmer, you are adviced to use any of these simple programmer that you can use with Serial port, or Parallel port.
Programming Instructions for downloading firmware to Attiny2313
- Download the USB driver and also firmware for v2.0 from Ladyada site.
- Burn the firmware by AVRdude or by PonyProg and set fusebits as example
avrdude -c stk200 -p t2313 -U hfuse:w:0xdf:m -U lfuse:w:0xef:m
Reference Source: Ladyada and Instructables.
Update: PCB design and Final version
Comments on this article before 07-12-2011, here jump to recent comments.
-
K Scharf on October 14, 2011 - 8:34 pm
Leaving out the two capacitors from the crystal pins to ground is generally not a good idea. While it may have worked in your case, those caps are often needed to support oscillation. If you leave them out the device may become un-reliable. Use a ceramic resonator instead of the crystal, it’s cheaper and the caps are built in!
Arup Reply:
October 15th, 2011 at 9:57 amYeah, I also thought it. But when in breadboard, I was removing non-essential components, it was discovered that those capacitors was not needed.
And as for ceramic resonators, they are pretty less stable than crystals. USB is a serial communication where timing is a vital thing, hence I used crystals. -
Dhrubajyoti Dey on November 15, 2011 - 10:58 pm
Priyo Arup, ei circuit tar kaj ta thik ki, ami bujhlam na, USB AVR programmer er actual kaj ta jodi ektu bujhiye bolo tahole khub upokar hoy. Agrim Dhanyobad janai.
Arup Reply:
November 16th, 2011 at 3:04 amThis is used to program Atmel’s AVR series microcontrollers through USB port.
Sanchit says
Be a little more clear on how to burn firmware to Attiny 2313 via serial or parallel port . Please give some links on the same if possible and what is the cost of the 2313 IC ??
Arup says
I have given link to external sites that shows the serial/parallel port programmer. Download the diagram/etc from there.
anando pau; says
Superb man ... Great idea ... I will also try to make this and use it ... can you please give your email address or skype id so that I can communicate with you if I get any problem during this ... Thanks
Arup says
You can contact me from the contact page anytime. Thanks.
anando paul says
usb connection e diode na dile problem houar kotha na ? laptop abar ure jabe na to ???
Arup says
Kissu hobe na. Ami ei to amar laptop e chaliyechhi eita. ha ha.
Thai kimseng says
Great but it's not working with laptop
Arup says
What problem you are getting?
anando paul says
Mr. Arup,
I tried to make your simplest usb avr programmer ... but unfortunately I may have done something wrong I think ... that is why it is not working. One thing I want you to cross verification of your board design. you have reversed the pin out of USB. where your 4th USB pin is VCC but tinyUsbAvr has VCC in 1st pin. Please confirm me regarding this as it is intentionally done or its a mistake.
Thank you.
Anando Paul
Arup says
Here I've shown USB as a pin header and not real USB male. Follow the text.
anando paul says
USB 1.x/2.0 standard
pinout Pin Name Cable color Description
1 VBUS Red +5 V
2 D? White Data ?
3 D+ Green Data +
4 GND Black Ground
Ahmed says
First of all thanks for the post. I had a problem with writing the hex file on the AT90s2313 , the error message is shown when verifying the flash and it says :
verifying error at byte 0x00
0x36 !=0x00
and i am using parallel port programmer
Please consider my comment
Arup says
There must be some problem in the programmer. the error you quoted tells clearly that the flash is not written.
Ahmed says
Yes i have a problem in programming because i am using AT90s2313 instead of ATTINY2313 ( It's not available in my Country ) , and i noticed that the device signature isn't like ATTiny . After searching the internet , i knew that the code must be changed in order to make AT90s2313 work and the crystal must have capacitors . And there is just one more thing .. The programmer i use works perfectly with ATMEGA AVR ( mosi miso sck reset ) , i know that a crystal must be connected to ( Xtal1 - Xtal 2 ) but what is the values of crystal and cap.
and could you please modify the code and post it with explanation of fuse command in avrdude
thanks for your help
Arup says
Use 12Mhz crystal with 22-27pF caps.
No fusebit setting required for AT90S2313 as it by default uses external crystal.
ajith says
is this a usb version? coz my pc dont hav an parellel port!
Arup says
Yes. this is a USB version.
papai says
hi arup i want to program microcontrolers using serial or parallel port.can you please publish some easy to make programmer using serial or parallel port.and please give some reference about programming in C language.thanx in advance
Arup says
Hi papai,
In the article in the 9'th paragraph, I've included two links for making serial or parallel port programmer. The linked webpages have download links for the design files.
For a nice tutorial, look at the videos "Embedded C Programming for Microcontroller - Chapter 1" to chapter N. Here http://www.youtube.com/user/EmbeddedMarket
papai says
thax buddy these are very usefull I will give you good news very soon
Arup says
Hi, waiting to hear the good news.
subhajit sarkar says
what will be the cost of this arrangement?And moreover we can do it by RS232 port I think that will be much more cost effective.
Arup says
But not all computers nowadays have those legacy ports.
Sanchit says
I am familiar with the picaxe platform and the BASIC. I want to know if this can take input analogue from the atmega8 and show it the programming software using some command (ike we use the debug command in the basic )(and I very new toc++