USBASP Programmer for ATMEL AVR Microcontrollers :
USBASP is a USB in-circuit programmer for ATMEL AVR Microcontrollers. It consists of Atmega 8 and a few passive components . The programmer uses a firmware and a USB driver . It was constructed taking Thomas Fischl's circuit as reference
Circuit :
Features :
i) No special components are required
ii) Allows us to read or write the microcontrollers EEPROM , Firmware , fuse bits and lock bits
iii) Programming Speed : 5 KB/sec
iv) Works with multiple platforms such as Linux , Windows , iOS
v) Slow SCK option to support slow targets ( less than 1.5 MHz )
vi) Serial Interface for target
Supported Software:
i) AVRDUDE supports USBASP
iii) AVR Burn-o-mate
Prototype :
Installation of WINAVR :
1) Install WinAVR-20100110-install.exe
2) For Windows 8.1 and 10 , open the folder Winavr fix (win 8.1 and 10)
3) Copy the file msys-1.0.dll to C:\WinAVR-20100110
AVR Burn-O-Mate :
Upon installation the following changes should be made :
1) Click on Settings > AVRDUDE
2) Change AVRDUDE location to
C:\WinAVR-0100110\bin\avrdude.exe
3) Change alternative AVRDUDE configuration File to
C:\WinAVR-20100110\bin\avrdude.conf
4) Click on Apply and then Ok and close AVR Burn-O-Mate
5) Again Open the software and go to Settings > AVRDUDE
6) Under AVRDUDE options select the programmer to be usbasp
7) Select the port as usb
8) Click Apply and Ok and restart the software
Uploading the Firmware:
Any microcontroller can be turned into a programmer. Here I have chosen ATmega 8 . The following steps must be followed :
1) Connect the self programming jumper to upload the firmware into Atmega8, for it to behave as a programmer.
2) Open the software AVR Burn-O-Mate and select the AVR Type as Atmega8
3) Click on Fuses and de-select the fuses CKSEL3 , CKSEL2, CKSEL1, CKSEL0
4) Select the destination of the Firmware
5) Press the write button to upload the code to the microcontroller
Installation of Drivers:
1) Open Zadig and select Options>List all devices
2) Select the Programmer USBasp from the drop down list box
3) Install the driver libusb-win32 (v1.2.6.0)
Testing the Programmer :
- Connect the programmer to the laptop.
- Open Device Manager and check if the programmer is shown
Troubleshooting :
1. Connect the programmer to the system using an USB A to B cable
2. Ensure that the programmer receives + 5 Volts at the terminals of the USB - B Socket
3. Ensure that the red led bulb glows .
4. While the programmer is still connected to the system , gently place the hot tip of the soldering iron on the data line . The system should soon recognize the programmer . This is because the the data line wasn't soldered properly to the USB - B socket previously .
1) Connect the 6 pins ( GND, Vcc, Reset, SCKk, MISO, MOSI) of the programmer to the corresponding pins of the target microcontroller
2) Short the header pins near Vcc to use the power supply from the pc
3) To check whether the connections are correctly made, open Command Prompt and type
avrdude –c usbasp –p m8
here m8 stands for Atmega 8 (target)
m16 – Atmega 16 (target)
m32 – Atmega 32 (target)
4) If the connections are perfect , the following message would be displayed
5) Open AVR Burn-O-Mate and select the target microcontroller and the destination hex file . Click on Write to program it.
Using Arduino IDE to program any Atmel microcontroller :
1) Disable the internal clocks of Target microcontroller. This can be done by unchecking the fuses CKSEL3, CKSEL2, CKSEL1, CKSEL0. It is to be noted that Arduino IDE supports only external crystal.
2) Connect the programmer to the target microcontroller
3) Go to the URL https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls
4) Select the appropriate json file for the corresponding microcontroller. To program Atmega 8 with Arduino IDE , copy the URL https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json
5) Open Arduino IDE.
6) Select File > Preferences and paste the URL in Additional Boards URL
7) Click Ok. Select
Tools > Boards : > Boards Manager
8) Search for MiniCore by MCUDUDE and install the board.
9) Once the Installation is complete go to Tools > Boards and select Atmega8
10) Choose the programmer as USBasp and set the appropriate external clock frequency
Now the code can be developed with Arduino IDE . It must be noted that USBasp doesn’t use COM Port for programming unlike UNO board. Hence Port section under Tools would disabled
11) To Program the code select
Sketch > Upload using Programmer
i) This circuit can only be used for programming 5V target systems. For other systems a level converter is needed
ii) The firmware doesn't support USB Suspend Mode. A bidirectional serial interface to slave exists in hardware but the firmware doesn't support it yet.
Download Links :
Firmware - http://goo.gl/3P7SLl
AVRDUDE - http://www.nongnu.org/avrdude/
Zadig - http://zadig.akeo.ie/
WINAVR - https://sourceforge.net/projects/winavr/