Getting rid of the Hobby King usbasp SCK error

Greebo
Posts: 63
Joined: Sat Jun 16, 2012 11:12 am
Country: Australia
Location: NSW

Getting rid of the Hobby King usbasp SCK error

Post by Greebo »

I posted my experiences with flashing using my Arduino in another thread, so I know my Arduino works properly with eepe and companion9x.
While I was trying to make that work, I ordered a usbasp from Hobby King just in case I couldn't figure out the Arduino.

Since the Arduino is used for other things, I started using the USBASP since I had it. Everyone who has one probably knows you get the SCK error every time you use it and everyone says you can ignore it...
But what if you don't want to ignore it?

Do you have an Arduino? Then get rid of that error! 8-)
Here's what I did:

First up, load up the ArduinoISP sketch (I used the one that came with Arduino IDE v1.01)
Unplug the Arduino and connect up the relevant pins to the appropriate sockets (I used the 6 pin connector that came with the USBASP from Hobby King) :

USBASP : Arduino Uno
1 : 12 (MISO)
2 : +5V (VCC)
3 : 13 (SCK)
4 : 11 (MOSI)
5 : 10 (RST)
6 : GND (GND)
IMG_0018.JPG
Check (with a multimeter) that you have the wires connected to the right (labelled) pins on the USBASP!
Make sure the "power" jumper is still connected on the USBASP otherwise it wont get powered by the Arduino.

Finally, you need to connect the "RESET" pin on the chip on the USBASP with the RESET line on the 10 pin connector to allow it to be programmed:
IMG_0019.JPG
You may have noticed in the first image above, I just used an alligator clip to short the two solder points.

Download the latest 2009 firmware from the original web site
(see replies below about reset issues with the latest firmware)

Next, plug in the Arduino and then use avrdude (I used the one that came with eepe) to read the existing firmware to a file for safe keeping:
avrdude -p m8 -b 19200 -c avrisp -P com2 -U flash:r:usbasp.atmega8.hobbyking.hex

Finally, Flash the downloaded firmware into the USBASP:
avrdude -p m8 -b 19200 -c avrisp -P com2 -U flash:w:usbasp.atmega8.2011-05-28.hex
avrdude -p m8 -b 19200 -c avrisp -P com2 -U flash:w:usbasp.atmega8.2009-02-28.hex

In both cases, make sure the port specified (com2 in my case) is the port you used in the Arduino IDE to download the sketch to your Arduino in the first place.

DISCLAIMER: This worked for me - If you break your USBASP, I take no responsibility. I'm happy to update these instructions if something is not clear or proved to be incorrect.

EDIT: Corrections for firmware version.
Last edited by Greebo on Mon Aug 06, 2012 9:51 pm, edited 1 time in total.

Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Getting rid of the Hobby King usbasp SCK error

Post by Romolo »

do not download the latest, download 2009...
The latest has some issue with reset, it will be difficult to perform two operations in sequence.
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by rperkins »

good post. I also prefer the open source firmware on my usbasp.

the sck error with the locked firmware is because that firmware ignores the speed settings. It has an 'autospeed' function.

Back in March of this year I downloaded and compiled the 2011 version of usbasp and loaded it into my hardware. Did not have any issues sequencing multiple operations when communicating with another usbasp, nor with a 9x. Ran tests that timed 20 iterations of a firmware read at a given speed. while looping through various speeds. Did have issues performing 2 sequential operations before removing the capacitor from the reset line on the 9x. Your mileage may vary. Before removing the cap on the 9x reset line it was necessary to remove and reinsert the usbasp from the computer after every operation.

drwxr-xr-x 5 rperkins rperkins 4096 Jun 15 2011 usbasp.2011-05-28
-rw-rw-r-- 1 rperkins rperkins 531310 Mar 22 08:28 usbasp.2011-05-28.tar.gz
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by rperkins »

on another note. If you dont have an arduino, the same can be accomplished by using 2 usbasp's connected together. use one to flash the other. That is why I recommend buying 2 of the units. Well that and the quality control reputation of cheap chinese goods sometimes is lacking.
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Getting rid of the Hobby King usbasp SCK error

Post by Romolo »

rperkins wrote:good post. I also prefer the open source firmware on my usbasp.

the sck error with the locked firmware is because that firmware ignores the speed settings. It has an 'autospeed' function.

