Calendar

November 2017
M T W T F S S
« Jun    
 12345
6789101112
13141516171819
20212223242526
27282930  

Categories

Active supporter of WikiPedia
Support Wikipedia

Geocaching

Profile for uwezi

Hacking an AVR programmer

(see also my recent appendix to this topic: Hacking an AVR programmer II – especially if you have an ATmega88-based programmer!)

On eBay I recently purchased a set of cute small USB AVR programmers which I intend to use in the course 1TE663 Microcontroller Programming at Uppsala University.

MK-USBISP-V3.00 programmer in an aluminum shell on eBay.


After waiting for one month for the delivery from China the package finally arrived today. Unlike other programmers which I purchased before, these come with a sturdy aluminum shell and in happy colors.

However, connecting the first programmer to my PC brought me quickly back to earth – it was not recognized as an USBasp. OK, it would not be the first delivery from China with broken or counterfeit electronics, so I tested the second one…

At that time I got a bit confused, because the programmer registered as an HID unit on the USB with vid=0x03EB & pid=0xc8b4. Not as an USBasp with vid=0x16c0 & pid=0x05dc.

This is the point where I usually ask Google. So I did and I found some threads discussing the same issue and pointing out, that these programmers needed a different software and were not at all compatible with avrdude. BAD!

But of course, one should be able to reprogram the programmer using another programmer. At my home this is not a henn and egg problem, since I have accumulated several AVR programmers.

Ok, I downloaded the USBasp firmware from Thomas Fischl, flashed the programmer after inserting the self-programming jumper:

Self-programming jumper on the MK-USBISP-V3.00 AVR programmer.

Since the original firmware is protected by the lock-bit fuses, I had to fully erase the chip first, then set the fuses correctly to HFUSE=0xc9 LFUSE=0xef and then flash the .hex file. I tried first the 2009-firmware from Thomas Fischl and the first observation was that instead of the red LED which was on previously, now the programmer showed a blue light.

But: Windows would not at all recognize this device as any USB device. Nothing showed up. I got confused. I tried both WinXP and Win7 – to no avail. Well, perhaps this programmer was not hardware compatible to the USBasp? Let’s have a look…

AVR programmer MK-USBISP-V3.00: component side.


AVR programmer MK-USBISP-V3.00: solder side.

There are some tiny, yet important, differences to the original USBasp programmer: in the USBasp USB-D- is connected to pin PB0, USB-D+ to PB1 and PD2/INT0. Here also USB-D- was connected to a pin on port D: PD3/INT1. Well, this should not really make a difference, and I continued my search for differences. OK, for some reason, also the LEDs are connected in parallel to 2 port pins each – so what…

In despair I decided to look into the source code of the USBasp firmware. The header files: OK – pin assignments were as expected, nothing special here. But let’s wait, where is the definition of the utilization of port D? Well, it was in the main.c file:

