Monday, October 27, 2008

USBasp: The USB based AVR programmer
Update: My Programmer is working now. Read Here.

My laptop does not have serial port. And ponyprog, up until now, have not provided support for any USB programmers. Today, I constructed my first USB programmer on a breadboard. I had a old USB extenstion cable which was out of order as the header was slack due to wear. I cut of that part and soldered breadboard wires.

My first goal was to make a ponyprog compatible programmer that emulates parallel port. I started with: USB2LPT

Afterwards, I realized that the emulation makes programming too slow. Thus I had to move to a dedicated programmer. But I really like a GUI for inputting, especially the fusebits. AVRdude is a command prompt based programmer. A wrong fusebit setting can lock the microcontroller irrepairable by a Serial Programmer.

Then I found AVR8 Burn-O-Mat: GUI for avrdude . The interface is even better than pony prog for fuses. It actually has small comments beside fusebits. AVRdude even supports my simplified SIProg. So I proceeded to make the famous USB ASP (http://www.fischl.de/usbasp/) I forgot to connect the ICP and INT0 at first, and kept getting "Unknown USB device". I reflashed 4 times. Finally the programmer was operational and the driver was installed successfully.

I'll give details of my schematics later. Here is a picture of the circuit.




Update: My Programmer is working now. Read Here.

Researcher and academician by Trade. Hobbyist webdeveloper, photographer and ametuer musician.

25 comments:

  1. Sajid Muhaimin ChoudhuryNovember 11, 2008 at 9:13 PM

    From my email:

    Hello,
    I visited your blog, nice works :D and I have some question about the USB programmer. You have used the schematics from (http://www.fischl.de/usbasp/) and what OS you used for programming ?
    I`m waiting for your reply,
    Regards,
    Deian COSAS,


    Hi,
    Thanks for emailing. I used both Win Vista and Win XP to test the programmer in 2 separate computers. The programmer was detected as a USB device successfully, although Vista warned that the driver was not signed. But unfortunately, when I tried to program a microcontroller using AVR dude, it gave verification error. I'll make another version of it in a veroboard and try it again in a couple of days.
    Regards,
    Sajid


    Hello,
    First of all, I want to thank you for the fast answer, i`m really sorry that it didn`t worked for you, my hopes went down now, but I still think I`ll give it a chance and put the circuit togheter to see what is going on, I have a laptop with USB-ports only and I really need this programmer.
    You said that it didn`t worked, but what do you think it is going wrong? I don`t understand what "verification error" means, it means maybe that avr-dude can`t see the Atmega8 as a programmer? or what?.
    And last... what simulation application for microcontrolers are you using?
    Thank you for your attention, and have a good day,
    Regards
    Deian COSAS,


    I was also trying to build the USB programmer for my laptop. :-( Actually according to the AVRdude support page, verification error means that the clock signal from SCK pin was too high for the microcontroller to cope up. I didn't have enough microcontroller at my hand to test the USB programmer with. So I am not sure whether the only microcontroller I had was malfunctioning, or was it the problem of the programmer. I used the slow clock jumper, but still it did not help. Now current stable version of AVRdude and USBASP does not support variable software control for SCK signal. They have released a patch for the AVRdude and USBasp for that:
    http://www.mail-archive.com/avrdude-dev@nongnu.org/msg01500.html
    I couldn't actually understand how to patch it.
    I think there is another programmer called USBtiny that is based on ATtiny2313. It supports software control of the clock speed. The comments in the source code was german, so I did not understand them to modify it.
    www.xs4all.nl/~dicks/avr/usbtiny/
    If you have any luck with patching it let me know. I'm kinda busy to go shopping for microcontroller, and when I get microcontrollers, I'll let you know.
    Sajid

    ReplyDelete
  2. hello
    I'm a student of electronic from Iran . I want to make an usb programer project , but I have no idea. Please help me to do this .
    Regards,
    sanaz

    ReplyDelete
  3. Sajid Muhaimin ChoudhuryDecember 2, 2008 at 11:59 PM

    Thanks for leaving a reply. Are you familiar with Microcontrollers and basic circuit diagrams? Then you should be able to make the USBasp programmer yourself. You first need an SIProg (or other parallel port or serial port programmer) to load the firmware into ATmega8. Afterwards, construct the circuit and use it.

    ReplyDelete
  4. hello...
    im a student of electronic engineerng from indonesia.
    i've a problem with my usb-asp programmer. i knew about usb-asp from http://www.fischl.de/usbasp/.

    first i'm flash the atmega8 from paralel port, and its just fine.

    but when i connect my usb-asp to my computer, windows detected as unrecognized device. not like in "readme.txt" the device known as USBASP.
    and when i try to installing usb-asp from "bin\win-driver" it always failed.

    can u help me whats the probelm!
    is it on my schematic?

    i'm waiting 4 ur reply
    Thx

    ReplyDelete
  5. Sajid Muhaimin ChoudhuryJanuary 9, 2009 at 6:05 PM

    What can I say. Have you checked fusebits? Have you checked correct connection of the D+ and D- pins? Did you connect pull ups to D- pin?

    ReplyDelete
  6. hehehe....
    im not fuse the bit...
    thanks...

    ReplyDelete
  7. hi sajid
    this is out of topic but i think you can guide me.i am trying to build a digital cap meter build around atiny2313 i have pony prog and i build serial por progammer but i cant reach the firmware.it is on other link and they want some kind of registration can you help me.thanks
    tahir

    ReplyDelete
  8. Sajid Muhaimin ChoudhuryJanuary 23, 2009 at 9:36 PM

    Tahir, I can't understand. Ponyprog is freeware and opensource. Why would they want registration?

    ReplyDelete
  9. With regard to one of ur previous posts u had said "What can I say. Have you checked fusebits? " Could u pls elaborate on this. I just downloaded the firmware for atmega8 using ponyprog, should i do anything to the fuse bits???

    ReplyDelete
  10. Yes, you should change the value of the fusebits of your microcontroller using pony prog to have external crystal enabled. Check the makefile of it to have the hfuse and lfuse values. Then go to http://www.engbedded.com/fusecalc/ and use those values to see the fusebits that need to be changed in ponyprog, (Security and configuration bits in menu). I don't use ponyprog any more, and don't have it installed any more.

    ReplyDelete
  11. doublek: For the USB programmer, the bus timing is critical, therefore, it is crucial to have precisely 12 MHz clock frequency. For precise timings, you have to use 12KHz crystal. Without fuse settings change your microcontroller will run with internal RC oscillator at 1MHz, and the frequency will not be constant. So I don't think you will be at all able to make a USB circuit without the crystal.

    ReplyDelete
  12. sajid bhai i want the schematic for parallel programmer for avr8 burn-o-mat.actually i burned HFUSE=0xc9 and LFUSE=0xef for usbasp into my atmega8(using ponyprog) and now i cant write anything into my uC.So i want to try avr8 burn-o-mat.

    ReplyDelete
  13. What programmer did you use with ponyprog. If the uC is locked with ponyprog it is very unlikely that it would respond the burn o mat, because possibly, the SPIEN fuse has been disabled by error.

    ReplyDelete
  14. does USBasp work with ATmega32?if it works, is there any changes in circuit? and if I program uC with 12 KHz crystal, do I need to use this freq. all the time I use the uC?

    ReplyDelete
  15. i want to ask the same question, how do i port usbasp into my ATmega32 (cause i have two of them but don't have ATmega8)???

    ReplyDelete
  16. I also want to ask same Q. Instead I have ATtiny26 and ATmega16. I go to patuatuli, but they said ATmega8 is out of market.
    Sajid vai,this site is great!

    ReplyDelete
  17. after working 3hour i have made this thak u sajid vai....here is my work "http://must-info.blogspot.com/2009/10/hallo.html"

    ReplyDelete
  18. Hiiii......
    i`ve make this USBasp...
    everything work well on my laptop....

    but... i try on other computer (PC and Laptop) the windows said that my usbasp as a "Unknown Device"...
    i try to other computer again.. and some of computer can detect my usbasp.. but the other can`t...

    could you tell me the solution....??

    thankz..

    ReplyDelete
  19. It's really difficult, if not impossible to debug from distance. My suspicion is that there is some faulty soldering between Vcc and GND which draws a lot of current from the USB port. The rating of a USB port is maximum 500mA, but in some laptops this rating might be shared by several USB ports. Again some motherboards connect the power from supply directly to the USB port, allowing 10A current to pass. So, I'd say check your connection and soldering

    ReplyDelete
  20. Boss,
    Thanks. I follow all the instruction. But still the USBASP devices have some problem. The computer recognized the USBASP device, but I failed to read/wright through the USBASP MCU. I used EXTREEM BURNER to write/read data from the target board via USBASP. But it shows " The target board did not respond. rc -1". And i thoutht it was for wrong fuse bit. I used pony prog for burn fuse bit into the ATMEGA8L. it also creat problems (!). After writing the fuse bit; I try to read the data that loaded into its Flash memory. It shows "Error: -24". And I have already lost 2 pics of IC. Please help me.

    bahadur kar
    01825027390
    Bashabo, Dhaka

    ReplyDelete
  21. Boss,
    Thanks. I follow all the instruction. But still the USBASP devices have some problem. The computer recognized the USBASP device, but I failed to read/wright through the USBASP MCU. I used EXTREEM BURNER to write/read data from the target board via USBASP. But it shows " The target board did not respond. rc -1". And i thoutht it was for wrong fuse bit. I used pony prog for burn fuse bit into the ATMEGA8L. it also creat problems (!). After writing the fuse bit; I try to read the data that loaded into its Flash memory. It shows "Error: -24". And I have already lost 2 pics of IC. Please help me.

    bahadur kar
    01825027390
    Bashabo, Dhaka

    ReplyDelete
  22. Hi Sir
    We made a USBasp burner using atmega48 microcontroller. It works and we successfully programmed another atmega48 but we can't program a atmega8L using it. Since atmega8L supports low frequencies we replaced the 12 MHz external oscillator associated with the microcontroller to be burned and used 4 MHz and 8 MHz oscillators. Still it doesn't work. What might be the problem?

    ReplyDelete
  23. Hello Sajid,
    I am a new comer to the embedded programming,
    I want to make my own USB Based Programmer to program AVR Controllers Because My Laptop Does not Provide any serial or parallel Port and your and other blogs on internet said that USB to Serrial converter does not work.
    The Schementics you Provide for programmer contain a Microcontrller ATMega8
    I just want to know how could i program that Controller used in the Programmer and by which firmware is burned in that controller.

    Can you also Provide step-step Procedure for making the Programmer and the Required software and firmware links.
    I want to make my Programmer using the breadboard because i m a new comer and just want to learn.
    I also have a little background to electronics and just start learning.

    sorry for grammar or English related mistakes
    and Thanks for your contribution.

    ReplyDelete

Visit My Official Website at BUET

Contact Me
Sajid Choudhury
+9665650
Dhaka, Bangladesh