Back in March of this year I downloaded and compiled the 2011 version of usbasp and loaded it into my hardware. Did not have any issues sequencing multiple operations when communicating with another usbasp, nor with a 9x. Ran tests that timed 20 iterations of a firmware read at a given speed. while looping through various speeds. Did have issues performing 2 sequential operations before removing the capacitor from the reset line on the 9x. Your mileage may vary. Before removing the cap on the 9x reset line it was necessary to remove and reinsert the usbasp from the computer after every operation.

drwxr-xr-x 5 rperkins rperkins 4096 Jun 15 2011 usbasp.2011-05-28
-rw-rw-r-- 1 rperkins rperkins 531310 Mar 22 08:28 usbasp.2011-05-28.tar.gz
The highlighted part was happening to me and also I had issues with the gruvin9x board.
So, maybe yes without capacitor it will work, but with 2009 I do not have issues with the capacitor on the reset line.
And no I do not think is safe to remove it, it's true we expect very little noise there, but I do not remove a filtering capacitor on a reset line only because of a usbasp fw that has issues, so I will stay on 2009.

My 2 cents,

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by rperkins »

I can see your point. Curious now what is different in the usbasp code ? At least we have 2 solutions now.

Wondering, does the length of your programming cable matter when leaving the reset cap intact, and utilizing the 2009 firmware ?

Before removing the cap the cable length may have been an issue, but not afterwards. I read many people voicing concerns about programming cable length. We're talking inches, not feet.
Greebo
Posts: 63
Joined: Sat Jun 16, 2012 11:12 am
Country: Australia
Location: NSW

Re: Getting rid of the Hobby King usbasp SCK error

Post by Greebo »

I'll go and give multiple operations a try... I haven't removed any caps from my 9x and my cable from programmer to pins is probably about 10 inches.

EDIT: Confirmed - second and subsequent operations fail to connect to the target unless you unplug first. Going back to the 2009 version also fixed that.
I'll update the original post.

Thanks for the feedback!
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Getting rid of the Hobby King usbasp SCK error

Post by Romolo »

Does not depends on cable lenght:
My one is 10cm (4 inches) and my usbasp with 2011 still has the issue
2009 or 2009 patched with some fix from gruvin (for 2560) does not show the issue.
My gruvin enhanced version was posted here:

viewtopic.php?f=10&t=1308&start=30#p19090

The main fix is to force usbasp to emit always extended address, as nobody guarantee that at start up of programming (even after a reset) ATMEGA2560 is on page 0.
Greebo
Posts: 63
Joined: Sat Jun 16, 2012 11:12 am
Country: Australia
Location: NSW

Re: Getting rid of the Hobby King usbasp SCK error

Post by Greebo »

How about that.... I'd been following that bricked thread for a while but hadn't checked on it since last Friday...
Might have saved me some time figuring out what I needed to do to get mine loaded without making it inoperable!

So the only difference between the 2009 version and the gruvin fixed 2009 version is to make it work on a 2560?
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Getting rid of the Hobby King usbasp SCK error

Post by Romolo »

Yes, that's the only difference.
In the spirit of opensource I'm providing the patch.
BTW I'm using the same firmware also on usbasp used for flashing stock radios without any trouble.
Attachments
diff.txt
(1.81 KiB) Downloaded 1414 times
User avatar
michaelclyde
Posts: 21
Joined: Mon Apr 02, 2012 7:56 am
Country: -
Location: stuck in so-cal

Re: Getting rid of the Hobby King usbasp SCK error

Post by michaelclyde »

hey,
i just boughta usbasp from h/king to flash my kk2 with openaero2, am/will i have problems with it iif i try and do my other th9x or s_macks' upcoming TelemetrEZ board (it may not need flashing). so i guess this problem is inherent to all usbasp's or just h/kings, it worked fine for what i used it for... come to think of it, i didn't use it to sequentially do anything. even if it does i can re plug it right?

sorry i'm so programmer illiterate,
michael clyde
REMEMBER -
"if you don't play well with others,
you could end up playing with yourself"
Greebo
Posts: 63
Joined: Sat Jun 16, 2012 11:12 am
Country: Australia
Location: NSW

Re: Getting rid of the Hobby King usbasp SCK error

Post by Greebo »

No, it will work fine out of the box for most things. You will only have a problem with devices that specifically need to set the SCK frequency.
You'll most likely find out you needed it when it happens :)
User avatar
michaelclyde
Posts: 21
Joined: Mon Apr 02, 2012 7:56 am
Country: -
Location: stuck in so-cal

