Jonathan Thomson's web journal

Project Ouroboros — Reflashing a betemcu USBasp Programmer August 18, 2011

Filed under: Electronics — jethomson @ 11:40 pm

Introduction
USBasp is a free, open source firmware and reference design for implementing a USB AVR programmer. It uses simple circuitry and an ATmega8 or ATmega*8 for interfacing with the USB host. A variety of inexpensive boards ($6 US) based on the USBasp project can be purchased from many eBay sellers. Re-programming one of these boards can often be an effective solution for a one-off project where the cost of a full development board or the time consumed designing and assembling a custom board is prohibitive. They can even be made to work with Arduino. This article focuses on the betemcu.cn board pictured here. Note that there are at least two versions of this board.

 

Terminology
V-USB — a firmware-only implementation of a low-speed USB device for Atmel AVR microcontrollers.
in-circuit programmer — a device for burning code and changing fuse settings on a microcontroller which remains in its application circuit.
USBasp – a USB in-circuit programmer for Atmel AVR microcontrollers that utilizes V-USB.
boot loader — a bit of firmware capable of burning code onto the same microcontroller on which it resides. A boot loader allows new code to be uploaded to a microcontroller without an external programmer.
USBaspLoader – a USB boot loader that follows the USBasp protocol.

It’s possible to erase the USBasp firmware and load a new program onto the betemcu.cn board via the 10 pin header. First insert a jumper wire into the two holes circled in yellow in the picture above. Doing this connects RST on the 10 pin header to PC6 (RESET). Now you can use a second programmer to burn the code. However if you put USBaspLoader onto the betemcu.cn board you can use AVRDUDE or Arduino to upload programs directly over USB without having to use an external programmer. Once you have the USBaspLoader on the board there is still enough room left to re-upload the USBasp firmware so that the betemcu.cn board can function as an external programmer again. I call this Project Ouroboros because it’s a play on the word asp and seeming recursiveness of using USBaspLoader to put USBasp onto a USBasp programmer.

 

Getting started
First you’ll need a betemcu.cn USBasp programmer (hereafter betemcu board) and a second, external programmer (hereafter primary programmer) capable of programming AVR microcontrollers over SPI. Next you should test out your betemcu board to make sure it’s not defective. Before you load new code onto your betemcu board you should use the primary programmer and AVRDUDE to save the betemcu board’s factory installed firmware to your computer and discover its original fuse settings. Doing this will allow you test whether the device is still functional by attempting to restore it to a known good state by writing back the original firmware and fuse settings. The following command will save the betemcu board’s firmware and display its fuse settings. The -c programmer-id option is the ID of the primary programmer.


avrdude -p atmega8 -c programmer-id -v -U flash:r:betemcu_factory_firmware.hex

 

Fuse settings for burning code to the betemcu board with an external programmer
If you are unfamiliar with microcontroller configuration fuses, then please visit the relevant articles in the Links section to learn more about them. You should also use a fuse calculator to double check fuse settings before applying them. The original settings for my betemcu board were hfuse = 0xD9 and lfuse = 0xFF but these leave CKOPT unprogrammed which should be set for crystals faster than 8 MHz. The makefile for USBasp uses hfuse = 0xC9 and lfuse = 0xEF but these settings don’t work because the start-up delay isn’t long enough, in fact they (recoverably) brick the betemcu board. Setting the fuses to hfuse = 0xC9 and lfuse = 0xBF sets a proper start-up delay and enables CKOPT. These also set a brown-out detection level of 2.7 V which is necessary if you want to use the onboard 3.3 V regulator for power. Here’s an example hex file that blinks the LEDs on a betemcu board. (mirror)


high fuse: 0xC9
low fuse: 0xBF


avrdude -p atmega8 -c programmer-id -U hfuse:w:0xC9:m -U lfuse:w:0xBF:m
avrdude -p atmega8 -c programmer-id -U lock:w:0x3F:m
avrdude -p atmega8 -c programmer-id -v -U flash:w:betemcu_blink.cpp.hex

 

To restore the boot loader:

