post

USBASP update firmware

I got a very cheap USBASP programmer for AVR from ebay. Long cable with 10 pin connectors and an adapter from 10 to 6 pin.
To be used for programming an Arduino where the bootloader is not wanted at startup or when it takes too much space in the RAM.

s-l1600 (1) s-l1600 (2)

You can program a skecth into an Arduino when the USBASP is connected with the Menu option Sketch: Upload Using Programmer. This also removes the bootloader, making space.

When I connected the USBASP to my Uno and tried this with a sketch, the upload failed with the error:


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

Known problem, ol d firmware. Sigh, another job to do. This is what I did to make it work as wanted.
Some googling around and this is my recipy. Based upon a post by Roger Clark,, performed by me on Windows 7.

  1. Program an Arduino UNO as programmer.
    Plug in the Arduino Uno. Note the serial port assigned, COMXX (fill in the number on the next commandlines !).
    Start the Arduino IDE (1.6.5 for me, but this will work with older versions also).
    From the Examples (on the File menu). Select “Arduino ISP”.
    Choose board: Uno and serial port to what you just noted.
    Select “Upload” and confirm that the new firmware has been uploaded.
  2. Download the latest version of the USBASP firmware from  Thomas Fischl’s site, the designer of the USBASP.
    The most recent firmware is usbasp.2011-05-28.tar.gz
    Unzip the file in a temp directory and copy usbasp.atmega8.2011-05-28.hex to c:/program files (X86)/arduino/hardware\tools\avr\bin (requires admin privileges!)
  3. Open a command prompt (Run as Adminstrator)in c:\program files (X86)\arduino/hardware\tools\avr\bin
    This folder contains the avrdude program that will be used to flash the new firmware.
  4. Close the self program jumper on the USBASP.
    On my board there were two empty holes, in which i soldered a jumper.
    IMG_4621
    Connect the Arduino to the programming pins of the USBASP
    Make sure you disconnect the USBASP from your computers USB!
  5. Make these connections
    s-l500 (1)

    Arduino USBASP
    5V  ———— 2
    GND ———— 10
    13  ———— 7
    12  ———— 9 (MISO)
    11  ———— 1 (MOSI)
    10  ———— 5 (RESET)
     

    Note the notch on the connector is above pin 3-5-7. The picture above shows the pins in reverse.  This is how the connector in the cable seen from the front, where the connections are to be made:

           XXX
     ---------------
    |  1  3  5  7  9  |
    |  2  4  6  8 10  |
     -----------------
    
  6. usbasp_and_arduino
    Check that avrdude can connect to the USBASPIn the windows command window, type

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

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

    
    ...
    AVR Part : ATMEGA8
    ...
    
    avrdude: AVR device initialized and ready to accept instructions
    
    

    The last message is the sign everything is connected and you have an ATMEGA8 as I have on my USBASP.

    If you get an error message about invalid signature, you either have a defective USBASP or you made a wiring error.

  7. Assuming that AVRDUDE can connect to the USBASP, you can backup the original firmware using the command
    
    avrdude -C ../etc/avrdude.conf -c avrisp -P COMXX -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)

  8. Now burn the new firmware with
    
    avrdude -C ../etc/avrdude.conf -c avrisp -P COMXX -b 19200 -p m8 -U flash:usbasp.atmega8.2011-05-28.hex
    
    
  9. If the process worked ok and AVDRUDE verified the new firmware, you can disconnect the USBASP from the Arduino.
    Remove the self programming jumper and connect it via USB to the PC and attempt to program your target device (using the Arduino IDE). Note that you loose the bootloader when using USBASP, use Nick Gammon’s boot loader program to restore that.

IMG_4620

Leave a Reply

Your email address will not be published. Required fields are marked *