Upgrade USBasp firmware with ArduinoISP

Go To Last Post
28 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a USBasp like this.

I'd like to upgrade the firmware on it with an Arduino like this, loaded with the "official" ArduinoISP sketch.

I have followed this guide, but it doesn't work me.

My goal is to load custom firmware onto the USBasp eventually.

 

Instead of success I get an error like this when I try to use avrdude.

avrdude.exe: Version 6.3, compiled on Dec 16 2016 at 13:33:19
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "../etc/avrdude.conf"

             Using Port                    : COM6
             Using Programmer              : avrisp
avrdude.exe: Send: 0 [30]   [20]
avrdude.exe: Send: 0 [30]   [20]
avrdude.exe: Send: 0 [30]   [20]
avrdude.exe: ser_recv(): programmer is not responding
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03

... and so on.

 

Some facts.

 

  • My USBasp programmer is a bit different than the one in the aforementioned guide. The connector pins are perpendicular to the board instead of parallel for example. There are other differences: for example the JP1 and JP2 "things" are switched. (Not sure what that means.)
  • The USBasp programmer works! I've used it to read and dump the flash contents from my Arduino and then I've written it again onto the board successfully.
  • The Arduino is definitely loaded with the ArduinoISP sketch. I've wired the heartbeat, error and programming pins to status LEDs. At startup each of them blinks rapidly for a moment then the heartbeat LED keeps on pulsing.
  • I'm connecting the programmer (Arduino) with the target (USBasp) using the programmer cable seen on the picture of the USBasp (see above). I'm plugging the 6pin adapter to the ICSP of the Arduino the other end to the USBasp.
  • I've tried connecting the pins with jumpers instead of the cable without success. I've also tried using pins 11, 12 and 13 instead of the ICSP pins as written in the header comments of the official ArduinoISP sketch fike. Same effect.
  • When I try to execute an avrdude command like this
    ./avrdude.exe -C ../etc/avrdude.conf -c avrisp -p m8 -P COM6 -vvvvv -t
    then the above output is generated, always.
  • When the command is executed I can see the RX LED blinking 3 times on the Arduino. Then pause. Then it blinks once 10 times. Then avrdude gives up.
  • I've tried connecting the JP1, JP2, JP3 pins (JP3 are two holes) to enable "self-programming" on the USBasp, without success. Currently the JP2 pins are connected with the jumper (like on the USBasp pictures).
  • The chip on the USB is an ATMEGA8L 8AU.

 

Is what I'm trying to do possible at all?

What could I've been doing wrong?

I'm very keen to get to the bottom of this.

Thanks for any kind of help, let me know if I need to provide some more information aside from this (bare in mind I'm a newbie in this).

 

This topic has a solution.
Last Edited: Sat. Mar 11, 2017 - 05:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Chinese firmware on your Chinese USBASP works 100% perfectly.   The "SCK warning" occurs because the Chinese set the best SCK speed automatically.

 

Yes,  you can install the inferior German firmware if that is what you really want:

1.  unplug USBASP from USB

2.  make the JP2 programming link with a jumper.

3.  connect ArduinoISP cable.

4.  read the ATmega8 Signature with avrdude.

 

5.  If all this goes ok,  program the new firmware.

6.  remove JP2 jumper.

7.  USBASP will run the German firmware.  

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the reply David. What I really want is to

  • first backup the original firmware with avrdude,
  • then write a custom firmware (not the German) to the USBasp.

My focus right now is on the first step, because I'm not able to do that.

 

In reply to your steps

1.  unplug USBASP from USB

I'm doing it like that.

2.  make the JP2 programming link with a jumper.

Now this part is confusing. Several tutorials on the net that uses a different USBasp suggests the same, however on my USBasp (as seen in the picture in the Aliexpress link) the JPX marks are swapped.
For me it's not clear what needs to be jumper cabled together exactly.

3.  connect ArduinoISP cable.

If you meant connect the Arduino via USB to my PC then connect the Arduino and the USBasp with the programmer cable, then I did that.

4.  read the ATmega8 Signature with avrdude.

./avrdude.exe -C ../etc/avrdude.conf -c avrisp -p m8 -P COM6 -vvvvv -t

I did this, but it doesn't even connects, see the error message I've included in my first post.

The avrdude executable is from the latest Arduino distribution.

5.  If all this goes ok,  program the new firmware.

6.  remove JP2 jumper.

7.  USBASP will run the German firmware. 

 

I hadn't had success from points 4 to 7 yet. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kohanyi.robert wrote:

4.  read the ATmega8 Signature with avrdude.

./avrdude.exe -C ../etc/avrdude.conf -c avrisp -p m8 -P COM6 -vvvvv -t

I did this, but it doesn't even connects, see the error message I've included in my first post.

 

Of course this can never work.   ArduinoISP expects 19200 baud.   Personally I would call the ArduinoISP protocol -c stk500v1  but avrisp is an obfuscated name that might do the same job. e.g.

 

./avrdude.exe -C ../etc/avrdude.conf -c stk500v1 -p m8 -P COM6 -b 19200

 

you might like all the -vvvv.  I certainly would never use the -t Terminal mode.   A single -v will give you the current fuse values.  Of course,  the best way to operate avrdude is with the correct specific commands.

 

The real mystery is:   Why replace good working Chinese firmware ?

 

Oh, and it is very unlikely that the Chinese firmware is unlocked.   So you have zero chance of backing it up.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 [...] ArduinoISP expects 19200 baud [...]

./avrdude.exe -C ../etc/avrdude.conf -c stk500v1 -p m8 -P COM6 -b 19200

Yeah, you're right, I've forgot to mention that I've tried different bauds as well (I've forgotten to include the baudrate specifier in my command above).

