Usbasploader Hack your USBasp into a standalone arduino

Turn your USBasp programmer into a standalone arduino with a small hack. This will take about 5 minutes. Once done, you will get a fully programmable MCU that will work in arduino IDE. It will have 4 digital output: Pin 10, 11, 12, 13, and 2 leds connected to A0 and A1.

1, erase your USBasp.
2, set the fuse to LFUSE: 0x1f and HFUSE: 0xc0
3, burn my modified Usbasploader firmware into your USBasap (see attachment)
4, add a reset button to your USBasp. One end of the button connected to the ground and one end connected to reset pin. (should be on one side of the 103(10K) resistor )
5, Install USBasp driver if you have not already.
6, edit your board file for atmega8 running @12mhz, maximum_size=6000
7, Short bootloader enable jumper(slow sck or PC2), Plug in your Usbasp, press the reset button, Open your IDE, pick USbasp as programmer, upload and enjoy!

How it works:
Basically a modified usbasploader firmware for the USbasp.

PS. Avoid doing anything with A2 (PC2). because it's connected to the ground. Writing high to this pin will short out the pin.

board file

juno.name=〖Juno〗
juno.upload.tool=avrdude
juno.upload.protocol=arduino
juno.bootloader.tool=avrdude
juno.bootloader.unlock_bits=0x3F
juno.bootloader.lock_bits=0x0F
juno.build.board=AVR_juno
juno.build.core=arduino
juno.build.variant=eightanaloginputs

juno.menu.cpu.atmega8-12mhz=【Atmega8 - 12mhz Ext】

juno.menu.cpu.atmega8-12mhz.upload.maximum_size=6000
juno.menu.cpu.atmega8-12mhz.upload.maximum_data_size=512
juno.menu.cpu.atmega8-12mhz.upload.speed=115200

juno.menu.cpu.atmega8-12mhz.bootloader.low_fuses=0xFF
juno.menu.cpu.atmega8-12mhz.bootloader.high_fuses=0xd9
juno.menu.cpu.atmega8-12mhz.bootloader.file=optiboot/optiboot_atmega8.hex

juno.menu.cpu.atmega8-12mhz.build.mcu=atmega8
juno.menu.cpu.atmega8-12mhz.build.f_cpu=12000000L

2 Leds blinking code

int led=A0;
int led2=A1;
int timer=500;

void setup() {

  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);  
}


void loop() {
  digitalWrite(led, HIGH);   
  digitalWrite(led2, LOW);    
  delay(timer);             
  
  digitalWrite(led, LOW); 
  digitalWrite(led2, HIGH);    
  delay(timer);   
}

USbasp_hack.zip (191 KB)

flyandance:
How it works:
Basically a modified usbasploader firmware for the USbasp.
https://www.obdev.at/products/vusb/usbasploader.html

Where is the source code that includes the modifications?

bperrybap:
Where is the source code that includes the modifications?

Here is.

Mod_source_code.zip (123 KB)

thanks for putting this up. i often use usbasp as controllers and think its use beyond regular programmer is underestimated. i usually just connect to another usbasp but also had success with digispark type setup although not as convenient because of the button push annoyance.

however for some reason i am unable to get yours to work:

  1. on target usbasp j2 shorted j3 open and fuses changed under xp with libusb_1.2.4.0 using normal usbasp. verified and no errors.

  2. Usbasp_hack_Usbasploader_Atmega8_fd_.hex flashed. 8114 uploaded, verified, and no errors. leds dim as usual.

  3. remove j2 and short j3 then replace programmer with the target usbasp. leds off now. get "usb device not recognized".

regular programming firmware and the led blink program work fine if flashed directly into the same usbasp using normal isp. any suggestions what i may be doing wrong?

i would be interested to hear of independent success using same procedure.

another question. why short j3? other objdev methods do not require this and it seems odd to delete this potential io. actually would then have 6 io for user w/o mods not 4 counting j2 bit too.

john1993:
thanks for putting this up. i often use usbasp as controllers and think its use beyond regular programmer is underestimated. i usually just connect to another usbasp but also had success with digispark type setup although not as convenient because of the button push annoyance.

however for some reason i am unable to get yours to work:

  1. on target usbasp j2 shorted j3 open and fuses changed under xp with libusb_1.2.4.0 using normal usbasp. verified and no errors.

  2. Usbasp_hack_Usbasploader_Atmega8_fd_.hex flashed. 8114 uploaded, verified, and no errors. leds dim as usual.

  3. remove j2 and short j3 then replace programmer with the target usbasp. leds off now. get "usb device not recognized".

regular programming firmware and the led blink program work fine if flashed directly into the same usbasp using normal isp. any suggestions what i may be doing wrong?

i would be interested to hear of independent success using same procedure.

