Usbasp Cloner

Projects that are not for RC, but are cool and worthy of development.
Post Reply
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Usbasp Cloner

Post by rperkins »

I wanted a faster way to reprogram a Usbasp device, and the ability to do it without a computer. This Arduino sketch is a derived work of Nick Gammon's Atmega_Board_Programmer https://github.com/nickgammon/arduino_s ... Programmer

Download link
http://www.randyperkins.com/images/usbasp_cloner.zip

pros
  1. GPL license
  2. Fits on a atmega8
  3. Room for about 4k of code to send to target. The cloning code uses about 4K. Will work on larger AVR's if more room is needed
  4. reprograms the target as soon as it is plugged in. Accomplishes this by monitoring the reset (SS) line
  5. verifies the programming. Writes fuses
  6. has visual and audio pass/fall indicators. ( you have to add the piezo buzzer )
  7. compile time option of various flavors of usbasp firmware
  8. has a script to massage other code into the appropriate format for cloning
cons
  1. 2011 usbasp code barely fits, had to remove some of the fancy audio feedback tones. Still get a pass/fail tone
  2. needs a pull down resistor added to the SS line ( the reset line to the target )
  3. currently the piezo is coded to the D- line of the usb. makes it easy to add but if you use usb power from a computer you hear a little buzzing at first as the computer is attempting to communicate with the cloner ( which doesnt have a usb implementation in it )
A pic would just show a Usbasp device with a pulldown resistor and a piezo buzzer soldered to it. If there's an interest I will do it. The main thing this accomplishes for me is consistent code going on the target. Dont have to fiddle with the keyboard to run the avrdude command. They program in about 2 seconds and then on to the next one.

I have a boards.txt entry for the betemcu.cn programmer to utilize it in the arduino environment. Maybe I should add that here ?

JustinTime
Posts: 140
Joined: Tue Jan 29, 2013 4:12 am
Country: -
Location: SoCal

Re: Usbasp Cloner

Post by JustinTime »

I hope it's not too late, I haven't been on the board for a few days, but I'm interested in more info!
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Usbasp Cloner

Post by rperkins »

na, not too late. Let me know if you have any other questions.
I need some better cabling but currently sales arent high enough to worry about it. Had plans to run it off of a lipo but this is working fine for now.

Usbasp cloner - Load usbasp firmware on a bunch of targets. No computer needed although I am using USB power from a computer. the firmware is locally located in the programmer.
The third unit programmed failed due to removing the programming jumper during programming. Notice the failure tone and LED indicators.
[BBvideo 425,350]http://www.youtube.com/watch?v=zgJUt5ZaeFg[/BBvideo]

showing attachment of piezo buzzer. Could be moved to another pin in the code.
20130415_121716.jpg
showing 10k pulldown resistor on reset line to target. Code uses this line as an input to detect a target, then switches to an output to program the target
20130415_121747.jpg
showing the little jumper tool I made out of the innards of a female arduino header soldered to anything with some mass, then surrounded poymorph. by that plastic stuff that you rework with hot water. cant think of the name of it right now but sparkfun sells it
https://www.sparkfun.com/products/10950
20130321_133323.jpg
This is the arduino boards.txt entry for the betemcu.cn usbasp to use it as a development board in the arduino environment. Note that there is no bootloader on the unit nor auto reset. to update the device you need to add the programming jumper and upload using the 'upload using programmer' option in arduino. Yes you need another usbasp device to program the target. Double check the fuses to verify that is what you want for your project. Also note the max upload size is utilized so if you decide to use a bootloader in your application, adjust accordingly

Code: Select all

##############################################################


betemcu.name=betemcu.cn usbasp  w/ ATmega8 at 12MHz
betemcu.upload.protocol=usbasp
betemcu.upload.maximum_size=8192
betemcu.upload.speed=19200
betemcu.upload.disable_flushing=true
betemcu.bootloader.low_fuses=0xBF
betemcu.bootloader.high_fuses=0xCF
#betemcu.bootloader.path=
#betemcu.bootloader.file=
betemcu.bootloader.unlock_bits=0x3F
betemcu.bootloader.lock_bits=0x0F
betemcu.build.mcu=atmega8
betemcu.build.f_cpu=12000000L
betemcu.build.core=arduino
betemcu.build.variant=standard


##############################################################
Last edited by rperkins on Tue Apr 16, 2013 9:03 pm, edited 2 times in total.
JustinTime
Posts: 140
Joined: Tue Jan 29, 2013 4:12 am
Country: -
Location: SoCal

Re: Usbasp Cloner

Post by JustinTime »

Let's see if I get it right. I load the file in your usbasp_cloner.zip into the 'main' programmer with Arduino 1.x. I then solder a buzzer (can I use the one I took out of the transmitter?) and a resistor as shown in the pics above. What do I do then with the board.txt?
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Usbasp Cloner

Post by rperkins »

The boards.txt listed here is an addition to your arduino configuration. In the arduino IDE you choose which 'board' you are working with . IE: uno, mega , promini, etc. When you insert the above text into your boards.txt file you will see another 'board' listed as ' betemcu.cn usbasp w/ ATmega8 at 12MHz'. I needed to use the entire flash memory for programming and none for a bootloader was the main reason for a custom entry. Additionally it has the correct clock speeds if you write a timing dependant sketch.

Last paragraph here covers boards.txt
http://arduino.cc/en/Hacking/Preferences

So the boards.txt here is needed to allow you to upload the sketch to the betemcu.cn programmer.

Are you considering reflashing a bunch of usbasp's, or some other code? It's documented , but a little convoluted to get the 'targets' code into the proper format that the sketch requires. The sketch stores the 'target' code in 'program memory', not ram. If you need to store larger code, use a uno or whatever is required.

This sketch would be useful if for say you have a bunch of esc's,imu's, etc that you need (re)programmed in a consistent manner.

Yes i imagine the buzzer from the tx would work. I use this
https://www.sparkfun.com/products/7950

JustinTime
Posts: 140
Joined: Tue Jan 29, 2013 4:12 am
Country: -
Location: SoCal

Re: Usbasp Cloner

Post by JustinTime »

I have five programmers and one mcu128 that doesn't want to be programmed. :D I'm trying to cover all the bases, including that I programmed the programmer wrong or that the grand mother of the president has constipation or what ever causes the chip not to be programmed. If in the process I convert five programmer to work good, boonnuusss!!! ;)

Post Reply

Return to “Other Electronic Projects”