Introduction: How to Update the Firmware on a Cheap USBasp-Clone
This is a small guide to flashing new firmware onto a USBasp-clone like mine. This guide is specifically written for the USBasp-clone seen in the pictures, however it should still work with others. The wiring is shown on step 5, there is a TL;DR on step 9.
Step 1: The Problem
Avrdude tells me that the programmer I am using has outdated firmware. The normal jumper for self-programming does not exist on my board. Here is how to fix that. Schematics for the USBasp can be found at fischl.de.
Step 2: Materials Needed
You will need...
- A soldering iron
- An Arduino (preferably Nano)
- Some jumper wires
- A PC with the Arduino IDE and avrdude installed
Step 3: The Solution
In order for us to flash new firmware onto the ATmega8, we need to gain control of its RESET pin. Normally, a jumper on the USBasp can be closed to enable self-programming, however the manufacturer of my board did not include one.
On the ATmega8, the RESET pin is pin 29, the fourth pin on the top from the left. It is connected to a 10k pull-up resistor to 5V. We have to connect it to pin 5 of the ICSP header.
We could try to solder a wire directly onto the resistor or the pin itself, however it is tedious and can damage your board. (I tried it and ripped off the pull-up resistor, I don't recommend it) Also, there is a much easier way!
Although manufacturer did not include a real jumper to enable self-programming, he did put a header underneath the microcontroller. We can simply solder a wire across and...
Step 4: Voilà!
We have connected the two reset pins! The two holes on the bottom connect pin 29 and pin 14 of the microcontroller.
Step 5: Setting Up the Arduino
To flash the new firmware onto the programmer, we need another programmer, in this case an Arduino with the ArduinoISP sketch on it. Just to make sure that your setup is the same, please uncomment line 81
// #define USE_OLD_STYLE_WIRING
Now connect the Arduino with the ICSP header on your programmer.
Arduino USBasp 5V Pin 2 (VCC) GND Pin 4/6/8/10 (GND) Pin 10 Pin 5 (Reset) Pin 11 Pin 9 (MISO) Pin 12 Pin 1 (MOSI) Pin 13 Pin 7 (SCK)
The USBasp remains unplugged from the PC.
Open a terminal and type
avrdude -cavrisp -pm8 -b19200 -P[Your port number goes here, it should be the same as in the Arduino IDE]
If everything goes right, avrdude should print out some information about the ATmega8 (fuses, signature, etc.)
Step 6: Flashing the ATmega8
To flash the chip, we still need the firmware. Head over to fisch.de and download the newest version. Extract the archive and navigate to it using the shell.
Compiling the code did not work for me, but fortunately the archive contains all the compiled programs under
Here you should see three .hex files. Pick the one with the same name as your chip. My programmer uses an ATmega8, so I picked
With a working connection to the ATmega8, flashing it should require only typing
avrdude -cavrisp -pm8 -b19200 -P[PORT] -U flash:w:[hex file]
If everything was done correctly, avrdude should write and verify the selected firmware.
Step 7: Making Sure the Programmer Works
To use the USBasp as a programmer again, we have to remove the connection between pin 29 and pin 14. Cutting the jumper on the bottom should suffice, however removing it cannot hurt either.
You can try it out by plugging it back into the PC and typing
avrdude -cusbasp -pm8
Even if avrdude cannot reach the target, it should at least acknowledge the new firmware of our programmer.
Step 8: Troubleshooting
Should avrdude show an error like this, it probably has something to do with the auto-reset feature of the Arduino. To circumvent this, please add a capacitor between RESET and GND of the Arduino. It is generally recommended to use a 10µF capacitor, however in my case, a 100µF capacitor worked just fine.
Should you get an error like
avrdude: error: programm enable: target doesn't answer. 1
or an invalid signature is returned, please check your wiring. I had a problem with my power cables rusting and not conducting electricity anymore. I recommend checking all jumper wires beforehand.
Also make sure to switch pin 11 and pin 12 on the Arduino, if the problem persists.
Please also make sure to set the correct baud rate for the Arduino as ISP, 19200. It can be set with the option
If you have any questions or have spotted a mistake, please let me know :)
Step 9: TL;DR
- Solder a wire across the two pins on the bottom of the board
- Set up an Arduino as ISP, making sure to enable the old wiring schema
- Connect the Arduino to the programmer through the ICSP header
- Flash the new firmware onto the programmer
- Remove the connection on the bottom
- Don't rip off any SMD resistors
We have a be nice policy.
Please be positive and constructive.