Fixing USBasp based on ATmega8

bperrybap:
Are you involved with a school/students or something? I can't imaging being involved with purchasing so many units.

actually i run an assembly house and one of my clients hires me to purchase and ship a programmer with each unit. the usbasp was by far lowest cost and unlike tiny or mkII fewer "issues" so thats what i chose.

bperrybap:
Nearly all the ones I've seen on Ebay do have the jumpers or at least the pads for the
3 options. VCC passthrough, slow SCK, programming.

a quick search for lowest cost units (click both price lowest & buy it now) will show the reverse may be true:

nearly all the lowest cost ones are betemcu design which as i mentioned have voltage and reflash jumpers but no slow clk (see attachment). the new lcsoft design is just starting to appear but they only started showing up last year or so. i always go for the lowest cost deal and since nobody will do qty discount or combined shipping on those they are out of the running.

bperrybap:
The only difference between my code and the stock .hex is that
I tweaked the way the LEDs work. The rest of the code is unchanged.

ah.. you mentioned something special to supress that message but if not then no point posting hex. but i do think hex is far more helpful than source because i see 99%, my customer base for example, are not set up to compile or tweak but no problem flashing. sometimes we forget not everyone is a hacker/guru.

BEST-BI00087.jpg

bill, i hope you dont mind me posting instead of pm. email is difficult for me and others might benefit from public info. specially those with the particular model we are discussing which seems to account for lions share of the ones out there today. i wish this info was available to me when i started out instead of having to learn the hard way.

j2 seen in my pic is definitely the re-flash jumper as ive reflashed many of the misbehaving units with either official image or supposedly "improved" versions from freaks. usually it helps, on very few occasions not. i should also mention that these really come with NO jumpers and the only pads are for j2. there are no pads for "passthrough" like you might find on dragon, mkII, or stk500 clones. but on the other side theres a 0 ohm resistor which serves the purpose of 3.3v/5v select if replaced with a jumper. basically it shorts the ldo. far more useful than a passthrough imo.

what you suspect might be pads for pc2 are definitely not but are vias which do not seem to be useable for slow clk if my continuity tests are correct. on a few units when i removed the mcu it appeared pc2 went under the chip where it was grounded in some and appeared to be cut in others. i think they did this to make it work better with whatever peculiar firmware version was being used at that time.

judging by some difference in behaviours im certain the firmware has been tweaked and looks to me like at least 3 separate versions. maybe more. this would explain differences between what you and i see in out own units.

you are right about my desire to remove the message being cosmetic. not so much for me but generally to reduce confusion when noobs see it and think there is a fatal error. probably hundreds of posts between here, freaks, robot, and rc forums. most of mine send that out regardless of target clock so you are probably right about it due to permanently wired pc2 or else tweaked firmware.

The thread is ok, I used PM since this is drifting away from the original topic.

The VCC passthrough jumper is useful if you need to disable the USBasp putting power on the ISP connector
because the device is already powered.
For example, say you want to use the USBasp to upload sketches on an UNO but then also want
to keep the UNO plugged into the PC to keep a live serial connection.
For this setup, you really should disable the voltage from the USBasp device
going into the ISP connector since that will be driven by the UNO.


Removing the warning message simply requires updating the firmware
to firmware that supports the SETISPSCK command.

But like I said, in order to ensure that the device is being updated with the correct
firmware, the user will have to verify a few things like

  • processor type
  • crystal frequency
  • board layout

to ensure the USBasp device is properly put into programming mode and then
programmed with a firmware that works for that device's processor, clock speed,
and board layout.

In the case of my device, the layout, pin connections, and LED connections
matched the official Fischl design.
The only difference was that the jumper numbers on the PCB silkscreen didn't match
but that didn't affect the actual firmware.

If the device does not match the official design, by say using a different clock than 12mhz
or using other pins for the LEDs or slow SCK, then the user will
have to make a few small changes to the code and rebuild the USBasp firmware image.

My device was purchased about 6 months ago, but yet had firmware in it that was
more than 3 years old. I updated the firmware to the latest version
that would run on the atmega48 which is what is on my USBasp.
Before I did the update I also modified the code with a few of my own tweaks to change the LED behavior.