avrdude -p atmega8 -c programmer-id -v -U flash:w:betemcu_factory_firmware.hex

 

If you’ve downloaded the USBasp package, you can also restore the boot loader with a precompiled hex file:

avrdude -p atmega8 -c programmer-id -v -U flash:w:usbasp.atmega8.2011-05-28.hex

 

Modifications required to run USBaspLoader on the betemcu board
The unmodified version of USBaspLoader connects PD2 and PD4 to the USB data plus and data minus lines. However the betemcu board connects PB1 and PD2 to USB data plus and PB0 to USB data minus. Therefore the USBaspLoader code needs to be changed to use the same pins. Here’s a snippet of bootloaderconfig.h with the changes already made.


#define USB_CFG_IOPORTNAME B
/* This is the port where the USB bus is connected. When you configure it to
* "B", the registers PORTB, PINB and DDRB will be used.
*/
#define USB_CFG_DMINUS_BIT 0
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
* This may be any bit in the port.
*/
#define USB_CFG_DPLUS_BIT 1
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
* This may be any bit in the port. Please note that D+ must also be connected
* to interrupt pin INT0!
*/

Vanilla USBaspLoader is set up so that it will only enter self-programming mode (i.e. listen for a program being uploaded and write it to the flash) if PD7 is held low after pulling the reset pin low (i.e. an external reset) occurs. Therefore you will have to make a couple of modifications to the betemcu board. First you’ll want to add a normally open pushbutton connected to the reset pin and ground for producing an external reset. Soldering the pushbutton connection at the reset pin’s pull-up resistor is easier than soldering it directly to the pin.

 

For the second modification you’ll have to determine how you want to signal the boot loader to wait for a program. The typical method is to use a jumper to connect PD7 to ground. The NC (not connected) pin of the 10 pin header is conveniently located 0.1″ from one of the header’s ground pins so running a mod wire from PD7 to NC is a simple way to add a jumper header. However, if you plan on interfacing the betemcu board with another circuit through the 10 pin header by using a 10 pin IDC you will want to add the jumper header somewhere else on the board because of the difficulty of inserting and removing the 10 pin IDC while the USB connector is plugged in. Using a pushbutton connected to PD7 and ground instead of a jumper is also an option, but you’ll have to keep the pushbutton pressed until AVRDUDE has finished.

Here’s a picture of my modified board. At first I was using a jumper to connect PC2 (orange wire to NC) to ground, but later I decided to add a second pushbutton to signal the boot loader to wait for a program to be uploaded. The brown and blue wires are for I2C and not a necessary modification.

 

The pin used to signal the boot loader can be easily changed by modifying bootloaderconfig.h. If you want to use a different pin make certain it’s not already being used for another function by consulting USBasp schematic and by carefully examining the betemcu board. Keep in mind that pins at the corners of the ATmega8’s package are easier to solder to.

Compiling a new hex file from the USBaspLoader source also requires a few changes to the Makefile. I’ve created a package of the vanilla version of USBaspLoader preconfigured to work with the betemcu board. I’ve also included a pre-compiled hex in case you have difficulty compiling. Here’s a link to the preconfigured vanilla USBaspLoader package. (mirror)

 

Alternate version of USBaspLoader
I wasn’t happy with using a jumper (or pressing and holding a pushbutton) to signal the boot loader to enter self-programming mode (SPM). So I’ve made some changes to the vanilla version and packaged them as an alternate version of USBaspLoader. The alternate version allows you to enter and stay in self-programming mode by pressing and releasing a pushbutton, which is a more typical method used by other USB development boards with microcontrollers that have a HWB pin. I’ve also added an option that compiles the boot loader so that it always enters SPM after every reset and uses a timeout to exit the boot loader, which makes adding a jumper (or a second pushbutton) unnecessary. This is the method that should be most familiar to Arduino users. For the betemcu board I made a few more modifications to utilize the board’s LEDs. Click here to download the alternate version of USBaspLoader configured for the betemcu board. (mirror) Here’s a sample of some of the changes I made:


