Pages: 1 2 [3] 4 5 6   Go Down
Author Topic: Fixing USBasp based on ATmega8  (Read 23123 times)
0 Members and 1 Guest are viewing this topic.
vermont
Offline Offline
Sr. Member
****
Karma: 6
Posts: 261
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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'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.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16470
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
 
Logged

Dallas, TX USA
Offline Offline
Edison Member
*
Karma: 47
Posts: 2327
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Quote
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.


Quote
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.

Quote
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
Logged

vermont
Offline Offline
Sr. Member
****
Karma: 6
Posts: 261
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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.
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have purchased several of these Chinese USBasp programmers with the metal case covers.  These are very nicely built.
http://www.ebay.com/itm/New-USB-ISP-USBISP-USBasp-ASP-Programmer-For-51-ATMEL-AVR-WIN7-64-/180937536014?pt=LH_DefaultDomain_0&hash=item2a20b7b20e

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 (26.17 KB, 615x322 - viewed 608 times.)

* MX-USBISP-V3.00_bottom_a.jpg (31.68 KB, 638x301 - viewed 605 times.)
« Last Edit: March 01, 2013, 08:25:17 am by hiduino » Logged

vermont
Offline Offline
Sr. Member
****
Karma: 6
Posts: 261
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

BHZ, MG, Brazil
Offline Offline
Sr. Member
****
Karma: 10
Posts: 346
Android developer; Arduino enthusiast
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Learn to live: Live to learn.
Showing off my work: http://arduino.cc/forum/index.php/topic,126197.0.html

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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 smiley, 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 (http://sourceforge.net/apps/trac/libusb-win32/wiki --> Download section --> Project Download Site [or just click here: http://sourceforge.net/projects/libusb-win32/files/--> "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:  http://www.fischl.de/usbasp/ under "Software"?

....my brain feels dead.  I've spent all day on this.  ...and I got an Arduino LED to blink.....
« Last Edit: April 13, 2013, 09:22:50 pm by panther3001 » Logged

Visit my RC aircraft blog at http://electricrcaircraftguy.blogspot.com/

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
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.
Code:
avrdude -c arduino -PCOM6 -b19200 -p m8 -v -U flash:w:usbasp.atmega8.2011-05-28.hex



* ICSP-10Pin.JPG (8.65 KB, 193x189 - viewed 217 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Visit my RC aircraft blog at http://electricrcaircraftguy.blogspot.com/

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just use avrdude to read the flash and save to file.
Code:
avrdude -c arduino -PCOM6 -b19200 -p m8 -v -U flash:r:usbasp.hobbyking_backup.hex:i


Then to restore back the original firmware.
Code:
avrdude -c arduino -PCOM6 -b19200 -p m8 -v -U flash:w:usbasp.hobbyking_backup.hex


On a side note, you can also test your connections first to make sure it can communicate with the chip properly.
Code:
avrdude -c arduino -PCOM6 -b19200 -p m8 -v


It should reply back with something like.
Code:
avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "...\Arduino\arduino-1.0.4\hardware\tools\avr\bin\avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : arduino
         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 : Arduino
         Description     : Arduino
         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

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as 9F
avrdude: safemode: hfuse reads as D9

avrdude: safemode: lfuse reads as 9F
avrdude: safemode: hfuse reads as D9
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey hiduino, thanks a ton! I haven't had a chance to do this yet but I will when I can.  As for the capacitor, to disable the duemilanove's auto-reset, you said to use a 10uF electrolytic capacitor, but I am assuming that's the *minimum* size required.  Is a 470uF ok instead?  That's what I have on hand: a Rubycon ZLH 470uF 25V.  Also, how does this work exactly?  I mean, what signal is the reset input on the header looking for, in order to force a reset, and how does the capacitor fix this?  This is more of a "why" question than a how-to question, as I like understanding how/why stuff works. 

PS.  I have a pretty good understanding about capacitors in general, so I understand they store charge and are high-speed devices, and can smooth ripple currents and voltages, smooth switching power supply outputs, etc. 
Logged

Visit my RC aircraft blog at http://electricrcaircraftguy.blogspot.com/

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 27
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A larger value capacitor should be fine.

Lookup the Automatic Reset under http://arduino.cc/en/Main/ArduinoBoardDuemilanove.

Basically when avrdude opens the connection to the Arduino Duemilanove the FT232 chip pulls DTR signal low to force a reset to the ATmega chip, which in turn will cause the bootloader to run.  Thus allowing normal sketch uploads.  However, when using the Arduino as ISP programmer, you do not want this to happen.  We want the Arduino to continue running the ArduinoISP sketch.

Putting the capacitor between the reset and GND will have enough charge to keep the reset line high, thus avoiding a reset condition.  This will allow the Arduino to continue running the ArduinoISP sketch and look like a programmer to avrdude.

« Last Edit: April 14, 2013, 06:45:20 pm by hiduino » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent, thanks! Very informative.  Makes a lot of sense. 
Logged

Visit my RC aircraft blog at http://electricrcaircraftguy.blogspot.com/

geo. area called Italia
Offline Offline
Full Member
***
Karma: 0
Posts: 190
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

I get "avrdude" not found when trying to run this. Have I forgotten something?

p.s.

does anyone have the source code for the USBASP firmware? I'd like to load it into Arduino IDE and just load it from there using my 2009 as ISP programmer.
Logged

Pages: 1 2 [3] 4 5 6   Go Up
Jump to: