Simple USB AVR programmer, USBasp using ATMega8 microcontroller

Summary of Simple USB AVR programmer, USBasp using ATMega8 microcontroller


The USBasp is a low-cost, firmware-only USB in-circuit programmer designed for Atmel AVR microcontrollers. It operates without a dedicated USB controller and supports speeds up to 5kBytes/sec across Linux, Mac OS X, and Windows platforms.

Parts used in the USBasp Programmer:

  • ATMega88 microcontroller
  • ATMega8 microcontroller
  • Passive components

USBasp is a low-cost USB programmer for AVR microcontrollers. Its hardware is an ATmega8 or ATmega88 with a few passive parts, and it uses a firmware-only USB driver, so no special USB chip is needed. It works on Linux, macOS and Windows and is supported by avrdude. This page covers the ISP connector pinouts, the avrdude commands and what to do when it will not connect.

IN SHORT
  • USBasp programs AVRs over ISP using four signals: MOSI, MISO, SCK and RESET, plus power and ground.
  • The original author quotes programming speeds up to about 5 kilobytes per second.
  • Use avrdude -c usbasp -p m328p and change the part name for your chip.
  • Clone boards often have a slow SCK jumper for chips running at a very low clock.
ISP
interface
ATmega8
programmer chip
5 kB/s
quoted speed
usbasp
avrdude name
Chain: PC and avrdude, USBasp with ATmega8, ISP header, target AVR
From PC to target chip

ISP connector pinouts

Signal 6 pin header 10 pin header
MISO 1 9
VCC 2 2
SCK 3 7
MOSI 4 1
RESET 5 5
GND 6 4, 6, 8, 10

These are the standard Atmel ISP layouts, with pin 1 marked on the connector. Always match pin 1 and check against your board before connecting, because some clone cables are wired differently.

Connecting to a bare ATmega328P

Signal ATmega328P pin
MOSI 17 (PB3)
MISO 18 (PB4)
SCK 19 (PB5)
RESET 1
VCC 7 and 20
GND 8 and 22

avrdude commands

avrdude -c usbasp -p m328p                                 # test the connection and read the signature
avrdude -c usbasp -p m328p -U flash:w:blink.hex:i          # write a program
avrdude -c usbasp -p m328p -U lfuse:r:-:h                  # read the low fuse byte
avrdude -c usbasp -p m328p -B 32                           # slow the bit clock for a slow target

These are standard avrdude options; we did not run them on a physical USBasp. The part name for other chips is listed by avrdude -p ?. Use the -B option, or the slow-SCK jumper where fitted, when the target runs from a clock slower than about a quarter of the programming clock; a factory-fresh 1 MHz ATmega328P is the usual case.

To check what a fuse byte means before you write it, use the decoder script on our avr-gcc page.

Drivers

System Notes
Linux Add a udev rule so avrdude can open the device without root.
Windows USBasp uses a generic USB driver; a tool such as Zadig is commonly used to install it.
macOS Normally works with avrdude without extra drivers.
Do not power the target from the programmer and an external supply at the same time unless the board is designed for it, and match the target voltage to the programmer’s output.

If it will not connect

What you see What to check
could not find USB device Cable, driver or udev rule.
target doesn’t answer Pin 1 orientation, target power, and the clock (try -B with a larger number).
wrong signature Wrong -p part name, or a bad contact on MISO.
Works once then fails A bad fuse change left the chip waiting for a clock that is missing.

Quick answers

Can USBasp program an Arduino Uno?
Yes, through the ISP header, which replaces the bootloader route.
Is the ATmega8 a problem?
It is a common choice for the clone design, and the firmware is available for other chips too.
Can it supply power?
Most boards can provide about 5 V or 3.3 V to a small target; check your board.

Downloads and references

    Share this project
    X
    LinkedIn
    Reddit
    WhatsApp

    Quick Solutions to Questions related to USBasp Programmer:

    • What is the USBasp?
      It is a low cost USB in-circuit programmer for Atmel AVR microcontrollers.
    • Does the USBasp require a special USB controller?
      No, it uses a firmware-only USB driver so no special USB controller is needed.
    • How fast is the programming speed of the USBasp?
      The programming speed is up to 5kBytes/sec.
    • Which operating systems does the USBasp work under?
      It works under Linux, Mac OS X, and Windows.
    • What microcontrollers can be used for the hardware?
      The hardware consists of an ATMega88 or an ATMega8 microcontroller.
    • Can I find more details about the project online?
      Yes, more detail is available at Simple USB AVR programmer and USBasp using ATMega8 microcontroller.
    • Is the USBasp considered a high-cost device?
      No, it is described as a low cost USB in-circuit programmer.
    • Are active components required besides the microcontroller?
      The text specifies the hardware consists of the microcontroller and a couple of passive components.

    About The Author

    Author avatar

    Ibrar Ayyub

    I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

    Follow Us:
    LinkedinTwitter

    Stay in the loop

    New AVR projects, tutorials and schematics, every week.

    Subscribe Browse projects

    Scroll to Top