#define TIMEOUT_ENABLED 1
/* If TIMEOUT_ENABLED is defined to 1 then the boot loader will always load
* and stay active until the programmer closes the connection or the time
* out period has elapsed. Since the boot loader always loads there is no
* need for a jumper on the bootLoaderCondition() pin. Costs ~108 bytes.
*/
#define TIMEOUT_DURATION 5
/* The number of seconds the boot loader waits before exiting if no activity
* has occurred during the timeout interval. If TIMEOUT_ENABLED is defined
* to 0 this define will be ignored. Maximum value is 255 seconds.
*/
#define USING_PUSHBUTTON 1
/* If USING_PUSHBUTTON is defined to 1, then a press and release of a
* pushbutton on the bootLoaderCondition() pin can be used to signal that
* you wish to enter the boot loader. If USING_PUSHBUTTON is defined to 0,
* then you must use a jumper or the pushbutton must be pressed and held
* for the duration of the programming (failing to do so will result in
* the boot loader exiting prematurely).
*/

 

Fuse settings for burning USBaspLoader to the betemcu board with an external programmer
The USBaspLoader hex file for an ATmega8 at 12 MHz is around 1900 bytes so the 2 kB boot loader section is required. After flashing a boot loader, the proper lock bits should be set so that the boot loader isn’t overwritten when you use it to upload a program. These fuses set a boot flash section size of 1024 words (2048 bytes) and a start-up delay of 64 ms.


high fuse: 0xC8
low fuse: 0xBF
lock bits (unlock): 0x3F (AVRDUDE)
lock bits (lock): 0x0F (AVRDUDE)

lock bits (unlock): 0xFF (AVR studio)
lock bits (lock): 0xCF (AVR studio)


avrdude -p atmega8 -c programmer-id -U hfuse:w:0xC8:m -U lfuse:w:0xBF:m
avrdude -p atmega8 -c programmer-id -v -U flash:w:alternate_USBaspLoader_betemcu_pushbutton.hex
avrdude -p atmega8 -c programmer-id -U lock:w:0x0F:m

 

If you don’t want to add a SPM jumper or button, you can use the timeout boot loader.

avrdude -p atmega8 -c programmer-id -U hfuse:w:0xC8:m -U lfuse:w:0xBF:m
avrdude -p atmega8 -c programmer-id -v -U flash:w:alternate_USBaspLoader_betemcu_timeout.hex
avrdude -p atmega8 -c programmer-id -U lock:w:0x0F:m

 

Flashing a program with USBaspLoader
Now that you have USBaspLoader on your betemcu board you can flash new programs to it directly over USB. Here’s a link to a program from the V-USB project that emulates a mouse. (mirror) To instruct your board to enter self-programming mode, start by pressing and holding the program button, next press and release the reset button, then release the program button. The green LED should turn on indicating the board is ready for a program upload. Upload the hex file using the following command. If the upload is successful you should see the mouse cursor move in a circle.


avrdude -p atmega8 -c usbasp -v -U flash:w:vusb_mouse_example.hex

 

You can also upload the USBasp firmware onto the board to restore its ability to program other AVR microcontrollers.


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

 

Arduino
With USBaspLoader on the board it is now compatible with the Arduino programming environment. You must add some entries to boards.txt to be able to upload a sketch within the Arduino IDE. Follow this link for an explanation of the variables used in boards.txt. Put the following at the top of boards.txt:


##############################################################
usbasploader_board.name=USBaspLoader w/ ATmega8 at 12MHz
usbasploader_board.upload.protocol=usbasp
usbasploader_board.upload.maximum_size=6144
usbasploader_board.upload.speed=115200
usbasploader_board.upload.disable_flushing=true
usbasploader_board.bootloader.low_fuses=0xBF
usbasploader_board.bootloader.high_fuses=0xC8
#usbasploader_board.bootloader.path=
#usbasploader_board.bootloader.file=
usbasploader_board.bootloader.unlock_bits=0x3F
usbasploader_board.bootloader.lock_bits=0x0F
usbasploader_board.build.mcu=atmega8
usbasploader_board.build.f_cpu=12000000L
usbasploader_board.build.core=arduino

