Usbasp

From mems wiki
Jump to: navigation, search

Contents

About

How to burn the arduino bootloader to an atmega328p using a cheap USBasp programmer.

Notes

I had to update the firmware first before it was usable with the current version of arduino. Unfortunately I did not document this process, so search for "update usbasp firmware with arduino" and for myself, I had to short 1 jumper to update its firmware.

Assuming the firmware is updated, proceed.

Windows Driver

Windows 8.1/ 10 will try and install a driver and fail.

ERROR:

The drivers for this device are not installed. (Code 28)

There are no compatible drivers for this device.


To find a driver for this device, click Update Driver.

Yep thanks windows.

Preparing Windows for Driver

First thing is to disable device driver signature enforcement.

  • run cmd.exe as administrator.
  • type the following command:
bcdedit.exe /set nointegritychecks on

restart windows and proceed with this guide.

Install Driver

The official site has useful info on both flashing the firmware and the circuit itself.

http://www.fischl.de/usbasp/

It also links to a driver installation tool:

I used File:Zadig 2.2.zip.

  • Open device manager, select usbasp, right click, properties, click details tab, Click the property drop down menu, select Hardware Ids and note the values.
  • run the installation, select libusb-win32 and confirm the USB ID matches the values seen in the details tab.

Usbasp.png

  • Click Install Driver.

Hookup USBasp to microchip

Breadboard or Prototype board is fine, this is mine below (currently works for:

  • dip28 atmegas (eg atmega328p)
  • dip8 attinys (45,85 etc).
  • easily expanded for more.

or breadboard the connections. I found this nice diagram which while for a dip40 is exactly the same (when referencing pin names) as my circuit.

Usbasp circuit.jpg

notes:

  • I have tried several circuits and settled on this, I found chips without bootloaders and unknown fuse settings need a crystal. So my board has a slot for swapping in and out various speed crystals, so far 16mhz has worked for bootloading all chips.
  • I also recall having multiple issues with Arduino when attempting to use the same circuit for uploading sketches but it works fine for bootloading. Atmel studio did not have any issue using the tool once I added a custom command to program chips directly using AVRDUDE.
  • last note, if unsure - stop using arduino IDE and fall back to AVRDUDE on the command line, it makes debugging much much easier.

File:Usbasp board.jpg

Test Driver

Finally, time to install a bootloader.

  • Open up arduino IDE.
  • Tools, Programmer, USBasp
  • Tools, Board, Arduino/Genuino UNO
  • Tools, Burn Bootloader

if lucky your USB will flash like mine just did and arduino IDE will state Done burning bootloader in its status bar.