However, it didn't work even if I specified it.

Please note that when I execute the avrdude command I can see the Arduino's RX LED blink three times. With -vvvvvv I can see that avrdude sends 3 messages (3 blink on the LED), but there is no response from the Arduino.

 

I've also tried using -c avrisp, -c arduino, -c stk500v1 and -c stk500v2 as well. Nothing really changed (with stk500v2 the message sent to the Arduino was different though).

 

I've tried -t just for kicks. At first I've tried reading the flash, writing as well, but that too didn't work, nothing changed.

Why replace good working Chinese firmware?

Well, this is the only USBasp that I have right now and want to use it as an 8051 programmer with custom firmware, that's the goal eventually.

 

First I wanted to backup the firmware.

Oh, and it is very unlikely that the Chinese firmware is unlocked.  So you have zero chance of backing it up.

It never occurred to me that this could be the case. How can I make sure this is happening? If I can't backup the original firmware then I don't want to overwrite it. My guess is that if I can't read the firmware I won't be able to overwrite it.

 

It's not a problem, I just want to know my options. (Since then I've ordered another USBasp, the same one that can be seen in the guide.)

Last Edited: Mon. Jan 30, 2017 - 08:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most Chinese USBASP firmware will work with an AT89S52.   German firmware definitely does not.

Chinese ProgISPv1.72 software will control your USBASP.

 

My firmware will work with several different 8051s e.g. AT89S8252, AT89S8253, AT89LP4052, ...   Even with different polarities of RESET circuitry.   And you use avrdude !!

 

Seriously,  you can read the USBASP Signature and re-program the USBASP firmware very easily.   i.e. JP2.

Some boards do not have a JP2 header.   You use a solder-bridge.

 

If you have a problem,  post clear photos and actual command lines with a description of the result.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most Chinese USBASP firmware will work with an AT89S52.

Chinese ProgISPv1.72 software will control your USBASP.

Well good to know! I'll definitely try that before I do any mocking around.

My firmware will work with several different 8051s

By "my" firmware you mean the Chinese one?

If you have a problem,  post clear photos and actual command lines with a description of the result.

Will do whenever I'll have the time. You've been a huge help even like this! I'll definitely get back with my findings. Lots of people are struggling with the same issues out there as I've noticed this while I was searching for an answer over the last two days.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No,  I am not Chinese.    I wrote some 8051 USBASP firmware for my own 8051 controllers.  

 

Which particular 8051 models do you want to program?

What 8051 dev board(s) are you using?

 

Members of this Forum have an overwhelming desire to shoot their own feet.

e.g. they want to use avrdude -F

e.g. they want to set the RSTDISBL fuse

 

Then they can start interminable threads about how they bricked their AVR.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wrote some 8051 USBASP firmware for my own 8051 controllers.

Cool, are these shared somewhere like GitHub? It would be good for reference. I'd like to write my own.

Which particular 8051 models do you want to program?

I have an AT89S52 AT89S51 MCU. So the stock Chinese firmware maybe will do the trick. I'll try it next chance I have.

What 8051 dev board(s) are you using?

I'm assembling the circuit, resistors, capacitors and whatnot myself. I don't have a development board.

Members of this Forum have an overwhelming desire to shoot their own feet.

Thanks for being constructive even if it seems I'm trying to shoot my own feet.

Last Edited: Fri. Feb 17, 2017 - 05:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wrote the 8051 firmware some time ago.   I probably posted it here.   No,  it is not on GitHub.

 