(Update: I didn’t have to but you may also need to add a few lines to programmers.txt and one more line to boards.txt to get things working. See John Bäckstrand’s comments below.)

Then under Tools->Board select "USBaspLoader w/ ATmega8 at 12MHz". It is normal to get this message: "avrdude: warning: cannot set sck period. please check for usbasp firmware update." Note that you’ll need to connect a USB to serial adapter to RX and TX if you want to send data over the UART (i.e. Serial.print()). Also note that the ATmega8 is missing some of the features the ATmega*8 series of chips have. For example, the ATmega8 doesn’t have PWM capability on Timer0. Therefore, this board won’t work with some Arduino sketches.

 

You can also upload the sketch from the command line with the following command. Notice that you don’t need to set any fuses, in fact the boot loader is incapable of changing fuses.


avrdude -p atmega8 -c usbasp -v -U flash:w:betemcu_blink.cpp.hex

 

Mischief
Here are a couple of source packages of concentrated evil.
haunted-usb-1.1-atmega8.zip (mirror)– This is a modified version of the firmware used in the Haunted USB cable. It was changed slightly so that it works on the ATmega8. For some reason it doesn’t work in X windows.
jack.zip (mirror)– Jack prints out “All work and no play makes Jack a dull boy.” 13 times while randomly pressing space and backspace. It is based on the USB Business Card firmware.

 

Links
AVR Fuses HOWTO Guide
LadyAda’s AVR Tutorial — Fuses
A very helpful fuse calculator
If you’d like a full V-USB development board check out USnooBie.

 