--- bill

yes, yours is the lcsoft v2 which matches that offcial schematic exactly. i have a couple of those but because they are more expensive and cable is too short do not use them for customers. btw my lcsofts have m8 instead of m48. in fact i never saw anything but m8 on any of the usbasps i bought. they all work with standard firmware but i do wish i had copies of the factory image because some worked better than others. you are lucky to find one unlocked but all mine came locked.

talking about power options i suppose its a matter of personal preference whether passthrough or 3.3v/5v select. for me i almost always power from the dongle during software development. however i often have to switch between the old 5v and the new standard, 3.3v, so a jumper that shorts the ldo is convenient. would make far more sense to have a 3 pin jumper to allow all 3 options but never seen that.

btw you mentioned my field units not needing slow clk. surprise! my customers design runs at 1mhz. the only fuses i change are bod and eesave. fortunately all of the usbasps i ship work ok, worst case needing -B. i do test for that before letting them out but do get an occasional fellow calling and saying his unit dont work when actaully it was just that warning. customers, cant live with 'em and cant shoot 'em... well you could but then whod sign the checks. lol!

john1993:
... i do wish i had copies of the factory image because some worked better than others. you are lucky to find one unlocked but all mine came locked.

The zip images that fischle has on his site:
http://www.fischl.de/usbasp/
have .hex images for the official firmware.
Locked/unlock AVR on the USBasp doesn't matter.
You can simply erase the chip to remove the lock, set the fuses again, then burn/upload the image you want.
The supplied Makefile even has rules in it to set the fuses and burn the image.
(just fill in your target processor and AVR programmer information)

talking about power options i suppose its a matter of personal preference whether passthrough or 3.3v/5v select. for me i almost always power from the dongle during software development. however i often have to switch between the old 5v and the new standard, 3.3v, so a jumper that shorts the ldo is convenient. would make far more sense to have a 3 pin jumper to allow all 3 options but never seen that.

You could use a different programmer. Many like the newer USBtiny or the Dragon have logic levelers and will adjust
to the targets voltage level.
I typically power my targets from USB or batteries.
I plugged in my USBasp to USB for power when I updated it using my AVR dragon.
(My Dragon is setup not to provide power on the ISP connector but rather to adapt to target voltage level)

btw you mentioned my field units not needing slow clk. surprise! my customers design runs at 1mhz. the only fuses i change are bod and eesave. fortunately all of the usbasps i ship work ok, worst case needing -B. i do test for that before letting them out but do get an occasional fellow calling and saying his unit dont work when actaully it was just that warning. customers, cant live with 'em and cant shoot 'em... well you could but then whod sign the checks. lol!

I'm surprised they work at 1Mhz without a slower SCK.
Are you sure the CLKDIV8 fuse is set and the processor is running at 1Mhz?
i.e. are they really running 1Mhz or are they running 8Mhz?

If still using Windows (which seems to be quite popular)
I think I'd ship a self extracting autoexecuting zip image that autoexecutes
either some batch file or something like a autohotkey GUI as a wrapper around
avrdude to automatically do the update. That way all they do run a single executable you send them
and everything else is magically done for them.
The autoexecuted wrapper can test the return status of avrdude to confirm whether or not it worked
and post a message whether or not it work.
You can also control the avrdude commandline options to include the -B option and
even redirect all the avrdude output so they wouldn't ever see any avrdude messages
and only see the messages you supply.

--- bill


But back to Alx.
Were you able to solve/resolve your issue?
or get your USBasp device updated?

Yesterday I received a USBasp programmer I bought from hobby king. It too gives the clock warning messages but otherwise seems to function fine burning bootloaders or sketches via the upload using programmer option. I tested it on both a 328P based board and a mega1280 based board. Good price, and they did a 6 and 10 pin ISCP trick in the cable that seems to work fine for the arduino 6 pin ISCP pinout. I bought it because while I love my USBtiny programmer it doesn't seem to work on AVR chips with flash sizes greater then 64 K words (128KB).

Anyway it has just one jumper, I'm assuming it's for powering the target, did not even try removing it. I can live with the warning message and can always use the USBtiny to burn fuses on virgin chips if required.