Several Chinese/Indian GUI programs will program AT89S52 via Chinese USBASP dongles.

Some claim to program AT89S8253.    I do not believe them.

 

Regular Atmel hardware programmers like STK500, STK600, AVRISP-2 can program AT89S52.

 

So I suggest that you try the Chinese Progisp1.72 first.

 

If you have not managed to get ArduinoISP to read the Signature of the ATmega8 in the USBASP,   it is unwise (tm) to even think of changing firmware.

 

I would strongly recommend that you buy an 8051 dev board.   Most Chinese 8051 dev boards come with a 5x2 header socket for the USBASP cable.   What country are you in?

 

David.

Last Edited: Wed. Feb 1, 2017 - 09:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've made an error earlier. I've an AT89S51 chip instead of an AT89S52. Doesn't matter too much.

So I suggest that you try the Chinese Progisp1.72 first.

Yep, I've already downloaded it.

I would strongly recommend that you buy an 8051 dev board.

I don't have that unfortunately, not for now anyways. Until then I'm trying to assemble a circuit I can program with my USBasp, based on this.

What country are you in?

I'm Hungarian, living in Hungary. I order stuff usually from AliExpress.

Last Edited: Fri. Feb 17, 2017 - 08:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've the exact same board, from Aliexpress too, and exact same error (resp=0x03). Oh and it's also from the exact same seller !

Do anybody have an idea of what's happening ?

The usbasp seems to be in self programming mode as its leds shut off as I plug the jumper.

The chip is an ATmega8L-8MU

Edit : Forgot to mention that I'd like to flash the firmware because this usbasp is not able to program any controller. It writes without error message but verification fails and the program won't start. The exact dame process works perfectly with any other of my usbasp.

Last Edited: Sun. Feb 19, 2017 - 04:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David Prentice wrote this earlier

it is very unlikely that the Chinese firmware is unlocked.

So if you're trying to update the firmware on the USBasp it might not be possible.
I've ordered another "Chinese" USBasp, a different one. It hasn't arrived yet, but I think this USBasp (the one we both have) cannot be updated or not like this.

 

On a side note. What are you trying to do exactly? I've wanted to update the firmware of USBasp using an Arduino Micro loaded with the ArduinoISP sketch (without much success).

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes I understand that I might not be able to backup the current firmware, but that's not a problem for me since for now this thing is just garbage, because I can't even use it to write on any controller, that's why I'd like to go on another firmware, and if it fails, I'll not lose my usbasp because it's not working either now.

 

I'm trying tu update the firmware via ArduinoISP with a uno board, I used it on another usbasp (not the same board) and it worked perfectly, but with this one I just get error.

 

I think for this price (less than 3$..) it's not worth the effort, I'll just order another one and make sure it's not the same board.

 

But I admit that I'm still interested in why I can't update it like this and how could I, just for information !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm still interested in why I can't update it like this and how could I

Yeah, me too. It'd be nice to know who manufacture's these, or to have a schematic at least.

 

Edit: I've messaged the seller on AliExpress, maybe they have a datasheet for this or something.

Last Edited: Sun. Feb 19, 2017 - 01:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can find a schematic on the USBASP website.

It is pretty clear who makes which pcb.  e.g. Bete.cn,  LcSoft, ...

You can identify all the components from the schematic.   Why do you care about the pcb manufacturer?

 

The Chinese dongles generally have a link or solder-bridge to let you use 3.3V or 5V.

You can trace this extra circuitry by hand.

 

I don't know why you want to change the good Chinese firmware.

But if you do,  it is very straightforward.

 

Plan your strategy.   e.g. book the hospital appointment before you shoot your foot.  is life better without toes?

Quite honestly,  if you can't follow the web tutorials,   you should not attempt this.

David.

Last Edited: Sun. Feb 19, 2017 - 02:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kohanyi.robert wrote:

Edit: I've messaged the seller on AliExpress, maybe they have a datasheet for this or something.

 

I did that too

 

david.prentice wrote:

I don't know why you want to change the good Chinese firmware.

But if you do,  it is very straightforward.

 

Plan your strategy.   e.g. book the hospital appointment before you shoot your foot.  is life better without toes?

Quite honestly,  if you can't follow the web tutorials,   you should not attempt this.

David.

 

Thank you for your answer, but as I said, currently mine is not working properly, I don't want to update the firmware just for fun smiley

And the problem doesn't seems to be that I can't follow a web tutorial, as I already did the process a few times before for other boards without any problem.