another question. why short j3? other objdev methods do not require this and it seems odd to delete this potential io. actually would then have 6 io for user w/o mods not 4 counting j2 bit too.

You missed the reset button.

Here is how this setup works. There are 2 modes: 1, normal program mode; 2 boot-loader enable with virtual Usbasp mode.

1,When you powering it up, it will go to normal program mode, regardless.

2, To enter Virtual Usbasp mode, you need to shorted boot-loader enable jumper, plug it in, then press the reset button. Then the "usb device not recognized" will turn into Usbasp. Once you uploaded your code, to upload again, you also need to press the reset button again.

You can still use all the pins, but it's risk since that pin is grounded, writing a high to it will short it out. This bootloader is better than digispark. uploading is faster and easier. I also develop a board with this Usbasploader setup. see attachment.

flyandance:
You can still use all the pins, but it's risk since that pin is grounded, writing a high to it will short it out.

Then should you not reverse the sense of that and make the jumper enable USPasp mode instead?

flyandance:
You missed the reset button.

1,When you powering it up, it will go to normal program mode, regardless.

i did not get far enough to press reset after seeing that message. when plugged in it does not negotiate as a usb device but give the not recognized error regardless of j2 so thats not working.

ignoring the normal usbasp mode problem and resetting with j2 short it does work properly as virtual usbasp. select juno, upload with programmer, and led sketch runs.

so it fails to work as regular usbasp but this is not important. i think it makes less sense to have this anyway because that code goes away after first use.

so its working great as a self programmable m8 module which is very useful if there is no other programmer available. not even serial required. its a wonderful project and was just as easy to setup as digispark thanks again for a great idea.

john1993:
i did not get far enough to press reset after seeing that message. when plugged in it does not negotiate as a usb device but give the not recognized error regardless of j2 so thats not working.

ignoring the normal usbasp mode problem and resetting with j2 short it does work properly as virtual usbasp. select juno, upload with programmer, and led sketch runs.

so it fails to work as regular usbasp but this is not important. i think it makes less sense to have this anyway because that code goes away after first use.

so its working great as a self programmable m8 module which is very useful if there is no other programmer available. not even serial required. its a wonderful project and was just as easy to setup as digispark thanks again for a great idea.

So it works now? it should work as a regular usbasp too. I will be working on that. Here is the simple concept: there are 2 memory sections in avr: bootloader and main memory; We will have Usbasploader in bootloader, and there is no reason why you can't load an Usbasp program into the main memory and use it normally as a usbasp. kinda like dual boot windows and mac in a one computer, or something like arduino as ISP, but much easier to use.

The new USBasp f/w that I've been working on will force a re-enumeration by the host when it starts up.
Should the bootloader start first and enumerate as a USB device and then start the application image (USBasp f/w image) or be used to update the USBasp f/w image, the USBasp f/w image will force the host to re-enumerate correctly as a USBasp device with its usb descriptor parameters as soon as it starts up.

The official Fischl USBasp f/w will not force re-enumeration on startup as the code that was attempting to force the host to re-enumerate was improperly handling the USB signals so it would not work.

I can envision that there could be issues when using the official Fischl USBasp f/w in this environment.

The main reason I fixed this was that prior to this fix, you would have to physically unplug the device and plug it back in to get the host to re-enumerate and "talk" again, which made doing updates a bit of pain.
I'm guessing that re-enumeration issues are likely to be similar in an environment like this.

--- bill

flyandance:
there is no reason why you can't load an Usbasp program into the main memory and use it normally as a usbasp.

i can think of couple reasons why not. first what i referred to in my previous post when saying "goes away after first use". so personally dont see any point in "temporary" usbasp code. also if you used fischl source its buggy as all getout ( USBasp Update Warning - Microcontrollers - Arduino Forum ).

if i were to do any more work on this myself it would be eliminate the need to tie up j2 and use timeout method instead like digispark. imo would be very desirable having up to 8 io pins available to the user which is max possible without any hardware changes. this board needs all the help it can get there. even the difference between 4 pins and 5 pins is extremely important in mcu interfacing.

anyway it performs nicely as a self-programmable arduino and ive just placed an order for couple dozen more usbasp dedicated to this purpose. great job flyanddance.

john1993:
i can think of couple reasons why not. first what i referred to in my previous post when saying "goes away after first use". so personally dont see any point in "temporary" usbasp code. also if you used fischl source its buggy as all getout ( USBasp Update Warning - Microcontrollers - Arduino Forum ).

if i were to do any more work on this myself it would be eliminate the need to tie up j2 and use timeout method instead like digispark. imo would be very desirable having up to 8 io pins available to the user which is max possible without any hardware changes. this board needs all the help it can get there. even the difference between 4 pins and 5 pins is extremely important in mcu interfacing.

anyway it performs nicely as a self-programmable arduino and ive just placed an order for couple dozen more usbasp dedicated to this purpose. great job flyanddance.