57 Responses to “Project Ouroboros — Reflashing a betemcu USBasp Programmer”

  1. [...] a betemcu USBasp Programmer – [Link] Tags: Arduino, USB, USBasp, USBaspLoader Filed in Mcu | 1 views No Comments [...]

  2. [...] build he’s been working on that turns an inexpensive AVR programmer into a development board. The build is based on the very affordable USBasp programmer that’s based on an ATmega8. With hundreds [...]

  3. Alessandro Ancillotti Says:

    So basically you need two of these things so with one you can re-program the other?

    • jethomson Says:

      Yes, you need a second programmer to re-flash the USBasp programmer. I’ve used a buspirate and a second USBasp programmer to do that. However, once you have USBaspLoader on the board you can put new programs (including the USBasp firmware) on it directly over USB without a second programmer. So you could just borrow the second programmer temporarily; however I like to have two: one for 3.3V and one for 5V.

  4. The link to the timeout-version of the bootloader
    points to the same file: http://jthomson.towhee.org/project_ouroboros/vanilla_USBaspLoader.2010-07-27_configured_for_betemcu.zip

    Did I understand it correctly that neither pin nor pushbutton is needed with this one? Except, I assume, for the first flashing since its still running the factiry firmware then?

  5. peter Says:

    Hello!

    Great work, but links to firmwares are not working (as well as other links on this page).

    Can you do something about this, please? :-)

    Best regards,
    peter

  6. Karl Says:

    Jonathan,

    really nice work!
    I’m also playing with this cheap USBASP (and others) – I like to (ab)use stuff for other purposes than originally designed.

    I’d like to have a look at your files as well, but the links/server doesn’t work (again).

    BTW: another nice thing to (ab)use is this: http://www.jyetech.com/Products/CapMeter/e060.php
    Uses ATmega48 (so all *8 fit on the Board) and it sells as a Kit around $10

    Rgds
    – Karl

  7. beastmaster Says:

    I’m running avrdude-5.11-Patch7610-win32 with a DASA serial programmer (from adafruit) on a Windows 7 machine. I had to make a couple of minor changes to the commands to get things going.

    backup flash. intel hex format (:i at the end) otherwise it fails writing the file:
    avrdude -p atmega8 -c dasa -P com1 -v -U flash:r:betemcu_factory_firmware.hex:i

    set fuses (high 0xC9, low 0xFF). have to -F (force), otherwise fails:
    avrdude -p atmega8 -c dasa -P com1 -F -U hfuse:w:0xC9:m -U lfuse:w:0xFF:m

    it looks like the links you have to your hex files are broken. any chance you could check on this?

    • jethomson Says:

      Well for me, avrdude auto-detects the file format, but it is probably best to be explicit and add the :i. Avrdude also automatically finds what port the programmer is on sometimes. Honestly, I’m not even sure what to put as the port for a usbasp programmer; avrdude just finds it. I think you might be having to use -F option because you have the lock bits set. I’m sorry the hex file links are down. They are hosted on a site owned by my friend. I can’t bring them back up right now. I think I’m just going to move everything to github.

      • jethomson Says:

        I just mirrored each of the files.

      • beastmaster Says:

        Thanks for the mirror.

        As it turns out, I was getting all sorts of verification errors trying to program the betemcu board with my DASA programmer in Windows 7. I’m getting better results using Ubuntu and running avrdude commands through the terminal. Go figure.

    • Slack Says:

      I was having this same problem with writing the file using avrdude version 5.11-Patch#7610 under Win 7 & XP Using the “:i” solved my issue also.

  8. mrx23dot Says:

    I don’t understand how can this programmer use its HW SPI if I
    connect Mega8’s MOSI to target’s MOSI? both pins are for transmitting.

    A valid connection would be:
    MOSI – MISO
    MISO – MOSI
    SCK – SCK

    Anyone noticed this?

    • jethomson Says:

      You should read more about SPI. SPI uses a master/slave mode of communication. The Master Output pin connects to the Slave Input pin. So you connect MOSI to MOSI. As a side note, if I recall correctly, the programmer’s SS pin is connected to the header pin that has the silkscreen label RESET. Jumpering J2 connects the programmer’s actual reset pin to the pin labelled RESET allowing it to become a slave.

  9. cptJackH Says:

    Can anyone share original betemcu factory firmware? Thanks in advance!

  10. mrx23dot Says:

    Do you also get this error while trying to program anything with Khazama (using this ebay programmer)?
    Error setting USBasp ISP Clock… it’s very annoying. How can I get rid of this?
    I can program with it, but still..

    Thanks,

    • jethomson Says:

      The USBasp firmware doesn’t support setting SCK (aka ISP clock) through software. The board uses a jumper for selecting a different SCK. You could probably figure out a way to disable that error message, but since it doesn’t indicate a real problem I just ignore it.

  11. segu Says:

    When you say ARDUINO IDE is it valid for the new ARDUINO 1.0 IDE? if I do the same modifications it will work with the arduino 1.0 version?
    Thank you

  12. mrx23dot Says:

    Is there an STK500 firmware adaption for the USBASP?

    This would be compatible with AVRstudio, and it requires only COM (virtual COM), so software USB could be used.

    One implementation with M8 & FT232:
    AvrUsb500v2

    http://tuxgraphics.org/electronics/200705/article07052.shtml

    • jethomson Says:

      I think AVR-Doper might be what you are looking for. The webpage says “AVR-Doper is an STK500 compatible In-System Programmer” and “Firmware can be compiled to run on metaboard hardware and USBasp hardware.” I’ve never tried it though. Please report back with your results.

      http://www.obdev.at/products/vusb/avrdoper.html

      • ajd4096 Says:

        I can confirm the usbasp runs AVR-Doper just fine; and the HID mode works without needing any driver on windows. (Yay!)

        To use an AVR-Doper from the IDE you need the following patch:

        diff –git a/app/src/processing/app/debug/AvrdudeUploader.java b/app/src/processing/app/debug/AvrdudeUploader.java
        index 408a9a6..98129e0 100755
        — a/app/src/processing/app/debug/AvrdudeUploader.java
        +++ b/app/src/processing/app/debug/AvrdudeUploader.java
        @@ -114,6 +114,8 @@ public class AvrdudeUploader extends Uploader {
        if (programmerPreferences.get(“speed”) != null) {
        params.add(“-b” + Integer.parseInt(programmerPreferences.get(“speed”)));
        }
        + } else if (“avrdoper”.equals(programmerPreferences.get(“communication”))) {
        + params.add(“-Pavrdoper”);
        }
        // XXX: add support for specifying the port address for parallel
        // programmers, although avrdude has a default that works in most cases.
        diff –git a/hardware/arduino/programmers.txt b/hardware/arduino/programmers.txt
        index c34b88c..f2bdba3 100644
        — a/hardware/arduino/programmers.txt
        +++ b/hardware/arduino/programmers.txt
        @@ -24,3 +24,8 @@ arduinoisp.name=Arduino as ISP
        arduinoisp.communication=serial
        arduinoisp.protocol=stk500v1
        arduinoisp.speed=19200
        +
        +# AVR-Doper using HID
        +avrdoper.name=AVR-Doper
        +avrdoper.communication=avrdoper
        +avrdoper.protocol=stk500v2

  13. mrx23dot Says:

    I have flashed “alternate_USBaspLoader_betemcu_timeout.hex” with the correct fuses.
    But the bootloader only starts after I reset the MCU (with rst pin). I doesn’t start automatically after I connect to the USB port, is this normal?
    Thanks,

    • Ggaljoen Says:

      Hello Wagner,
      Mine does the same as yours, only after contecting RST and GND (harware reset) the bootloader gets activated.
      Can you share what other bootloader is working?
      Thanks, Ggaljoen

      • Slack Says:

        Ggaljoen,

        I was having the same problem. I was expecting to go into bootloader mode immediately after plugging it in and then timeout and execute whatever was in flash. I could not get my betemcu recognized until I saw your post. Thanks!

        I was able to load (via programmer) several of the exampled and get them working, but could not get my Win 7 & XP machines to recognize the betemcu as an USBASP. I also tried loading my original firmware and could not get that to work. Though, I never tried it in the first place. I was so excited to try the new bootloader, that I immediately copied the flash and attempted to load the new bootloader.

  14. cptJackH Says:

    Ok, I’ve got another one from eBay and I’ve found that that Chinese firmware locked using fuse bits lb1 and lb2. So when I thought I’ve made a backup – it was a garbage. So be aware of that.

  15. Wagne Says:

    Hello and thank you. I am playing with USBasp hardware and firmware for weeks now, and having half a dozen units, including some I assembled in jumperboards, changing pins, tweeking codes, etc, and working with AVRs for many years, I could say I understand a little about it.

    Trying to install bootloader in one betemcu.cn miniprog unit (I receive 3 today from China).

    I tried your bootloader, with jumper (defined at PortD.7), with timeout, etc. For some reason it doesn’t work. Followed exactly your instructions for fuses, etc.

    Used Khazama and AVRDude to erase the AVR, then flash the bootloader, using a second USBasp as the programmer, jumper on yellow (connecting ISP10(5) to AtMega8-PC67(reset), everything is fine. When flashing via Khazama, and before lock bits of the boot area, I could even read all back and verify programming. Everything is nice. Installed a switch from pin PD7 to Gnd, no problem on that, checked continuity of the switch from Gnd to PD7, checked logic level on PD7 when pressing switch, fine.

    Used your bootloader hex, both, switch and timeout.

    Compiled my own hex, just making sure the TIMEOUT was set to zero, so I could make sure the switch option will be the one to use.

    I plugged the unit at different USB ports, and get the message of Unknown Device. Windows 7 Device Manager shows a Unknown Device at “Universal Serial Bus controllers”.

    Trying to flash anything at the unit in this situation, using AVRDude give me the following error:
    avrdude: error: could not find USB device ” USBasp” with vid=0x16c0 pid=0x5dc.

    USBDeview software shows nothing as “USBasp” connected.

    If I reflash the unit (with a second USBasp programmer) with the original USBasp hex from Fischl, the one using pins PortB.0 and 1 for USB pins, then the unit is recognized as USBasp by Windows, by USBDeview, at Device Manager and by Khazama and AVRDude.

    I know that the Bootloader should simulate an USBasp device “with” a device to be programmed, but it is not happening. When only the Bootloader in the AVR, it is dead,

    I tried to run AVRDude within five seconds of inserting the unit, with your timeout hex, with your switched hex (alternates), with my compiled, try pressing the switch, it doesn’t work.

    How AVRDude recognizes and finds the bootloader, if it is not recognized by Windows?
    Ripping my hair here…

    Any suggestion?

  16. Wagne Says:

    Oh, forgot to ask for some good soul to email me the original betemcu.cn miniprog firmware, since I erase it from this unit, and the other two seems to be locked. I like the idea to have an automatic clock speed that increase speed according to performance. Thanks. registroATustrDOTnet

  17. Wagner Lipnharski Says:

    Hello Jonathan, don’t bother to post the message (about the bootloader not workig) I sent two days ago, I already found another bootloader that works.

    I still looking for the original firmware from betemcu.cn’s miniprog.

    Cheers, Wagner.

  18. Rich Says:

    I purchased one of the betemcu.cn programmers on ebay., The unit looks like the one pictured here. The seller directed me to ” http://www.fischl.de” for documentation. My issue is the schematic on the fischi.de site does not match this device. Does anyone have a schematic for the betmcu.cn programmer.??

  19. WMLex Says:

    If anyone problem with restoring the original firmware, flash the firmware programmer from the archive. http://yourdevice.net/downloads/usbprog.rar

  20. Alexander Says:

    I want to make that first started USBASPLoader, and after a timeout – USBASP.
    I got this: if, within two seconds after connect the card to a USB touch RESET, it works USBASPLoader, if not – then USBASP. But the problem is that can communicate only once, and during these two seconds (the timeout). Restarting avrdude does not see either one or the other. Need to reconnect the programmer.
    How to get a stable work (runs many times) with avrdude with the ability to call USBASP boot USBASPLoader at boot time?

    PS: Sorry for my English.

  21. Slack Says:

    Thanks jethomson for a great writeup. Also thanks Ggaljoen and WMLex for providing answers that solved issues that I was having.

    BTW, I programmed my betemcu using the following:

    Bus Pirate, 6.1 firmware (Sparkfun version of BP)
    avrdude, 5.11-Patch#7610
    Win 7 & XP

  22. [...] article explains about the USBASP, which is totally free as well as open source. It is also a reference design that was used to [...]

  23. gerardwr Says:

    I used this procedure to reflash my LCSOFT STUDIO V2.0 programmer. The BLINK program worked fine! THANKS!

  24. me Says:

    I tried to read factory firmware but I cannot, FLASH reading is disabled. This is what I get:

    :2000000000000101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0FF0
    :2000200010101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1FD0

    I used this command to get data from FLASH:

    avrdude -p atmega8 -c stk200 -v -U flash:r:betemcu_factory_firmware.hex:i

    Do you have factory firmware? Could you add it to this article? Thank you!

  25. Alan69 Says:

    Just a note, at the beginning of the article I’d mention anyone buying a new programmer off Ebay etc should get the LCSoft type instead. Largely the same, probably won’t have the R8 r-pack problem some betemcu ones have, and most important for using this way, have Tx/Rx on pins 4 and 6 instead of all to ground. Easy enough to change these too, just get a little more utility out of the LCSoft without having to rewire the extra if you’re ordering fresh programmers.

  26. Maikel Says:

    I just received my betemcu-board as a replacement for my broken programmer. Since I got some errors when trying to use it, I Googled a bit and found this article. It sounds nice to be able to update the firmware directly without the use of a second programmer. It’s just a bit unclear to me which modifications are needed to do so? Do I need to solder multiple wires? I’m not very keen on soldering to the SMD microcontroller.

    And with a second programmer, no soldering is needed at all?

  27. Alan69 Says:

    Maikel, the buttons etc are for signalling the bootloader. It originally comes with USBASP only on the chip, you have to have some other programmer at least once, to get the bootloader onto the chip that first time. Then you don’t need another programmer. You have to have at least some kind of programmer once.

    Google search “avr programmer parallel port” and click images, notice some are only 4 resistors on the parallel port. Short J2 on this programmer, hook up that simple programmer to this one through the ISP port and program the bootloader with it. Then undo J2 and you have the bootloader on this programmer. Probably easiest to just use an older PC with parallel port and older windows to do the parallel port programming..


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.