Re: Getting rid of the Hobby King usbasp SCK error

Post by michaelclyde »

so don't sweat the small sh stuff.

thanks
mc
REMEMBER -
"if you don't play well with others,
you could end up playing with yourself"
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by bertrand35 »

I flashed mine (which is not exactly the same, but an eBay one), but no luck, the flashing process went fine but after flash, it doesn't work any more:

Code: Select all

C:/Program Files/companion9x/avrdude.exe -c usbasp -p m128 -P usb -U flash:w:D:/Perso/workspace/open9x/src/open9x.hex:i
=================================================================================

avrdude.exe: error: programm enable: target doesn't answer. 1 
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.
The gprog programmer from Bryan works perfectly, so I think that my connections are good.

Bertrand.
User avatar
Kilrah
Posts: 11107
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Getting rid of the Hobby King usbasp SCK error

Post by Kilrah »

Hmm, maybe those particular Chinese guys used a different pin for RESET?
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by bertrand35 »

Romolo helped me and he found the problem: there is a resistor network on my USBASP and the pins RST, SCK, MISO and MOSI were connected to the m8 through a 100Ohm resistor. I strapped it and it was perfect. Both my USBASP and my m128 board run perfectly now, thanks Romolo!

Bertrand.
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Getting rid of the Hobby King usbasp SCK error

Post by Flaps 30 »

Sounds like my unit might be the same as yours Bertrand. The 10 pin connector MISO, MOSI,RST & SCK lines go to a resistor package (marked up as R8 on the PCB) that contains four 100 Ohm resistors.
From what I can see. The Atmega8 reset pin goes out to a hole marked J2. Was it this connection you did something with whilst programming the programmer?

Do you ground the reset pin of the chip whilst reprogramming the programmer?

What software did you use to reprogram it?
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by rperkins »

Romolo wrote:Yes, that's the only difference.
In the spirit of opensource I'm providing the patch.
BTW I'm using the same firmware also on usbasp used for flashing stock radios without any trouble.
I missed this when it was posted. Glad you found the source of the problem. I'm wondering if this patch has been sent to the usbasp upstream developer ?

Thanks
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by bertrand35 »

Flaps 30 wrote:Sounds like my unit might be the same as yours Bertrand. The 10 pin connector MISO, MOSI,RST & SCK lines go to a resistor package (marked up as R8 on the PCB) that contains four 100 Ohm resistors.
From what I can see. The Atmega8 reset pin goes out to a hole marked J2. Was it this connection you did something with whilst programming the programmer?

Do you ground the reset pin of the chip whilst reprogramming the programmer?

What software did you use to reprogram it?
Oh yes I forgot to mention it. On my USBASP I have:

1) An unneeded network of 4 resistors (it's written 101 on it, and R8 on the PCB)
=> you have to remove it and replace by 4 wires

2) A J2 jumper
=> you need to shortcut to flash the USBASP and of course remove the short to continue!

3) A 5V / 3.3V jumper
=> is useful for flashing the ATtiny on the sky9x board

I used the firmware from Romolo as he suggested, it's just perfect!

Bertrand.
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Getting rid of the Hobby King usbasp SCK error

Post by Flaps 30 »

Brilliant! Thanks Bertrand. That all makes sense.

I gather that you can use another programmer card to reprogram the other by just coupling them together with a ten pin connector cable, as if you were programming the TX.

Can you use EEPE to do the job of burning the hex file onto the target card?
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by rperkins »

Flaps 30 wrote:I gather that you can use another programmer card to reprogram the other by just coupling them together with a ten pin connector cable, as if you were programming the TX.
yea. Have to put a jumper across the appropriate place to put the target into programming mode
Can you use EEPE to do the job of burning the hex file onto the target card?
dont know. I used avrdude.

ps. I emailed Romolo's patch with a link to this discussion to Thomas Fischl, from http://www.fischl.de/usbasp/
hope that was appropriate. thanks again Romolo
bertrand35
9x Developer
Posts: 2764
Joined: Fri Dec 30, 2011 11:11 pm
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by bertrand35 »

Flaps 30 wrote:Brilliant! Thanks Bertrand. That all makes sense.

I gather that you can use another programmer card to reprogram the other by just coupling them together with a ten pin connector cable, as if you were programming the TX.

Can you use EEPE to do the job of burning the hex file onto the target card?
Yes the 2 programmers have to be connected together. The first (connected to the PC) programs the other (with J12 strapped as mentionned above).

