Updating firmware on USBASP bought from eBay

Updating firmware on USBASP bought from eBay

posted in: Arduino | 0

I bought a cheap USBASP clone Atmel programmer from eBay a few weeks ago, to use with the Arduino IDE. (see images below)

The board worked ok, but kept giving errors

avrdude: warning: cannot set sck period. please check for usbasp firmware update

and I was unable to program an ATTiny85 on a breadboard when running at 3.3v (it worked fine at 5V), so I decided to bite the bullet and attempt to update the firmware on the USBASP using one of my Arduino boards as the programmer.

There appears to be a lot of misleading and confusing information on the web about how to do this, so I thought I’d document what worked for me.

  1. NOTE. Attempting to reprogram your USBASP may damage or erase it. Only follow the process described below if you are willing to take this risk ūüėČ
  2. Program an Arduino UNO as an ISP.
    This is a fairly simple process.
    Plug in your Arduino.
    From the Examples (on the File menu). Select “Arduino ISP”
    Select “Upload” and confirm that the new firmware has been uploaded.Note down the Comm port that the Arduino board is connected via i.e from the Tools->Serial port menu
  3. Download the lastest version of the USBASP firmware from http://www.fischl.de/usbasp
    I used usbasp.2011-05-28.tar.gz
    unzip the file and note the full path of the  the bin/firmware directory for the firmware you have just downloaded and unzipped
  4. Open a command prompt (windows cmd ), and Cd to your Arduino program folder and then into the hardware\tools\avr\bin folder
    This folder should contain the avrdude.exe that will be used to flash the new firmware.
  5. Link the Self Program jumper on the USBASP – on my board this was labeled J2, some other boards are different.
    I had to solder the pins onto the PCB as they were missing, and used a jump link, but any way to reliably connect the Self Program pins should work fine.
  6. Connect the Arduino to the programming pins of the USBASP
    Make sure you disconnect the USBASP from your computers USB My connections were
    Arduino    USBASP

    5V ———– 2
    GND ——– 10
    13 ———— 7
    12¬† ———-¬† 9 (MISO)
    11 ———-¬†¬† 1 (MOSI)
    10 ———¬†¬†¬† 5 (RESET)

    usbasp_and_arduino

  7. Check that avrdude can connect to the USBASPIn the windows command window, type

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -v

    Note if your Arduino is not on COM3 you need to change this to whatever your Arduino IDE used.

    If everything is connected correctly you should see a load of information about the USBASP board that you are about to program, like this

    Using Port                    : COM3
    Using Programmer              : avrisp
    Overriding Baud Rate          : 19200
    AVR Part                      : ATMEGA8
    Chip Erase delay              : 10000 us
    PAGEL                         : PD7
    BS2                           : PC2
    RESET disposition             : dedicated
    RETRY pulse                   : SCK
    serial program mode           : yes
    parallel program mode         : yes
    Timeout                       : 200
    StabDelay                     : 100
    CmdexeDelay                   : 25
    SyncLoops                     : 32
    ByteDelay                     : 0
    PollIndex                     : 3
    PollValue                     : 0x53
    Memory Detail                 :

    Block Poll               Page                       Polled
    Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
    ———– —- —– —– —- —— —— —- —— —– —– ———
    eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
    flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
    lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
    hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
    lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
    calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
    signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

    Programmer Type : STK500
    Description     : Atmel AVR ISP
    Hardware Version: 2
    Firmware Version: 1.18
    Topcard         : Unknown
    Vtarget         : 0.0 V
    Varef           : 0.0 V
    Oscillator      : Off
    SCK period      : 0.1 us

    avrdude: AVR device initialized and ready to accept instructions

  8. If you get an error message about invalid signature, your board is may not use an ATMega8, and you will need to change the -p option on the AVRDUDE command to match you board. If you omit the -p option, AVRDUDE will display a list of compatible devices and their codes which you can use to select the correct device.If you have the correct device, but still get a signature error, check that you are using -c avrisp and NOT -c arduino.
    Using -c arduino tells AVRDUDE that you want to program the Arduino board and not the USBASP

    If you can’t connect at all, check your wiring, as its possible that some boards don’t have the same pinout as my board.

  9. Assuming that AVRDUDE can connect to the USBASP, you can backup the original firmware using the commandavrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:r:original_firmware.bin:r

    This should read the firmware and save it to a file called original_firmware.bin (in the same folder as avrdude.exe)

  10. As a double check you can attempt to write the original firmware back to the device, I’m not sure if this is a foolproof way of testing whether you can flash the USBASP but I did it as a test, as previously I’d had issues writing / flashing the device but was able to read it OK.avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:original_firmware.bin

    If this appears to work and AVRDUDE verifies OK, then its probably safe to attempt to burn the new firmware.

    In my case the new firmware was in c:\usbasp so the command was

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:c:\usbasp.atmega8.2011-05-28.hex

    Note. If the chip on your USBASP is not a MEGA8, you need to use the correct / matching file e.g.

    avrdude -C ../etc/avrdude.conf -c avrisp -P COM3 -b 19200 -p m8 -U flash:w:c:\usbasp.atmega88.2011-05-28.hex

  11. If the process worked ok and AVDRUDE verified the new firmware, you can disconnect the USBASP from the Arduino and connect it via USB to the PC and attempt to program your target device (using the Arduino IDE or AVRDUDE).

 

 

usbasp programmer uspasp bottom view