You are a very rich guy with so many collection of Usbasp. I am so jealous now. As far as Usbasp goes, it's not perfect, but it works as a programmer. This hack is sort for fun and for testing the Usbasploader. They are both awesome software. Personally, I am a huge fan of Usbasp as well, and so I have built my own version. Here is some photos of my Usbasp.

From the Readme file...

USBasp is built with V-USB driver by OBJECTIVE DEVELOPMENT GmbH. See
"firmware/usbdrv/" for further information.

I'm confused a bit...

Yes this USBASP programmer ($1.19 from AliExpress) can be programmed w/ Arduino but with 1K SRAM, 8K flash it is 2x the SRAM of the tiny85 but with more I/O. Unfortunately, getting to that I/O means soldering wires to the breakout board or directly to the uC.

Since V-USB is used to connect to the USB PC driver, would it not make more sense to use an Atmega328 w/ 16MHz crystal and a V-USB enabled bootloader. Oh, my... that sounds just like Adafruit's Pro-Trinket!
Here is how I cloned it: Tchotchke (Pro Trinket clone) USB Programming Stick

More V-USB pix

Ray

at a buck ea i can buy a handful of usbasp for the cost of a single pro-trinket or digispark pro. even m328 boards like uno or promini cost more and all of these require either a special cable or an isp programmer unlike self-programmable plug-n-go usbasp.

none of these have standard usb connector that works for things like ready to connect hid device, virtual drive, or simple data transfer. i find this ability worth its weight in gold for getting difficult computers like windows pc or linux rpi to jump through hoops.

cheepo chinese usbasp have up to 10 io on standard connectors available without soldering. thats more than original trinket or digispark which actually cost more too.

myself and a few friends find usbasp hard to beat not just as programmer but unique controller and problem solver.

john1993:
at a buck ea i can buy a handful of usbasp for the cost of a single pro-trinket or digispark pro.
<....>
myself and a few friends find usbasp hard to beat not just as programmer but unique controller and problem solver.

OK. Makes sense @ $1.

However, have you considered the $1.25 16MHz 5V Atmega168 Mini? OR, the $1.44 5V 16MHz Atmega328 Mini?

One can easily use V-USB or modify the USBAsp bootloader to work with these just slightly more expensive boards and your compatibility is enhanced by the 16MHz clock and more memory.

I've done this by building a series of V-USB adapters for the Arduino boards... Essentially moving all the V-USB circuitry to the USB connector board and using Dupont cables to connect to the Arduino.

Just saying, it is a workable option I have used often.

Ray

IMG485_web.jpg

IMG487_web.jpg

yes, its absolutely amazing what has arrived on the scene even compared to couple years ago. and not just mcu but modules, converters, and sensors for pennies.

i follow your website constantly wondering what you are going to come up with next. the stm32 stuff too, specially the oscope and followup on rogers site. that board from flyanddance is quite a work of art but i must say im personally inclined toward the "ugly is the new beautiful" philosophy.

since its diy usbasp show and tell day i will get up in front of the class and put this out. believe it or not total cost 45 cents all up. that cable does double duty for programming and also being programmed. actually triple duty because also serial io for debugging or for my one wire bootloader. theres an led hiding between pins 19-20 but cant see til it lights up.

im not sure if you can see but the xtl is socketed for quick swap from 32khz to 35mhz. and i can pop an m328 or tiny28 in the mcu socket for yucks. being famous for shortcuts weee doe need no steeeenkin' caps on the xtl or resistors/zeners on the usb.

IMG_0100.JPG

some of my buddies suffer from "solder-phobia" so there is still a place for the ebay-ali usbasp cheepies. even me when im too lazy to put in the couple minutes it takes on the diy version.

john1993:
IMG_0100.JPG

Looks like the "male" version of my Flatduino:

i follow your website constantly wondering what you are going to come up with next. the stm32 stuff too,

Actually, I've been wondering the same. I have become fascinated with the cheap price of the ESP8266; The NodeMCU at under $4. The high-current of the RF stage puts a demand on batteries, but I have started playing with the device with the RF disabled in s/w....
I have not written any projects to publish, but I think I will soon. Having 3M flash available to SPIFFS is too enticing.

Ray

:grin: I prefer making my own board. Much more expensive, but worth it.

flyandance:
:grin: I prefer making my own board. Much more expensive, but worth it.

Nice board, but I jump around too much with imported "cheap" boards to make a run of my own designs... I'm not opposed to stringing together a DC-DC bulk, a board, a sensor or two, and a display.

I prototype everything; sometime with a software project, this is all that is required. Othertimes, a project requires an enclosure, I love wooden cigar boxes (reminds me of my youth as these were available just for the asking.) These days, small wooden boxes can be purchases from Hobby Lobby for a small sum.

Ray