Yes, eePe and companion9x could have this function embedded in a specific tool, but is it really needed for something you execute only one time?

Bertrand.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Getting rid of the Hobby King usbasp SCK error

Post by ShowMaster »

Is it possible for someone to write in detail and maybe pics of doing this with 2 HK programmers. Wiring and firmware steps needed. Maybe add it to the er9x wiki?
Thank you
SM


ShowMaster
Sent from my iPod touch using Tapatalk
Romolo
9x Developer
Posts: 1109
Joined: Sat Dec 31, 2011 12:11 am
Country: -
Location: Massa (MS), Tuscany, Italy

Re: Getting rid of the Hobby King usbasp SCK error

Post by Romolo »

For usbasp from hk is easy

On one usbasp do a small solder to connect two pads indicated in picture:
usbasphk.jpg
then get this firmware:
main.hex
(10.35 KiB) Downloaded 2776 times
now connect the two USBASP and attach the normal one (not the one you have prepared for upgrading) to your PC/MAC

give the following command from folder you have placed main.hex

avrdude -c usbasp -p atmega8 -P usb -U flash:w:main.hex

Detach the programmer from the PC/MAC
remove pad connection,
test the fresh programmed USBASP with your radio.
If everything works (should be) repeat the process with the other one.
User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Getting rid of the Hobby King usbasp SCK error

Post by ShowMaster »

Your explanation and pictures and FW link should make it easy. I'll give it a try. Thank you for taking the time to post it.
SM


ShowMaster
Sent from my iPod touch using Tapatalk
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Getting rid of the Hobby King usbasp SCK error

Post by jhsa »

Romolo, could you wiki that please? it's good info ;)
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Getting rid of the Hobby King usbasp SCK error

Post by Flaps 30 »

Brilliant Romolo :)

I have just flashed my chinese USB thingy. It is the same one as Bertrand has. I got a second USBASP unit with speed switching from here ----> Programmer AVR USB I didn't remove the 100 Ohm resistor network on the target Chinese unit before programming. Next step was to solder the two J2 pads together before continuing.

After linking up the two programmers. I used Companion9X to program up the old Chinese unit with the 'main'hex' file that Romolo has posted, before hitting the burn button, I added the following into the burn configuration menu of Companion9X in extra arguments '-c usbasp -p atmega8 -P usb' then selected the file to burn... When that was all finished a quick dab with the soldering iron to remove the solder link on J2 completed the operation. That's it! Thanks guys :)
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Getting rid of the Hobby King usbasp SCK error

Post by Flaps 30 »

Not sure if I should start a new thread or just add something here. The latter won out. :)

Decided to buy a couple of really cheap programmers from Ebay that was under the name of 'New USB 51 AVR ISP Programmer'

The board looks like this.
1-24 front.jpg
2-24 back.jpg
As expected they had the usual SCK error. Looking around the board revealed the places to reprogramme them, by placing a wire between the holes marked 'UP'. Once programmed, remove the wire.
100_0425 600.JPG
Helle
Posts: 577
Joined: Sat Jul 21, 2012 7:08 am
Country: -

Re: Getting rid of the Hobby King usbasp SCK error

Post by Helle »

Hy,
@flaps 30,
this is this one USBISP programmer,S51AVR ISB Programmer in a Alu case, with this software and driver

Programm is progisb.exe works not together with avrdude
look at the thread MX3 USBISB V3.00 programmer
viewtopic.php?f=10&t=2162

Helle
Attachments
ProgISP1.72.zip
(1 MiB) Downloaded 1027 times
ProgISP172 Bild.jpg
cp210xdriver.zip
(235.65 KiB) Downloaded 800 times
Atmel_S51AVR_Programmer_USERguide.pdf
(1023.37 KiB) Downloaded 1189 times
USB ISP Programmer.jpg
USB ISP Programmer.jpg (20.66 KiB) Viewed 59710 times
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Getting rid of the Hobby King usbasp SCK error

Post by Flaps 30 »

Ohh! ... How interesting. The ones I bought look the same as what you have shown us Helle, although mine didn't have the case -----> USB 51 AVR ISP Programmer

Mine worked out of the box with Companion9x in both read and write mode, apart from the sck error that was sorted by reprogramming the devices. I see no reason why (apart from the warning they give about Win7) the cased ones shouldn't work.

Post Reply

Return to “PROGRAMMERS”