int main(void) {
  uchar i, j;

  /* no pullups on USB and ISP pins */
  PORTD = 0;
  PORTB = 0;
  /* all outputs except PD2 = INT0 */
  DDRD = ~(1 << 2);

hey – wait a second? All pins of port D are defined as output, except for PD2/INT0? I always tell my students to only define pins as output, which are really used as output… And what happens here?

Since the modified design also connected USB-D- to PD3/INT1, the rather aggressive definition of output pins leads to a unsolvable conflict, when suddenly PD2 is driving against the USB signals from the host!

Changing this little piece of code solved the problem. Rather conservative I set all pins of port D as input (none of them is currently used as output!):

int main(void) {
  uchar i, j;

  /* no pullups on USB and ISP pins */
  PORTD = 0;
  PORTB = 0;
  /* all PDx input */
  /* MK-USBISP v3.0 */
  DDRD = 0x00;

I compiled the code, flashed it onto the AVR programmer using another AVR programmer
…and behold: it works!

I will contact Thomas Fischl and tell him about this observation – perhaps the modification will be implemented in the distributed firmware on his homepage.

Here is a .zip-archive of the modified firmware. The .hex file for use with an ATmega8 is found in the default subdirectory.
Download ZIP archive: 20130212_mega8_usbisp

154 comments to Hacking an AVR programmer

  • […] статью, а так же переработанный исходник в Atmel Studio 4. Hacking AVR programmer, судя по всему была проблема с этим программатором в […]

  • […] GreenPhotons: Hacking an AVR programmer […]

  • […] This is a follow-up of my most popular post, Hacking an AVR programmer. […]

  • uwezi

    IMPORTANT NOTE

    For everyone who has problems with programmers which are using the ATmega88 instead of an ATmega8(L/P/…):

    I just bricked (it seems) an USB programmer of my own design, where I used an ATmega88. It is completely unresponsive after flashing the Fischl firmware from 2011, even though it uses Thomas Fischl’s exact board layout.

    I am not yet sure why or even how this could happen – the chip should always be responding to the serial programming commands unless you disable serial programming with the corresponding fuse. However, I only uploaded the .hex file with the flash code without touching the fuses.

    I hope that this will help me diagnosing the ATmega88-related problems reported here in the comments, but first I will replace the ATmega88 with an ATmega8 and try again…

    Uwe.

  • Roman

    i got v4.0 dongle – it uses atmega88, i used the updated firmware and fuses, but still can’t make it to work

  • […] Most of the time I design and debug my AVR projects on solderless breadboards nowadays. And for that I have been using some different types of programmers by now: starting with the good old STK500, to different versions of USBasp clones from Chinese sellers on eBay. […]

  • Toygar

    Hi there i have v3.02 and i try orginal usbasp firmware , your modified firmware and Atmega88 modified firmware. Your firmware and Atmega88 got bluelight but my pc says (win 8.1 ) this device not recgonized may be it corrupted. What can i do ?

    and Lfuse : EF
    HFuse C9
    E Fuse 01
    LB 3f it is correct ?

    i don’t set LB and E fuse. Only L and H.

    Thanks for article.

    • Toygar

      Hi there i used Fernando’s Hex File and LFuse FF HFuse DF

      it is OK ! USBasp detecting by my pc.

      Thanks for all things and this article.

      Thank you very much :)

  • Shyam

    I have USBISP programmer for 89S52 and AVR which has 12MHz operating Atmega8 chip and 6 pin header for ISP programming, for which I do not have source code. I will like to get source code in HEX and C. I want to program in another Atmega8 to replace the chip and perhaps do some code modifications also.

    This is student project work and I want them to try this.

    Thanks.

    Shyam

    • uwezi

      You should check the exact layout of your programmer and see if it matches the Fischl AVR-asp. In that case you can find the source code and the .hex file on Fischl’s homepage which I have linked in my post.

  • Eric Jorgensen

    I recently purchased one of these usbisp dongles w/ aluminum shell from an aliexpress vendor for about $2.50 shipped, and of course it shows up as a HID device out of the box.

    I’m new to this avr stuff but not entirely new to embedded systems. I bought this because i have an adafruit clock that i want to upgrade the firmware on, and figured it would be handy going forward – for $2.50 right? That way i don’t have to figure out how to use an arduino as an avr programmer.

    So I’ve messed with this long enough that i not only have a $1.80 arduino nano clone in a breadboard set up with the ArduinoISP sketch that comes with the Arduino IDE these days, I even made a cable to go from the breadboard to the usbisp without having to remember which arduino pin goes to which usbisp pin.

    board is marked mx-usbisp-v3.02 and has a mega88 chip.

    Despite coming across warnings that the avrdude that comes with the arduino ide doesn’t work well, it turns out to be the one that actually works on this system without some kind of libusb0 conflict.

    Along the way i discovered “avrdude gui” and discovered that it doesn’t work for poop.

    The command line i landed on that seems to have worked:

    "C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe" -p m88 -c arduino -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -P com7 -U flash:w:"C:\Users\Eric\Downloads\ATmega88b.hex":a -e -v -v -b 19200

    Of course, I made the mistake of changing the fuses to HFUSE=0xc9 LFUSE=0xef which disabled my device. Setting them back to HFUSE=0xDF and LFUSE=FF seems to have it going.

    I used Fernando’s hex file. Which was 2kb bigger the 2nd time i downloaded it.

    So yeah it’s been an interesting journey. And, thanks.

    • Zol

      how cool! mine is also that v3.02 version with Mega88, and the modified .hex + fuse bits worked! many thanks!

    • uwezi

      I have very good experience with AVRDUDESS as a gui to avrdude.

      • Eric Jorgensen

        Oh it looks great. But for whatever reason i am having issues resolving libusb0 dependencies. Prior to getting this chinese dongle, the only libusb app i had installed was the arduino ide, which comes with some version of it which was unable to please the avrdude binary i downloaded, or avrdudess.

        • uwezi

          Hi Eric,

          I have seen this issue two days ago on a computer in on of our student labs. The reason was that the USB drivers for the Fischl USBasp programmer had not been installed at all.

          You need to install these drivers, which you will find at Fischl’s homepage: http://www.fischl.de/usbasp/.

          Oh yes and by the way: Windows 8 will of course complain that it is an unsigned driver and currently I don’t know how to work around this “safety” feature, but I know that it’s possible.

          • Eric Jorgensen

            Initially, yes, i didn’t have the usbasp drivers installed. I never previously had any device that would work with that driver.

            So I configured an arduino as an avr programmer so i could get the chinese dongle reprogrammed.

            And that was when i ran into libusb0 issues. avrdude and avrdudess both complained about no libusb. I tried installing libusb0 from the main repository which resulted in a different error status that probably means something about conflicting versions of the same library (but gave only a “could not start, 0x????????” sort of error).

            I was able to get the dongle flashed using the copy of avrdude that gets delivered with the arduino ide, and then after removing my previous hackneyed attempts at fixing libusb0 and installing the USBasp drivers, I was able to use the chinese dongle to re-flash the arduino boot loader on an arduino nano with a bricked fake ftdi chip.

            I guess at this point i should try avrdudess again – perhaps the way the USBasp drivers installs libusb0 has fixed the issue?

          • uwezi

            I would give it a try!

            When I saw the libusb error message recently AVRdudess was still starting – perhaps you could then configure it to use the working avrdude which came with the Arduino framework?

  • Thank you for the firmware update. I had corrupted my Baite USBasp_H6 and after uploading your firmware the LED lit and I knew it was recovered.

    Thank you.

  • JL

    Thanks for this info. I think I got one of these, but do you have to remove the case to reprogram it, and if so, how do you remove the case?

    Thanks!

  • Ahnungslos

    Hello,

    I have an USBISP too. It’s a MX-USBISP-V3.02 board (2014-10-08) with mega8 on it.

    I have read a lot, but now I’m totally confused what to do.
    When I’m trying to reprogram it with the firmware above, I get a first verify error on Adr. 0x0000.
    (Cable-jumper between “UP”-pads is set)

    Reading the fuses give: Low 0xFF, High 0xDF and Lockbits 0x3F (AVRDudess with USBasp programmer). I guess the Lockbits are the problem, but how to solve it? Changing the Fuses in AVRDudess didn’t work.

    Can you help me to make the *isp to an *asp?

    Gruesse
    Werner

    • uwezi

      What programmer and program do you use to program the programmer?

      Have you tried setting the transfer speed to a lower value (-B parameter in avrdude)?

  • Vendor

    Hello,

    thank you Fernando Sakugava!

    2015-07-23 at 04:23 · Reply
    Modified for use in the V3.02, which uses a Atmega88:
    https://www.dropbox.com/s/88zve7kq2mc0h38/ATmega88.hex?dl=0

    I bought an programmer with circuit description MX-USBISP-V3.02 201-10-08 with an atmega88.
    It uses PID c8b4 and VID 03eb (c8b4:03eb) but i cant get it working.

    With your HEX i got it, many thanks, now its a USBasp!

    • Andi

      hi vendor, i also have problem with my USBasp v3.02…
      could you please show me how to modify the source code and how to compile that?
      maybe tutorial video or else..
      thanks

    • Andi

      Hi, could you show me the video tutorial to compile the main.c ?
      i confuse with how to compile it

      • uwezi

        Hi Andi,

        with the .hex file available you do not need to compile anything.

        Otherwise: if you are using AVR-Studio you could create a new project with AVR-Studio, copy all necessary files (.c, .h, .asm, .inc, .S and the usbdrv directory) from my zip-archive into that project folder, add the files to the project and “build” it.

  • Sherry

    Please Read.
    I have the exactly same problem for 2 days, and after reading this post relaxes me. Please help me how can i program my programmer using another programmer??

    • uwezi

      Hi there,

      how can I help you – the procedure is described above: you need a working, other programmer and then you connect this one to MOSI, MISO, SCK, RESET, GND and VTG of the programmer you want to program. Additionally you have to set the jumper wire to connect the RESET signal to the AVR chip on the programmer.

      • Sherry

        OK i got it. I need a USBasp to convert it into USBasp?
        I am a beginner, so one silly question.
        Should i connect the MOSI pin of programmer to the MOSI pin of AVR or MISO pin of AVR?
        and very thanks for the reply.

  • jbky

    Thank you very much! I flashed a MX-USBISP-v3.02 into a normal usbasp.
    I tought I wasted $3 on a broken programmer, but I flashed it using your instructions, and now it works flawlessly.

  • Abdullah Shawky

    hi ,

    first of all thanks for your effort but i have this problem ,
    i bought several chinese version with ATMEL USB ISP version 2.0 written on the case ,i flashed your code it was seen as usbasp and the blue led worked , i changed the fuses once and anothe flashed it without fuses change , i program AVR using Khazama software

    http://khazama.com/project/programmer/

    i always get this error
    Error while operating.,,

    :AVR device initialized and ready to accept instructions

    Reading########################################|100%0.20s

    :Device Signature=0x1e9308
    :NOTE: FL.ASH memory has been specified, an erase cycle will be performed
    To disable this feature, specify the -D option.
    :erasing chip
    :reading input file “D:\design\counter\working 1sec.hex”
    :writing flash (700 bytes):

    Writing I :error: usbasp_transmit: libusb0-dll:err [control_msg] sending control message failed, win error: The I/O operation has been aborted because of either a thread exit or an application request,

    please help me

    • uwezi

      I have never been using the Khazama software – the error message appears to point to a problem with the Windows driver libusb0-dll for the USB device. Please at least try to use avrdude from the command line to perhaps get a more detailed error message.

      If you like a graphical user interface instead of a command line, consider AVRdudess.

      Khazama’s current version is from 2011

      AVRdudess is from 2013

      • Abdullah Shawky

        it worked ,,, thhhhhhaaaaaannnnnnnkkkkksssss

      • Abdullah Shawky

        hi my friend,

        i used AVRdudess i chose the programmer usbasp
        there are 2 options that i dont know (baudrate -b bitclock -B
        i didnt set them to anything
        i tried to write 3 times first with no force option i got this error

        noname1.hex: 0 / 8,192 Bytes (0.00%)
        ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

        avrdude.exe: set SCK frequency to 1500000 Hz
        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.

        avrdude.exe done. Thank you.
        //////////////////////////////////////////////////////
        second with force option cheched
        i got this error
        ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

        avrdude.exe: set SCK frequency to 1500000 Hz
        avrdude.exe: error: programm enable: target doesn’t answer. 1
        avrdude.exe: initialization failed, rc=-1
        avrdude.exe: AVR device initialized and ready to accept instructions
        avrdude.exe: Device signature = 0x9810b4
        avrdude.exe: Expected signature for ATmega8535 is 1E 93 08
        avrdude.exe: NOTE: “flash” memory has been specified, an erase cycle will be performed
        To disable this feature, specify the -D option.

        avrdude.exe done. Thank you.

        ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
        third with force and erase flash and eeprom checked
        i got this error
        avrdude.exe: set SCK frequency to 1500000 Hz
        avrdude.exe: error: programm enable: target doesn’t answer. 1
        avrdude.exe: initialization failed, rc=-1
        avrdude.exe: AVR device initialized and ready to accept instructions
        avrdude.exe: Device signature = 0x0011b4
        avrdude.exe: Expected signature for ATmega8535 is 1E 93 08

        avrdude.exe done. Thank you.

        the flasher program didnt work so it didnt program the chip

        • Abdullah Shawky

          please note ,

          i checked the connection 5 times

          • uwezi

            You need to use the -B setting which you don’t know!

            It determines the clock rate at which the bits are sent from the programmer to the AVR you want to program.

            From your screen-shots you can see that it tries to burn the AVR at an SCK clock rate of 1500000 Hz or 1.5 MHz. According to the datasheet of an AVR, the SCK clock rate has to be less than 1/4 of the AVR’s own clock speed. If you have a brand new AVR than the clock speed is 1 MHz from the internal oscillator and this limits the useable SCK clock rate to 250 kHz.

            See the documentation of avrdude and use the option -B 5 as a starting point.

            In avrdudess which I recommended above you can select a suitable SCK clock rate from a pull-down menu.

            The -b option is not relevant here, since we are not using a serial port to talk to the programmer itself.

  • Fernando Sakugava

    Modified for use in the V3.02, which uses a Atmega88:
    https://www.dropbox.com/s/88zve7kq2mc0h38/ATmega88.hex?dl=0

    • me

      I tried that firmware and it works, I can use it with avrdude but LED is off, it is always off. This is the last part that should be addressed.

      • me

        LEDs work. I found that one LED was demaged, I replaced it and it works ok (it is not easy task to replace SMD LED, I destroyed 5 before I did it correctly…)

        BLUE LED is connected to PC0; well I am not sure if it was BLUE, it was defective

        RED LED is connected to PC1

        PD6 is conected to PC0
        PD5 is not connected to PC1 (jumper is missing)
        It is possible that PD5/PD6 are used as a key to code PCB version or something like that.

        My PCB is MX-USBISP-V3.02, 2014-10-08, MCU is ATmega88.

  • Fernando Sakugava

    I bought new version, which uses ATmega88. How can I compile the firmware for this processor?

    • uwezi

      the simple answer: it might just run as it is…

      the complicated answer: how do you compile your AVR code normally? If you use AVR Studio then you create a new project, select the ATmega88, copy the complete source code into this project and compile. If you compile using a MAKE file then you create a MAKE file where you set the correct controller.

      All the internals of the source code should be compatible between the ATmega8 and ATmega88…

  • Neil Jackson

    Dear uwezi: Thanks for the great instructions. I uploaded your firmware to a programmer that I got from DealExtreme (DealExtreme part number 151604), and the device now works perfectly as a usbasp. My device is almost identical to the one pictured above. The only difference that I can find is that the date silkscreened on my device is “2013-03-05”, and the silkscreened text is in a different place on the board.

  • Paul

    Hi.

    I have 5pcs V3.02 and check again. I put new Atmega8 from shop and now I can read signature and program uC. In new version V3.02 pin reset is disabled. This is problem because I don’t have HV programmer.

    • uwezi

      are you sure that it was the “reset disable” which was the problem and not a “lock fuse” which can be reset using a complete chip erase cycle?

      I was able to re-program v3.02 boards without needing to get out the chip and use high-voltage programming.

  • Great work!
    Now the nice programmer works like a charm!

    Thank you

  • Man,
    you saved my day, thank you very much, I had this piece of device for some time and today took the time to hack it as you suggested.

    Now works like a charm, for information I did not changed the Fuse, Just erased the chip, then flash the hex file and setback lock bits to original PROG_VER, LPM and SPM ALL disabled

    For information my original Fuse were set to :
    High=0xCF, Low=0xFF

    Changing according what you wrote just change
    High => bootsz 128W_0F80 to 1024W_0C00
    Low => CKSEL from 64ms to 4ms
    I think you can let them as original, and avoid the tricky touch fuse part than can sometime brick the device (in case of problem) so my 2cent advice is not touching the fuses, they worked before they should work after, it’s the same device.

    May be we could do some tricky old red LED blinking when programming 😉

  • Pau

    I also have buy one o this USBISP, mainly for the nice aluminium case.
    After a couple of tryes to make’it work like a USBASP whithout hardware modification I have concluded that best wai is to make’it USBASP hardware compliant.
    Mine was having botd PD3 and PD2 directply connected to USB port D- and D+ and the LED’s were in antiparalel between PD5 and PD6.

    So I cut the trace on PD32, PD3, PD5, PD6 and between LED’s at one end.
    After that I put 2 68ohm resistor on the zenner diodes and rewire from them to PB0 for D- and PD2 & PB1 for D+.
    The common of the LED’s I connected to +5V thru a 1K resistor, I desolder one led and put’it same as the other one (anode to common +5V) and the cathodes I connected to PC0 and PC1. You can also put different collors. To program I use Another USBASP and a wire jumper for Reset.
    Result: one nice piece of fully compatible USBASP.

    HTH.

    Paul

  • maislo

    I’m using an arduino uno as isp (the -c arduino is for programming the arduino itself).

    I already double checked the connections and tested the arduino with another chip (and it works), however i keep getting that error about the device signature.

    When i try it with the “-F” option:

    avrdude -c avrisp -P/dev/ttyACM0 -b19200 -p m8 -v -e -B 5 -F

    I get:

    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000 (retrying)

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000 (retrying)

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000
    avrdude: Yikes! Invalid device signature.
    avrdude: Expected signature for ATmega8 is 1E 93 07
    avrdude: safemode: lfuse reads as 0
    avrdude: safemode: hfuse reads as 0
    avrdude: erasing chip

    avrdude: safemode: lfuse reads as 0
    avrdude: safemode: hfuse reads as 0
    avrdude: safemode: Fuses OK (E:FF, H:00, L:00)

    avrdude done. Thank you.

    i also tried to connect to the device to check its signature with:

    avrdude -c avrisp -t -P /dev/ttyACM0 -b 19200 -p m8

    but, without the “-F” option, all i get is the error i mentioned before, and with the Force option i get:

    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000 (retrying)

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000 (retrying)

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000
    avrdude: Yikes! Invalid device signature.
    avrdude: Expected signature for ATmega8 is 1E 93 07
    avrdude> sig
    >>> sig

    Reading | ################################################## | 100% 0.05s

    Device signature = 0x000000

    avrdude>

    • uwezi

      1) are you sure that you are using the correct “-c” setting in avrdude? As I wrote earlier, I am not sure since I have never ever used a programmed arduino as a programmer…

      2) all you seem to be getting back on the MISO-line between the arduino and the chip to be programmed appears to be 0s – in the signature, in the verification step,… to me it appears that this is where you have to start looking: loose wire, disconnected solder bridge,…

  • maislo

    when i try to fully erase the atmega8 with:

    avrdude -c avrisp -P/dev/ttyACM0 -b19200 -p m8 -v -e -B 5

    (or try to set the fuses, or to flash it, or simply connect with it)

    all i get is:

    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000 (retrying)

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000 (retrying)

    Reading | ################################################## | 100% 0.05s

    avrdude: Device signature = 0x000000
    avrdude: Yikes! Invalid device signature.
    Double check connections and try again, or use -F to override
    this check.

    avrdude done. Thank you.

    i’ve been googling about it, but i can’t really figure it out.

    is the chip locked?

    • uwezi

      I’m just a bit confused about your settings

      -c avrisp -P/dev/ttyACM0 -b19200

      What programmer are you using now?

      What happens if you try using the

      -F

      setting to override all warnings?

      • maislo

        According to the messagens from avrdude from when i try to erase the chip, the task was completed.

        But when i try to set the fuses

        avrdude -c avrisp -P /dev/ttyACM0 -b 19200 -p m8 -v -U lfuse:w:0xef:m -U hfuse:w:0xc9:m -F

        i get:

        Writing | | 0% 0.00s ***failed;
        Writing | ################################################## | 100% 0.16s

        avrdude: 1 bytes of lfuse written
        avrdude: verifying lfuse memory against 0xef:
        avrdude: load data lfuse data from input file 0xef:
        avrdude: input file 0xef contains 1 bytes
        avrdude: reading on-chip lfuse data:

        Reading | ################################################## | 100% 0.02s

        avrdude: verifying …
        avrdude: verification error, first mismatch at byte 0x0000
        0x00 != 0xef
        avrdude: verification error; content mismatch

        avrdude: safemode: lfuse reads as 0
        avrdude: safemode: hfuse reads as 0
        avrdude: safemode: lfuse changed! Was ef, and is now 0
        Would you like this fuse to be changed back? [y/n]

        If type “y” it gets stuck. And if i type “n” i get:
        avrdude: safemode: Fuses OK (E:FF, H:00, L:EF)

        wich is not the correct fuses.

        Actually, when i try to set the fuses, the red led on the usb programer is turned off, but i don’t know if this matters.

        I think i’m messing up the post with these long replys. I’m sorry.

        • maislo

          Actually, if I type “yes” to question above i get:

          avrdude: verifying …
          avrdude: verification error, first mismatch at byte 0x0000
          0x00 != 0xef
          avrdude: verification error; content mismatch

          avrdude: safemode: lfuse reads as 0
          avrdude: safemode: hfuse reads as 0
          avrdude: safemode: lfuse changed! Was ef, and is now 0
          Would you like this fuse to be changed back? [y/n] y
          avrdude: safemode: Wrote lfuse to ef, read as 0. 9 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 8 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 7 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 6 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 5 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 4 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 3 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 2 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 1 attempts left
          avrdude: safemode: Wrote lfuse to ef, read as 0. 0 attempts left
          avrdude: and COULD NOT be changed
          avrdude: safemode: Fuses not recovered, sorry

          avrdude done. Thank you.

          Wich took some time.

  • moto

    I have the hw v3.02 and I cannot update the firmware.
    I’m using an original AVR ISP mkII with AVR Studio.
    I connected everything, even tried to switch MISO with MOSI, but there is no reply from the chinese microcontroller.
    The reset signal is correct and the jumper is inserted.

    • derf

      Same problem here. MX USBISP v3.02 (bought mid december), unable to program or erase with avrdude. While attempting to program, there’s no response on MOSI whatsoever, even though all other signals look just fine.

      • uwezi

        I guess it’s time to make a follow-up on this one – I now have 3.00, 3.01 and 3.02 boards and I succeeded to reprogram all of these in the same way – but some of the boards were more problematic than others. Apart from the obvious – like a too fast speed from the programmer (some ATmega8’s seem to be slower on the ISP than specified) or lock-fuses (which can be reset by a complete chip-erase cycle) – I have the strong feeling that I lately only succeeded with one particular board, [b]because I held it in my hand during programming…[/b] (could it be a floating pin?)

    • uwezi

      You should definitely not need to switch MOSI and MISO! I have one v3.02 which I was not able to reprogram and 2 where I had absolutely no problems. The difference between the versions seems to be only that the solder-pad jumpers on the back side are not closed on the newer boards, but I am not sure…

  • uwezi

    A new update on the matter!

    Recently quite a few eBay-stores have started selling a new version of the programmer in the same aluminum case. These programmers have the printing “Atmel” on the front together with a printing of the connections on the 10-pin programming header.

    These programmers do not need to be reprogrammed, but already contain the correct Fischl-compatible firmware and not the weird and crappy Chinese software.

    This is the new type:
    eBay 281353519099

    This appears to be the new type:
    eBay 301128314029

    Appendix 2014-11-07

    I just noticed that the firmware in these new-type USB programmers is not the latest version of the Fischl-firmware. It does not allow avrdude to set the clock speed on the programming port. However, the circuit board inside the new-type programmer is exactly the same as shown above and readily accepts the firmware version which you can download from the link above. In order to program the programmer you will again need another programmer and additionally you bridge the two pads marked “–>UP<–“.

    • Paul

      Hi. I have this avr programer with new PCB ver. MX USB V3.02 and one old AVR with V3.00 PCB. When I connect old vesion to other programer I have connection and can read signature and write new firmware. With new PCB 3.02 I can’t connect with atmega. Only RC-1. PIN reset on old pcb have about 0V when I connect -UP-. On new PCB V3.02 olways have 3,6V on PIN RESET. On new PCB atmega8 is closed for LOCK FUSE or have change RST PIN for other function? Any idea ?

      • Jörn

        Hello Paul,

        I have the same problem. The Version is V3.02 Date 2014-10-08. You can`t change the firmeware. I use PROGISP 1.72 from http://www.zhifengsoft.com. I Think, the RESET-Pin is disabled.
        I tested Version V3.00 2013-03-15. Here you can change the firmeware without any problems. The pcb-layout is nearly the same, only two brighes are different. The atmega8 are the same. I killed the brighes – no effect. This is made in china-rubbish!

      • uwezi

        Hi Paul, what error message do you get, when you connect the new programmer?

        a) “Target doesn’t answer”
        b) “Cannot find device with VID… PID….”

        In case (a) the problem is that your programmer is trying to talk too fast to the target AVR chip. This can because the firmware in the programmer either is not able to set a different speed, or because you did not choose a slower speed from the avrdude options.

        In case (b) you don’t have an avrdude-compatible firmware in the programmer.

        What do you mean with “RC-1”???

        The reset-pin should only have 0V when it is connected through the -UP- bridge AND you are trying to program it from another programmer AND only during the short programming attempt – I would not expect you to see this with a regular multimeter.

        If the LOCK FUSE is set on the Atmega you can still erase the complete chip including the LOCK FUSE and then re-program it with a new firmware. Only if the manufacturer has disabled the reset pin with the corresponding fuse you would not be able to reprogram the chip using the ISP-interface at all. But I have not seen this yet – neither on 3.00 or 3.02 programmers – both of which I have by now bought from different European and Asian sources. (I have some throughput here, because I needed to get more programmers for my students nd by now I also had to replace 2 broken programmers).

    • Dan

      Hi,

      I feel I should warn you: my programmer came with the “Atmel” logo and pinout printed on the case, and it still had the Chinese USBISP firmware. So I fear that this case isn’t a guarantee that you will receive it with USBasp.

      I have to admit, though, I never tested mine (v3.01 board) with the unmodified USBasp firmware. I went straight to using yours.

  • Snow

    Has anyone got this full c file converted to Bascom so i can port it another chip type? The chip on board i have got is an ATMEGE48p

    Thanks Snow

    • uwezi

      The problem would not be to translate it to Bascom, but that the code size exceeds the flash memory size of your ATmega48!
      You can (and in my opinion should) program the ATmega48 in C the same way you can program any other ATmega or ATtiny in C. Trying to do the same in Bascom will most certainly not make the code smaller.

      The older – but still fully compatible – 2009-version of the Fischl AVRUSB firmaware still fits in a ATmega48. You can find it here: http://www.fischl.de/usbasp/ and the zip-file even contains a pre-compiled .hex-file for the ATmega48.

  • pin3

    Hello, I have MX-USBISP-V3.01 and It works well by using your firmware.
    However I get an error when I tried to write hex file to Attiny10 by TPI.

    When I watched at Thomas Fischl ‘s web site, and found that usbasp.2011-05-28.tar.gz supports TPI.
    I think that the failure due to the version of the firmware.

    So, I tried to make hex file using AVRstudio6.2, but I have failed because I do not know the way.

    Please tell me the way of making firmware, or make a firmware using the latest source files?

    • pin3

      Moments ago , I tried WINAVR.
      As a result , I was able to create the latest firmware that corresponds to the MK-USBISP.
      Thank you.

  • Kaan

    Hi,

    I’m using arduino as isp and the following code:
    avrdude -c arduino -PCOM4 -b19200 -p m8 -v -U flash:w:”C:\Users\Owner\Desktop\20130212_mega8_usbisp.hex”:a -U lfuse:w:0xef:m -U hfuse:w:0xc9

    But I’m getting this result:
    —————————————–


    avrdude: verifying …
    avrdude: 1 bytes of lfuse verified
    avrdude: reading input file “0xc9”
    avrdude: error opening 0xc9: No such file or directory
    avrdude: input file 0xc9 auto detected as invalid format
    avrdude: can’t open input file 0xc9: No such file or directory
    avrdude: write to file ‘0xc9’ failed

    avrdude: safemode: lfuse reads as EF
    avrdude: safemode: hfuse reads as CF
    avrdude: safemode: Fuses OK

    avrdude done. Thank you.
    —————————————–

    No led is lighting after the process and wwen I plug it into USB It shows as “Unknown USB Device (Device Descriptor Request Failed)”.

    Can anyone help?

    Thanks,
    Kaan

    • uwezi

      You can find the documentation for avrdude here.

      To make a long story short, the syntax for the U-option is:

      -U memtype:op:filename[:format]

      In order to give a value for a fuse on the command line you need to terminate the -U with :m, otherwise avrdude is looking for an external file – this is what avrdude tries to tell you with avrdude: reading input file “0xc9″.

      Once avrdude discovers a problem in the command line it will never do anything, but completely abort the operation before any harm could have been done!

      The correct command for you would (probably) be:
      avrdude -c arduino -PCOM4 -b19200 -p m8 -v -U flash:w:”C:\Users\Owner\Desktop\20130212_mega8_usbisp.hex”:a -U lfuse:w:0xef:m -U hfuse:w:0xc9:m

      …but I never change fuses and burn the flash in a single run – I always do this in separate steps…

      • maislo

        So, to do it in separate steps with an arduino, i should first use the command:

        avrdude -c arduino -Pmyport -b19200 -p m8 -v -U lfuse:w:0xef:m -U hfuse:w:0xc9:m

        To fully erase the chip, then:

        avrdude -c arduino -PCOM4 -b19200 -p m8 -v -U flash:w:”C:\Users\Owner\Desktop\20130212_mega8_usbisp.hex”:a

        To flash new firmware.

        Is that correct?

        • uwezi

          Your first line only sets the fuses, but does not erase the chip. To fully erase the chip you need to send

          avrdude -c arduino -Pmyport -b19200 -p m8 -v -e

          Also, I have never used an Arduino as a programmer and I cannot find whether the Arduino supports the -B option. But if you want to program an ATmega8 using a USB-programmer then you also need to give a -B 5 to slow down the bitrate between programmer and target chip…

          avrdude -c arduino -Pmyport -b19200 -B 5 -p m8 -v -e
          avrdude -c arduino -PCOM4 -b19200 -p m8 -v -U flash:w:”C:\Users\Owner\Desktop\20130212_mega8_usbisp.hex”:a -B 5
          • maislo

            The line:
            “avrdude -c arduino -Pmyport -b19200 -B 5 -p m8 -v -e”
            Gets me this error:

            avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

            avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x02

            avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x10
            Hardware Version: 4241194
            Firmware Version: 6742688.0
            Topcard : STK502
            Vtarget : 1.8 V
            Varef : 0.0 V
            Oscillator : Off
            SCK period : 0.1 us

            avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
            avrdude: initialization failed, rc=-1
            Double check connections and try again, or use -F to override
            this check.

            avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x10

            avrdude done. Thank you.

            And, if use -F as sugested by the message I get an error relating to the device signature:
            avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

            avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x02

            avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x10
            Hardware Version: 4241194
            Firmware Version: 6742688.0
            Topcard : STK502
            Vtarget : 1.8 V
            Varef : 0.0 V
            Oscillator : Off
            SCK period : 0.1 us

            avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
            avrdude: initialization failed, rc=-1
            avrdude: AVR device initialized and ready to accept instructions
            avrdude: Device signature = 0x281d71
            avrdude: Expected signature for ATmega8 is 1E 93 07
            avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x10

            avrdude done. Thank you.

            Sorry for the long reply. Also, sorry if I’m not making much sense. Microcontrollers are quite new to me.

          • uwezi

            in the line

            avrdude -c arduino -Pmyport -b19200 -B 5 -p m8 -v -e

            you of course need to replace “myport” with the actual portdescription on your system. Also if you are using the Arduino as a programmer you first need to load a corresponding sketch into the Arduino.

            What disturbs me a bit is that you get messages about the STK500-programmer back… even if I have nothing connected to my computer, I get a more helpful feedback from avrdude using the exact same command.

            If you are new to avrdude I would recommend you to get a graphical user interface to this tool – I use it all the time! E.g. avrdudess or AVR burn-o-mat

      • Kaan

        That worked like a charm. I successfully uploaded a test sketch using the programmer.
        Thanks a lot for your help and for the beautifully detailed article.

  • FTBug

    I have the same kind of programmer and I have followed your instructions, using an Arduino ISP to program it with the .hex file from the ZIP archive: 20130212_mega8_usbisp

    Seemed to work fine. I’ve got the blue light.

    BUT the hardware information panel of my Mac says that the device is not configured, even though it is recognized by my Mac as a USBasp.

    Now I don’t know how to access it with avrdude (there is no device corresponding to it in /dev !)

    Could somebody help me?

    Thanks!!

    • FTBug

      Got my answer somewhere else: the device to use with avrdude is simply “usb”. So the command line is for example :

      avrdude -C./avrdude.conf -vvv -e -patmega2560 -cusbasp -Pusb -b19200 -t

      Great !! Thanks to all!

  • Dan

    Thank you so much for this article. My board is marked v3.01, dated 2013-11-07. I have reprogrammed it with your modified firmware, and it seems to be working fine.

  • I do not know if it’s just me or if perhaps everyone else
    experiencing issues with your site. It appears like some of the text in your content are
    running off the screen. Can someone else please comment and let me know if this is happening to them as well?

    This may be a problem with my browser because I’ve had this happen before.
    Thank you

    • uwezi

      I usually check my pages with Firefox, Opera and in very rare cases Internet Explorer and I cannot reproduce any strange behavior…

      Which browser are you using?

  • T0meck

    I also have this useless programmer and I’d like to reflash it using the modified software. But could you please provide me with any way of how I’m suppose to connect my external usbasp programmer to program atmega8 on this usbisp programmer board. Should I connect directly to the pins on smd chip or some other way?
    Please. This is urgent.

    • uwezi

      I really wouldn’t call these programmers useless. They have a comparatively high quality.

      You program the programmer by connecting another programmer 1:1. MISO-MISO, MOSI-MOSI, SCK-SCK, RESET-RESET, GND-GND and VTG-VTG. Additionally you need to short the on-board jumper as described above.

      • T0meck

        So I should connect my external programmer to ISP socket of the programmer I’m programming and short circuit rst pin on the board?

        • uwezi

          Yes, you connect the two programmers with a standard 10-pin cable and set the jumper on the programmer which needs to be programmed.

          Only the programming programmer should be attached to the USB port of zour computer at that time.

          Just see the programmer as an AVR target system, which you want to program.

          • T0meck

            Oh I see. I just thought that MISO,MOSI,VCC,SCK,RST in ISP socket of the programmer which I/We want get reprogrammed are not connected with pinouts marked on the above pictures. So what I did was interface with those tiny holes but it worked. Anyway. As you said it. I could connect the two programmers with standard 10 pin ISP interface without the need of trying to put wires through those small holes.
            Thanks. I think that there are others who also didn’t know that.

            So to sum up:
            USB-10pinISP ==10pinISPcable== 10piISPsocket + short circuit RST on the board.

          • uwezi

            You can find the schematics of the USBasp programmer on Thomas Fischl’s homepage. There you can see the connections in detail.

            When programming an AVR chip with the programmer, the programmer takes the role of Master and the target becomes the Slave, thus MOSI goes from the programmer to the external AVR chip.

            When programming the programmer, the other programmer becomes the Master, and thus MOSI goes from the other programmer to the one you want to program.

            This way you can understand that the wires can be connected 1:1 with the exception of the Reset-line. The latter is because the programming (Master) AVR chip cannot control its own Reset pin and at the same time remain ISP-programmable.

  • Yasir Arshad

    Hello everyone!!!
    I am trying to implement the USBasp Programmer by fischl on hardware. So far, I have had no success in making this. I wanted to try it on Breadboard first. I used universal programmer from my university lab to burn the firmware. I burned the hex file in “bin” folder for atmega 8. I set the fuse bits to HFUSE=0xc9 LFUSE=0xef , as told in the readme file. When i connect it to computer, it is not recognized as USBasp, instead a notification pop ups, saying “USB Device not Recognized”. And i also tried to install drivers given in thr RAR file downloaded from fischl. I have checked the circuit many times and its fine by me. I can’t understand how to install drivers (nothing installs from that rar file – i copied libusb files to System32 and drivers folder). And is there any specific way to burn the firmware. I am stuck here…. and i really really need help…

    Anyone here to guide me about what i am doing wrong, or atlest put me on the right path….

    • uwezi

      “you have tried to install the drivers” – well that is not enough, you will have to successfully install the drivers before Windows (I assume you use Windows..) will recognize the USBasp!

      You write about drivers in a RAR file – well the original drivers come in a ZIP file from the address http://www.fischl.de/usbasp/. In this you will find Windows executable installers for both 32- and 64-bit versions of Windows which you will have to run with administrative rights.

  • mehdi

    comparing two schema show that the blob of solder onto ‘B’ should be removed and PD2 should be connected to PB1.
    what is your idea mr.menzer?

    best regards
    mehdi

  • schel

    Gawsh dern it….I wish I knew WTH you all are saying.
    I’ve just jumped into the MC thing and have a programmer on the way but, looks like I still wont be able to begin any fun because the programmer may not work with my diyduino according to what I’m reading here…but I dont know what- I dont know yet and the language used for these fixes is beyond me. anyone speak layman want to toss a few definitions out for a new-newbie?

    • uwezi

      Let me try…

      Most of the USB AVR programmers out there are compatible with avrdude, the commandline tool you most probably want to use to flash your AVR controller. For these compatible ones you will probably need to install a driver under Windows, while this is not necessary if you are running Linux or MacOS.

      However, a very nice looking USB AVR programmer, which comes in a rugged aluminum casing. These programmers do not need a separate driver under Windows, but they cannot be used from the popular avrdude. Instead these rely on a proprietary Windows software with possibly no future updates and poor support and documentation.

      Yet, this particular USB AVR programmer is also based on the same basic circuit as the other programmers, which means that you can flash a new firmware and make it compatible with avrdude – however, this needs to be done with another AVR programmer…

      So, if you could tell me, which programmer you ordered, I might be able to tell you whether you have to expect problems or not…

  • newbee

    Uwezi ,

    I am a victim of .bay too ………..not an usbasp at all .

    before i reflash the unit , little question ;

    Have you made a firmware based on thomas fischl’s firmware dated 2011-5-28 ??

    Will that be possible ??

    • Menzer

      Hey newbee,

      yesterday I re-flashed my ISP. The Board is dated 2013-03-15 and looks little different to the one published on this site, but the patch works as well. The only things I had to change was:

      Change usbconfig.h as described by Shay:

      #define USB_CFG_IOPORTNAME D
      #define USB_CFG_DMINUS_BIT 3
      #define USB_CFG_DPLUS_BIT 2

      Bridge jumper 5 (on my board jumper ‘B’) to connect DMINUS on PD3

      You can see the necessity when you take a look to the schema I found on google:
      http://wiki.efihacks.com/images/f/fc/MX_USBISP_V3.00-schema.png

      Regards,
      Menzer

      • mehdi

        hi menzer
        my Board is dated 2013-03-15.what do you mean “connect jumper ‘B’ to D-“?i mean short circuit 100ohm on dminus.is that true?
        if yes it is forever or just for self prodramming?
        thank you
        mehdi

      • Julia

        Hi Menzer,
        can you upload your hex file please?

        yours sincerely
        Juli

        • uwezi

          I suppose he did in his second comment. At least there are .hex files for the ATmega8 inside the zip-archive…

          • mehdi

            hi uwezi
            my Board is dated 2013-03-15.inside the zip-archive exist two folder named (usbisp_2010-07-15_atmega8)and (usbisp.2008-11-26) and every one have main.hex
            which is SUITABLE for my board?

          • uwezi

            The zip-file is not mine it’s just linked here. I also only have the 2012-05-20 boards as shown here, but I am not aware of any changes in the layout, user Menzer only commented that there was a different board date code out there, but not what the difference was. Since the zip-file is his, and he has the same board, then both of his versions should work for you.

      • LeChuck71

        Hi Menzer,

        I have the same board as you. Flashing the hex from uwezi does provide me with a “usbasp fischl” programmer, but it does not work as expected.
        Any chane you can post your hex file somehwere so that I can try an flash it?
        I am new to all this microcontroller programming and still struggling in how to build my own hex file with the mods from shay.

        Cheers
        Axel

      • uwezi

        Thanks for this update!

    • uwezi

      I have not looked at or tried to modify any other firmware then the 2009-08-28 version from Thomas Fischl. I have contacted Thomas Fischl and informed him about the necessary changes, but never got a reply…

      I assume that it should be as easily possible to modify the 2011-05-28 version of the firmware. I just had a look at the source code of the 2011-05-28 version. The definition of port D is found in main.c line 306-310. It is the exact same code as in the previous code version, however, I do not know if there are any other conflicting definitions in other parts of the code.

  • “hey – wait a second? All pins of port D are defined as output, except for PD2/INT0? I always tell my students to only define pins as output, which are really used as output… And what happens here?”

    Oh god yes. Why do people make everything an output? It’s just begging for some unexpected connection or extra hardware causing a short and damaging the part.

    In all my AVR code the very first step in main() is to make everything inputs and enable pull-ups. No floating pins (so no excessive CMOS current draw), no high current draw if something is connected to an input, and no floating inputs to any pins used as outputs to something else. Then modules can make only those pins outputs that are actually outputting something.

    It’s surprising since the rest of the code is of a general high quality, with good modularity and no excessively-long source files.

    “I will contact Thomas Fischl and tell him about this observation – perhaps the modification will be implemented in the distributed firmware on his homepage.”

    Except that all the devices currently using the output-by-default code have the potential to be depending on this. e.g. the TX and RX pins are connected to the ICSP on some designs, and will thus be 0V with some decent current sink capability (less for TX since it has a 1K series). At this point it’s probably more risky to fix this than change it. Perhaps it could be a settable option that defaults to the old behavior, so in new designs it can be enabled and tested for specific hardware.

    I had this same board and came up with a similar fix, but I also changed some usbconfig.h definitions to

    #define USB_CFG_IOPORTNAME D

    #define USB_CFG_DMINUS_BIT 3

    #define USB_CFG_DPLUS_BIT 2

    which I didn’t see mentioned in your post. I put a link to my code changes in the website link of this message.

  • Piotrek

    Programmer works perfectly with AVRDude and Eclipse.Big Thanks.

  • Thanks alot, now the little “USBASP” works fine with avrdude even in Jönköping :)

  • Hi!

    Just wanted to say: Thanks a lot! Otherwise, I would have a useless usb programmer.

    Regards,
    Miha.

  • Rahim

    Life saver. Thanks for your hack.

  • canal

    Hello, i want to asking something..
    whether this tool could be used for a minimum atmega AT89S52? I always find error..
    please help me.. i’m a new comer

  • Husam

    For those wondering what command to put into avrdude, this is it:

    avrdude -c arduino -PCOM4 -b19200 -p m8 -v -U flash:w:”C:\Users\Owner\Desktop\20130212_mega8_usbisp.hex”:a -U lfuse:w:0xef:m -U hfuse:w:0xc9

    You may need to change the PCOM to whatever number your arduino is (you find it on the bottom of the arduino programmer)

    and you may need to change “Owner” to whatever name your username is

    • uwezi

      Thanks for the comment – but this is only relevant for someone who wants to use an Arduino to re-flash this programmer.

  • rayishere

    Hello Uwe Zi,
    Used KKmulticopter flashtool and a Baite USBASP programmer to put your firmware on a MX-USBisp-V3.00. Works on first attempt!

    Many thank,

    Ray.

  • Morgiahn

    Hi,

    I bought the same isp and felt into the same troubles.
    Many Thanks for your tutorial, now I could make it works !

  • Hieu

    Hi, I have the identical chinese isp usp. Flashing with your hex file went fine and the led became blue. However, I got the error message:
    avrdude: error: programm enable: target doesn’t answer. 1
    avrdude: initialization failed, rc=-1
    Double check connections and try again, or use -F to override
    this check.
    everytime I tried to upload using Arduino IDE. (My other USBasp worked fine.) Please, help!

    • uwezi

      Hi Hieu!

      This is normal – it is normally the symptom if your programmer tries to send data too fast into the AVR.

      Your other USBasp might have the external jumper which slows down the transfer rate. This newer firmware version supports a software command to slow down the transfer rate. In the command line options of avrdude please try to use the additional option -B 10 (that’s a CAPITAL B). If this works you can subsequently try to use lower numbers (the higher the number the lower the speed).

      • Hieu

        When I ran the command below, it seemed to work correctly.

        avrdude -c usbasp -P usb -p m328p -v -B10

        Arduino IDE uses avrdude to upload sketches. I tried to google for how to configure Arduino IDE to pass the option -B 10 to avrdude. However, the only available option related to speed is “.upload.speed=” which specifies the baudrate. Any chances, you can show me how to set Arduino IDE to pass the B-flag to avrdude?

        • uwezi

          Sorry, but I do not use Arduino or the Arduino IDE.

          But on the other hand, the “-B” option also just sets the “upload speed”. Possibly the Arduino IDE option does a similar thing – on the other hand it also possibly just sets the baudrate for serial-port programmers… You should ask this question in an Arduino forum!

          I would guess that the option somehow can be set using the hidden preferences.txt file of the Arduino IDE, but it seems to be poorly documented and this is one reason why I never even considered using Arduino. Programming the same microcontrollers using GCC directly you are not bound by an obscure intermediate layer of software.

          This is what avrdude does

          -B  1     avrdude.exe: set SCK frequency to 750000 Hz
          -B  2     avrdude.exe: set SCK frequency to 375000 Hz
          -B  3     avrdude.exe: set SCK frequency to 187500 Hz
          -B  4      -"-
          -B  5      -"-
          -B 10     avrdude.exe: set SCK frequency to  93750 Hz

          The SCK speed needs to be slower than 1/4 of the AVR’s current clock speed. This means for a brand new Atmega328 with a preset clock frequency of 1 MHz you need to use “-B 3” or higher.

          some links:

          How to program Arduino by using USBasp without bootloader

          Burning sketches to the Arduino board with an external programmer

          A proper explanation of the preferences.txt files.

          [SOLVED]Passing extra options to avrdude

          My first steps with the Arduino

          • Hieu

            Thank you a lot for taking your time to help me out. I have found out how to fix it. I just leave the link below in case someone also has the same problem.
            http://forum.arduino.cc/index.php?topic=149668.msg1284514#msg1284514

            I agree that with your point about arduino and I do feel restricted by arduino platform. I’m looking for books for beginners that teaches about programming AVR MCUs with C/Assembly (using ISP is prefered). I hope you can recommend me some good ones.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>