Lefty

Lefty,
Since you are seeing the avrdude warning that probably means you have firmware that is
from 2007 or earlier since all releases after 2007 starting in 2009 had SETISPCLK.

It would only take a few minutes of looking at the PCB to determine the necessary information
to see if works with the standard Fischl firmware (I'm assuming it will) and to identify what the jumper
really does and if there are pads for programming or slow SCK and how the LEDs are connected.
(It's only 4 AVR pins and 1 ISP pin that needs to be looked at)

In the photo, there is what looks like set of holes just below the AVR (labeled R8 or A8)
just to the left the black jumper.

Since you have a USBtiny, you could use that to upgrade the f/w in the USBasp device
then have a fully functional USBasp device rather than one that mostly works.

Even if you decide not to update the firmware, it would be nice to know what the jumper does.
It could be slow SCK or VCC power passthrough.
Should take only a few seconds to figure that out.

--- bill

bperrybap:
Lefty,
Since you are seeing the avrdude warning that probably means you have firmware that is
from 2007 or earlier since all releases after 2007 starting in 2009 had SETISPCLK.

That is probably the case. No documentation comes with the product, but they do have a link to
a rather large downloadable files section, including a hex file that is probably the firmware for
the ATmega8A chip the unit uses. in the purple files tab:
http://www.hobbyking.com/hobbyking/store/__21321__USBasp_AVR_Programming_Device_for_ATMEL_proccessors.html?strSearch=USBasp

It would only take a few minutes of looking at the PCB to determine the necessary information
to see if works with the standard Fischl firmware (I'm assuming it will) and to identify what the jumper
really does and if there are pads for programming or slow SCK and how the LEDs are connected.
(It's only 4 AVR pins and 1 ISP pin that needs to be looked at)

Well I tested the removable J1 jumper and it does provide or disable power to the target device.

In the photo, there is what looks like set of holes just below the AVR (labeled R8 or A8)
just to the left the black jumper.

Yes R8 on inspection appears to just be two solder pads. What does one do with that those, solder a jumper to force the chip into updating mode?

Since you have a USBtiny, you could use that to upgrade the f/w in the USBasp device
then have a fully functional USBasp device rather than one that mostly works.

I would be willing to give it a shot if I could be somewhat reassured that the firmware upgrade hex file
(where ever that might be located) was compatible with this specific avr8A chip. I bought the programmer on a mostly a lark to see if a $5 programmer could really work with my mega boards and the arduino IDE without a lot of drama involved and so far it does accomplish that task.
I'm not to clear on the actual physical connection I would have to make between my USBtiny programmer and this unit to perform the firmware upgrade, is it just attaching the two 6 pin ISP connector pins together?

Thanks
Lefty

Even if you decide not to update the firmware, it would be nice to know what the jumper does.
It could be slow SCK or VCC power passthrough.
Should take only a few seconds to figure that out.

--- bill

Lefty

Lefty,
I had a look at the files in your link.
The user manual shows that J1 is for power.
They also have zip files for 2 of Fischl's releases (2009-02-28 and 2006-12-29)
Given you are getting SCK warning, I'm guessing that your code may be the 2006-12-29 release
since the 2009-02-28 release has the SETISPSCK command and would not get the warning.
If so, your code is over 6 years old!
You guys should POUND on the vendors for shipping products with such old firmware.
There is no reason for it - Its all open source.
They could simply change the firmware build they use and make things better for new customers immediately.


For USBasp upgrades:

To be assured that a firmware update will work, it has more do with the connections and board layout
than the actual processor. i.e. just because the code uploads and runs on the processor doesn't mean it will function correctly.

You will first have to identify the processor on the board.
If the label has been sanded off (some vendors do this - which makes no sense on a open source product)
you will have use avrdude to get the signature and then lookup the part based on signature.

After that you will need to verify the board layout and how things are hooked up to the AVR.
The most critical pins are the pins connected to the LEDs, RESET, and the connection
for slow SCK.
Attached is the typical pinout for a atmega8/48/88.
To work with Fischl's firmware,
you need to verify these AVR pins:

This will take some careful looking at the traces on the PCB and may
require the use of a magnifying glass.

29/RESET - needs to connect to a jumper and then to the RESET pin on the ISP connector
(This is the programming jumper)

24/PC1 - this is connected to the Red LED
23/PC0 - this is connected to the Green LED
25/PC2 - This is the input pin for the slow SCK option jumper
(when grounded, it forces slow SCK)

If you have those connections, then the Fischl firmware should work.
I always build my own open source code since I like to know exactly
what I'm getting. You can use a prebuilt firmware .hex image.
Go the fischl site and get the zip image
http://www.fischl.de/usbasp/
If you extract the files, look down in
usbasp.2011-05-28/bin/firmware
in there you will find images for atmega48, atmega8, and atmega88
Note: that the atmega48 image is from 2009 vs the 2011 sources as the latest firmware
is too large to fit in the 4k space on the atmega48.
If you want to build your own atmega48 code image, you will
need to grab the 2009-02-28 zip image.

To upgrade the image, insert the programming jumper,
then connect up an ISP cable from your other ISP programmer
directly to your USBasp ISP connector.
My USBasp device has a 6 pin ISP connector but many have 10 pin connectors.

Make sure your USBasp has power - It can be powered from
USB or from the ISP connector (only one not both) depending on your
other ISP programmer being used.

Then simply use avrdude to upgrade your USBasp with the .hex you built
or the proper pre-built .hex image.

--- bill

avr8.png

Bill;

Thanks for the little kick in the butt. It went quickly and very well uploading the newer firmware and now it all still works but with no silly clock warning message at the end of operations.

Lefty

bperrybap:
Locked/unlock AVR on the USBasp doesn't matter. You can simply erase the chip to remove the lock, set the fuses again, then burn/upload the image you want.

it definitely matters if the unit was locked and stops working with other firmware and we were not able to restore original because we couldnt read it. fortunately this happened with very few models.

bperrybap:
You could use a different programmer. Many like the newer USBtiny or the Dragon have logic levelers and will adjust
to the targets voltage level.

i own mkII, dragon, and a couple usbtiny. they all had issues and more problems in my applications than usbasp. then theres the fact that i can buy 20 usbasp for the cost of one dragon and 10 for the cost of a mkII. of course usbasp dont have jtag or dbw ability but neither do my chips so dragons pretty much sitting on a shelf.

bperrybap:
I'm surprised they work at 1Mhz without a slower SCK. Are you sure the CLKDIV8 fuse is set and the processor is running at 1Mhz?
i.e. are they really running 1Mhz or are they running 8Mhz?

im positive the div8 is on. after programming literally thousands of chips ive never seen one come from the factory with it off. and i check each during flash and again before shipping. no menus or icons being clicked. a cmd line bat file makes it pretty foolproof.

some usbasp do 1mhz chips w/o -B and some need it. its always used just to be sure. none of mine have a slow clock jumper. it depends on what chinese firmware was used and whether they have grounded pc2 under the chip. from what i can tell by lack of warning and -B response not all use the official images. i think its important to know that there are other versions floating around out there. on rare occasions using official firmware (old or new) causes units to stop working properly. personally id advise against reflashing unless there is good reason and its known to be safe. i think in most cases it is but anyway...

i do need to pick up one of those hk units even though a little pricey. they are not available on ebay. ali, dx, etc and appears tony hand commissioned a new design. im glad he stuck with Fischl compatibility.

i do need to pick up one of those hk units even though a little pricey. they are not available on ebay. ali, dx, etc and appears tony hand commissioned a new design. im glad he stuck with Fischl compatibility.

Just to review what I found with this specific Hobby King version of the USBasp programmer. I only had to tack solder a two pin male header to the two solder pads labeled R8, then install a shorting clip to it and then wired up the unit to my USBtiny programmer and burn the firmware file named usbasp.atmega8.2009-02-28.hex as this unit has a AVR8A chip. No errors were reported during the firmware upload and after testing with the arduino IDE all operations still worked (as before) but the SCK warning messages now don't print out at the completion of operations.

Lefty

john1993:

bperrybap:
Locked/unlock AVR on the USBasp doesn't matter. You can simply erase the chip to remove the lock, set the fuses again, then burn/upload the image you want.

it definitely matters if the unit was locked and stops working with other firmware and we were not able to restore original because we couldnt read it. fortunately this happened with very few models.

True that having a locked AVR on the USBasp will prevent reading the original firmware
to save it away for the possibility of restoring it, but
from your previous comment:

you are lucky to find one unlocked but all mine came locked.

I was assuming you were referring to LOCK fuse bits and the inability to update
the AVR if the LOCK bits were set.
LOCK fuse bits being set doesn't prevent the AVR from being re-programmed
so a locked avr on a USBasp device won't matter with respect the ability to re-flash
a new/updated USBasp firmware image.

bperrybap:
You could use a different programmer. Many like the newer USBtiny or the Dragon have logic levelers and will adjust
to the targets voltage level.

i own mkII, dragon, and a couple usbtiny. they all had issues and more problems in my applications than usbasp. then theres the fact that i can buy 20 usbasp for the cost of one dragon and 10 for the cost of a mkII. of course usbasp dont have jtag or dbw ability but neither do my chips so dragons pretty much sitting on a shelf.

I brought up the other devices as devices that could be used to update the firmware on the
the USBasp devices that you ship to your customers.
I wasn't intending that that be used as alternatives for programming devices for the customers.

personally id advise against reflashing unless there is good reason and its known to be safe.

I wouldn't go that far.
I'd say updating is actually a good thing as it removes a bothersome warning from avrdude
and also adds in functionality that can be required in some environments.
However, I'd also say don't just blindly flash an updated Fischl image into the device.
The key is to reflash an image that works with the target hardware.
So in order to be sure the image works with his hardware, the
USBasp device hardware design must be compared to the Fischl reference design.
The USBasp hardware is very simple. It is typically on dual sided PCBs so it is very easy
to follow all the traces and decide if it matches the Fischl hardware.
If it doesn't exactly match, the user can then decide if they wish
to tweak the firmware source code to match the wiring using on their PCB and rebuild it
or whether to not do the re-flash.

--- bill

bperrybap:
I was assuming you were referring to LOCK fuse bits and the inability to update the AVR if the LOCK bits were set.

i think everyone here must know by now you can always erase/reflash as long as the dreaded rstdsbl bit aint on. it would be nice if i could have read some of those locked units though because they were much better behaved than the 'fficial firmware.

bperrybap:
I brought up the other devices as devices that could be used to update the firmware on the the USBasp devices that you ship to your customers. I wasn't intending that that be used as alternatives for programming devices for the customers.

it looked like you were responding to my comments about lack of passthrough on the usbasp. in any case we agree they are not replacements. the usbasp will certainly never be as useful for debugging some chips as the dragon and hard to beat those $3 ebay deals for an excellent all round programmer.

i did just bit the bullet and tacked one onto a hobbyking order. i wish they wouldnt play games with shipping weight to make things look cheaper than they really are. still these are a great deal with that 6pin cable and i just cant hold back curiosity over whatever other little construction details.

I have purchased several of these Chinese USBasp programmers with the metal case covers. These are very nicely built.

You can also get them cheaper in bulk for about $4.00 ea.

http://www.ebay.com/itm/8pcs-lot-Colors-USB-ISP-USBISP-USBasp-ASP-Programmer-for-51-ATMEL-AVR-Download-/160828867138?pt=LH_DefaultDomain_0&hash=item257225c242

They are based on the USBasp circuit design with an Atmega8L. The problem with these are they do not actually use the USBasp firmware. They do not work direclty with avrdude. They emulate an USB HID device so they can install without any Windows drivers. The catch is they need to use a special Windows GUI (progisp.exe) program to burn AVRs. They are based on the MX-USBISP-V3.00 2012-05-20 pcb. See image.

I found that you can reprogram these with the fischl.de usbasp.atmega8.2009-02-28.hex or usbasp.atmega8.2011-05-28.hex firmware and they seem to work great.

  1. They usually have the lock bits set so you will have to erase it first.
  2. Also the back of the pcb have three solder bridges that need to be removed. See image.
  3. Short the two holes the arrows are pointing from to the UP label. This is the RESET line for self-programming.


MX-USBISP-V3.00_bottom_b.jpg

MX-USBISP-V3.00_bottom_a.jpg

very interesting. i have one of those in my collection and wondered why it didnt work. since it cost more than the others i didnt try reflashing or anything. strange they would choose oddball firmware. it would be nice if the avrdudes switched to hid because that libusb baloney is a real pain in the butt.

Dear folks,

first of all thank you all very much for all the replies. I was really sick the past week, barely able to get outta bed. I'll be reading through all that went on in the thread and try and assimilated all the valuable info. I have not forgotten about this and I am still interested in the subject, trust me!

retrolefty:

i do need to pick up one of those hk units even though a little pricey. they are not available on ebay. ali, dx, etc and appears tony hand commissioned a new design. im glad he stuck with Fischl compatibility.

Just to review what I found with this specific Hobby King version of the USBasp programmer. I only had to tack solder a two pin male header to the two solder pads labeled R8, then install a shorting clip to it and then wired up the unit to my USBtiny programmer and burn the firmware file named usbasp.atmega8.2009-02-28.hex as this unit has a AVR8A chip. No errors were reported during the firmware upload and after testing with the arduino IDE all operations still worked (as before) but the SCK warning messages now don't print out at the completion of operations.

Lefty

Lefty, check my post count. This clearly isn't my area of expertise :), but I am going to try to update my HobbyKing USBasp programmer firmware as well. I've read (or at least skimmed) this entire thread, as well as dozens of others, but I don't want that stupid error either. I've used the USBasp on my Arduino and gotten the same error. This discussion is waaaaaay over my head right now, but I'll do my best. I have an Arduino Duemilanove that I'd like to use as an ISP in order to update the firmware on my HK USBasp. I know the File --> Examples --> ArduinoISP code exists, so....what do I do next? I have no idea how to build a hex file either, but I have stumbled upon this site with the latest driver (libusb-win32 download | SourceForge.net --> Download section --> Project Download Site [or just click here: libusb-win32 - Browse Files at SourceForge.net> "Download libusb-win32-bin-1.2.6.0.zip (913.2 kB)") for my USBasp, and wonder if it has what I need right here.

Also, what program do I use? Do I need AVRdude? Or can/should I use Extremeburner AVR or one of these other programs found in the list here: USBasp - USB programmer for Atmel AVR controllers - fischl.de under "Software"?

....my brain feels dead. I've spent all day on this. ...and I got an Arduino LED to blink.....

To upgrade the firmware on your Hobbyking USBASP programmer you can use avrdude with your Duemilanove as ArduinoISP. Don't forget you will need to disable the auto-reset on the Duemilanove by connecting a 10uF electrolytic capacitor between the reset and GND on the headers. Note the capacitor leads may not contact well into the Arduino headers so you may need to jumper it to a breadboard.

You will need to short the two solder pads labeled as R8 on the USBASP. This will connect the reset from the 10-pin header to the reset on the ATmega8A, to allow it to be programmed. Then jumper the ISP connections from your USBASP 10-pin header to the Arduino headers.

10-Pin header  to  Uno ArduinoISP
pin 5 RESET         D10
pin 1 MOSI           D11
pin 9 MISO           D12
pin 7 SCK            D13
pin 2 VCC            5V
pin 4 GND           GND

Download the firmware http://www.fischl.de/usbasp/usbasp.2011-05-28.tar.gz
Extract the \usbasp.2011-05-28\bin\firmware\usbasp.atmega8.2011-05-28.hex file.

Then use avrdude to upload the firmware. Adjust the COM port to your Duemilanove.

avrdude -c arduino -PCOM6 -b19200 -p m8 -v -U flash:w:usbasp.atmega8.2011-05-28.hex

ICSP-10Pin.JPG

Thanks, I'll give this a shot! Before I do though, how do I back up the current firmware inside my HK USBasp, just in case I screw something up and want to put it back in? And before you go on and tell me this is unnecessary, it's a good learning experience regardless, so I'd still like to know how to do it. Thanks again!