******************************************** newer update *****************************************
thanks again for all the hard work put in from those who enhanced the firmware. unfortunately myself and few others on this end depend on tpi protocol which seems to be broken in the new versions. so ive attached to 1st post an older rev which still works. this one does seem to cover most of the issues we deal with on a daily basis. file is usbasp11.hex.
************************************************ older update *******************************************
edit: it looks like falling for that harmless avrdude warning message and upgrading usbasp with official/fischl firmware causes more trouble than suspected. since posting an avrdude example flashing fischl 2011 file ive been contacted by more than one individual claiming the programmer developed problems. wont program m2560 or raw (1mhz) chips correctly anymore.
imo its generally better to leave well enough alone and use stock chinese usbasp firmware. any problems are probably due to wiring or other issues. however if for whatever reason it does become desirable a few files are now attached at the end of this post that might come in handy.
"chinese1.hex" is copied from a typical ebay usbasp as discussed in Can't Update The Firmware On My USBasp Atmega8 Using Arduino - Microcontrollers - Arduino Forum. like o'fischl firmware not optimum for some mega2560 setups. however unlike o'fischl it programs raw chips ok so good choice for most arduino users.
"usbasp-v1.5.hex" is a version modified from fischl 1.4 by 9x guru gruvin and brought to us by petervh to fix the mega2560 bug described at The usbasp and atmega2560 mystery… | PeterVH. like original fischl wont program 1mhz chips by default. however it does allow -B option which comes in handy for ultra low clock speeds (ie 32khz) and works for all m2560.
"flaw2560.hex" is an m2560 program originally written by me to check ability to write to its own flash but i found it can double as test for usbasp >128k bug. its much faster and easier than flashing a bootloader and trying sketches. modify the avrdude line below to upload it. 3 blocks printed out at 57kbps. if last block all ff then it failed to flash correctly.
"usbasp-v1.06-alpha-2016-04-17-atmega8.hex" from petervh/bperrybap solves all these issues. myself and friends been using it for couple months now. big improvement. more info and other versions: GitHub - bperrybap/usbasp at 1.06-alpha.
hopefully these files will be of use to somebody here too.
************************************************ original post *******************************************
a recent discussion in another thread prompted some offline questions regarding currently available usbasp dongles. last few years quite a large number have passed through my hands due to business and academic involvements so it seemed like a good idea to share some experiences here. lets start with a couple links to units that are popular on ebay atm:
both available for a dollar or two free shipping but there are some slight differences. most important i think is that the first (LC 2.0 aka blue) while a bit cheaper, suffer from a potentially fatal design flaw. there are no caps on the regulator. sometimes you get away with this on n-pass types like classic 7805 but LDO have a tendency to oscillate without at least one on the output. out of a dozen or so sent to me recently for testing 3 failed on a bare m8 board. usually fixed by simply tacking on 1mfd ceramic cap between lm1117 pins 1-2 as shown in the photo.
the other type (baite aka black) has no problem there. it also has the advantage of 3v-5v switch instead of jumpers used on the blue one. its not shown in the listings but units received lately did actually have that as you can probably just make out in my photo. another nice thing the cable is about 10x longer. costing only half dollar or so more than the blue its highly recommended.
all units purchased last couple years came with firmware which appears to be a modified version of older fischl source. it has that annoying but generally harmless warning to upgrade. beginners sometimes incorrectly interpret this as an error and feel obligated to attempt reflash. imo this often causes more problems than it solves. popular belief that these are incapable of programming new chips in my experience has proven unfounded.
however there are a few valid reasons to justify reprogramming. for example using very slow clock (ie 32khz xtl or 128khz internal osc) is much easier with the -B option but requires updating the firmware. or as the case with me and a few locals, using the usbasp as a micro-controller instead of as a programmer. the built in usb interface can be quite handy for some applications and a great bargain for a buck and change. half the price of pro-mini which does not have usb.
so heres a quick description of the easy method we use to re-program these. best is with another usbasp connected end-to-end using stock cable as seen in my pic. j2 must be shorted on the destination unit (removed afterwards in order to run). for example to reflash with a recent fix heres the avrdude command line:
avrdude -pm8 -cusbasp -Uflash:w:usbasp-v1.06-alpha-2016-04-17-atmega8.hex
its as simple as that. both types shown in photo with programmer on the left and target on the right. aside from having spares for backup this is a major reason to buy at least 2 or more units. considering they only cost a dollar or two and the long ship time from china its foolish to order just one.
its also possible to use another type of programmer like mkII or arduino-as-isp but leads to hardware and software complications so i prefer the easy path.
below is pinout for most usbasp. older baite/black versions had gnd/gnd on 4 & 6 instead of tx/rx. this has caused considerable trouble in some cases so best not to use those two pins unless there is need for serial i/o which is rare for most users.
mosi 1o v
nc oo tx(was g)
res oo rx(was g)
sck oo g
miso oo g
personally i prefer this to the 6 pin version on my target pcbs too. i do use serial signals a lot and the nc pin serves as polarizing key to prevent plugging in wrong. not much more board space yet significantly safer and more flexible than the 6 pin. no wacky adapters required either.
chinese1.hex.txt (9.58 KB)
usbasp-v1.5.hex.txt (12.9 KB)
flaw2560.hex.txt (731 Bytes)
usbasp-v1.06-alpha-2016-04-17-atmega8.hex.txt (12.9 KB)
USBASP11.HEX.txt (12.9 KB)