This one just doesn't want to comunicate with my isp with the "standard" method described in all web tutorials, and that's why I came here, looking for suggestions

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no magic involved. You just communicate with the ATmega8 on the USBASP board.
You can erase the existing firmware.
You can program the new firmware into Flash.
Job done.
It is likely that the fuses were correct in the first place.
But you can program them too, if necessary.
.
If you have a problem, describe it accurately. Someone will walk you through the procedure.
.
David.
.
As I asked earlier. Why would you want to replace good Chinese firmware?

Last Edited: Sun. Feb 19, 2017 - 06:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Helló Róbert !

 

Ha megírnád a problémádat, lehet, hogy tudnék segíteni !

Last Edited: Sun. Feb 19, 2017 - 07:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can identify all the components from the schematic.

Well, at this point I can't, I'm not able to.

Why do you care about the pcb manufacturer?

Well, I thought maybe they have a "how to update the firmware" guide or something. On the actual USBasp I haven't seen anything that would indicate who made it, but as I've said I'm not an expert.

Quite honestly,  if you can't follow the web tutorials,   you should not attempt this.

That's a point, although I would argue that most tutorials are plain rubbish in this topic or assume I'm an expert electro-technician (which I'm not).
I haven't found a tutorial that would upgrade the firmware on this particular model. Tutorials showing how to update other USBasp firmwares didn't work me.

 

Just saying, I'm not trying to shoot my foot anymore :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aladar wrote:

Helló Róbert !

 

Ha megírnád a problémádat, lehet, hogy tudnék segíteni !

His saying that if I contact him he can perhaps help me out (because he's Hungarian too).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok so just a quick update, I've found out that my issue was in fact due to a poorly soldered board leading to a bad contact somewhere.
-1 for cheap chinese boards ..
Anyway thank you for your replies

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With the help of David Prentice I was able to update the firmware on my USBasp.
However I wasn't able to do this using the ArduinoISP sketch.
I had to use 2 USBasp one acting as the programmer the other the target.
I've summarized the steps for myself and I'm sharing it here.

 

  • Use zadig to easily install Windows USB drivers (libusb-win32 or libusbK)

  • Have 2 USBasp programmers

  • Put one USBasp into self-programming mode (short the JP2 or JP3 header - whichever is next to JP1) - this will be the target, the other will be the programmer

  • Connect the target and the programmer USBasp via their ISP headers using a 10-pin programmer cable

  • Test if you can read the flash of the target and write it back immediately using avrdude

    • Reading: avrdude -c usbasp -p m8 -U flash:r:orig_firmware.bin:r

    • Writing: avrdude -c usbasp -p m8 -U flash:w:orig_firmware.bin:r

  • Convert the latest fischl firmware from hex to binary

  • avr-objcopy -I ihex -O binary new_firmware.hex new_firmware.bin

  • Write the binary firmware to the target

    • avrdude -c usbasp -p m8 -U flash:w:new_firmware.bin:r

 

After updating the firmware I tried to communicate with the updated USBasp through an Arduino loaded with the ArduinoISP sketch, but it didn't work. I guess it's just not possible to do that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I would always be happier with HEX files.  BIN files are not human readable.

avrdude -c usbasp -p m8 -U flash:w:new_firmware.hex:i

ArduinoISP should work fine too:

avrdude -c stk500v1 -P COM99 -b 19200 -p m8 -U flash:w:new_firmware.hex:i

where you use the correct COM# instead of COM99

 

You can append the AT89 devices from the avrdude.AT89 file to your regular avrdude.conf file.

Or just use it as is:

avrdude -c usbasp -C avrdude.AT89 -p AT89S52 -B4

Note that the firmware in main.hex will auto-detect the Reset polarity and use a different SPI mode for AT89S8253.   It does not auto-detect the best speed.   e.g. use -B4 for a 1MHz AVR or 12MHz AT89

 

Note that my auto-detect is fine with avrdude.   ProgISPv1.72 does not like it.

 

David.

Attachment(s): 

Last Edited: Sat. Mar 11, 2017 - 10:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

#24 only applies to programming extra 8051 targets.

 

The regular $3 Chinese USBASP bought on Ebay comes with perfectly good Chinese firmware.

There is no need to change the firmware at all.

 

The Chinese firmware is superior to the German fischl.de firmware because it automatically selects the best SCK frequency.

You should just ignore the "SCK warning".

 

If you do install the fischl.de firmware you will have to set the SCK frequency manually.   If you get it wrong,  the AVR will not connect.

 

David.

Last Edited: Tue. May 29, 2018 - 02:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
 It is likely that the fuses were correct in the first place. But you can program them too, if necessary.

 

How would you know if the fuses were correct? How do you program them?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you David for your work, thanks to the attached firmware I was able to use my usbasp to program an AT89S8253.