Since a few commenters on Szu’s site already asked for it, here is how I finally patched and compiled the USBASP firmware and AVRDUDE on Windows 10 x64 to support PDI (after a few days of try and error). PDI is needed for the newer generation Atmel AVR microcontrollers like XMEGA.

You might want to skip ahead to the bottom of this post and download the binaries only.

1. Set up the environment
* Download and install MinGW and MSYS shell
Select mingw-developer-toolkit, and mingw32-gcc-g++ packages
-> This will create a MinGW/MSYS shell for us, so we can compile the sources
* I downloaded and installed WinAVR from here:
-> This made the avr-gcc available in the shell
* I got the USBASP source from here:
* And the AVRDUDE source from here:
* And the patch files to support pdi/xmega

2. Compile USBASP
* extract the latest USBASP source into <USBASP source folder>
* start the MSYS shell (<MinGW installation folder>\msys\1.0\msys.bat)
* enter ‘cd <USBASP source folder>/firmware’ (!! use / instead of \ in the path !!)
* run “make main.hex” -> this command generates the main.hex file, which is binary-identical with the bin\firmware\usbasp.atmega8.2011-05-28.hex file

3. Compile AVRDUDE
* extract the latest AVRDUDE source into <AVRDUDE source folder>
* start MSYS shell (<MinGW installation folder>\msys\1.0\msys.bat)
* enter ‘cd <AVRDUDE source folder>’ (!! use / instead of \ in the path !!)
* enter ‘configure LDFLAGS=”-static” –enable-versioned-doc=no’ (this will generate the makefiles)
! if you get “configure: command not found” -> you did not get the latest version of avrdude’s source which includes the ‘configure’ Bourne shell script
! if you get “no acceptable C compiler found in $PATH” -> gcc or avr-gcc is not accesible from here. You should check your PATH environment variable in Windows, and make sure that both the <MinGW installation folder>\bin\ and <WinAVR installation folder>\bin\ are there. You can double check that by entering $PATH into the shell.
! if you get any “DON’T HAVE”s in the Configuration summary, you might want to get those libraries (but they are probably optional, because I could compile without them)
– libefl:
– libusb: (recommended)
– libftdi:
* enter ‘make’ to start the compilation process
* you should have a brand new “avrdude.exe”

4. (Optional) Install libusb
* download the latest from
* copy <libusb extraction folder>\include\lusb0_usb.h into <MinGW installation folder>\include\
* copy <libusb extraction folder>\lib\gcc\libusb.a into <MinGW installation folder>\lib\
* re-run AVRDUDE’s configure command to make sure you do have libusb now

5. Patch the source files and recompile
* if both of the above compiled, go ahead and patch them
* copy usbasp-pdi-usbaspfirmware-20120816.diff into <USBASP source folder>
* start MSYS shell (<MinGW installation folder>\msys\1.0\msys.bat)
* enter ‘cd <USBASP source folder>’ (!! use / instead of \ in the path !!)
* enter ‘patch < usbasp-pdi-usbaspfirmware-20120816.diff’ (!! there is a ‘<‘ character before the .diff filename !!)
! if you get that “x of x hunks FAILED” you probably have a line ending problem like I did (.diff file was UNIX format, I needed to convert it to Windows format with Notepad++)
* extract all files from into <AVRDUDE source folder>
* recompile both as described above in 2. and 3.

6. Flash your programmer to support PDI
I have an USBASP v2.0 from LC Technology and an original USBASP from MSX. I prefer to use the one by LC Technology because it supports 3.3V to the device to be programmed. In order to upgrade its firmware I needed to program the LC Technology with the MSX one.
In order to do so I needed to:
* set the jumper POWER on the MSX one
* solder pins to the JP2, use a jumper on JP2 and another to select 5V as operation voltage on the LC Technology
* connect them with the 5×2 IDC cable
* connect MSX to my USB port
* run avrdude to program the LC Technology:
avrdude -c usbasp -p atmega8 -U flash:w:usbasp.atmega8.2011-05-28_with_PDI.hex:i

7. Optional: write an e-mail to
* the author of USBASP (Thomas Fischl –
* the author of AVRDUDE (Kevin Cuzner –
to include these changes in the future releases to save everyone some time
* me, Andras Fuchs ( if you have problems or just want to say hi

8. Optional: skip all this and download the compiled binaries from here:
* USBASP (latest, 2011-05-28) with PDI support –
* AVRDUDE (v6.3, 2016-02-16) with PDI support –


WARNING: After completing these steps AVRDUDE reported a device signature check error. When I tried multiple times, sometimes I could pass the signature check, but the programming was still unsuccessful.

The most likely reason for the problem is the unstable power supply of the USB port. You might want to try to insert a capacitor between the power and the ground, or try a different USB port, USB-hub with a power supply or even a different computer. It can also help if you disconnect all other USB devices connected to the USB-hub where your programmer is connected to.


  1. Silviu · October 24, 2018

    Hi Andris,
    Many thanks for your great work! You spend a lot from your time in order to help us.
    I also tried to follow you steps, I succeed some how, but I got some problems because some time works and other more times didn’t work. If you have more time, please help me and post also the packed version for USBASP firmware but for ATMEGA88. You already placed this for ATMEGA8, but I have ATMEGA88 placed on my USBASP programmer. Many many thanks for your wonderful work!
    I wish you all the best!


    • Andris · October 25, 2018

      Hi Silviu,

      Thanks for your feedback! I’m glad you had some progress.

      That’s probably not the answer you are looking for, but I decided to replace my USBASP programmer with an Atmel ICE ( and I’m glad I did. It programs and debugs Atmel microcontrollers through a standard interface and it doesn’t have the problems USBASP had.
      I know it’s not that cheap, but it’s well worth it!



  2. Silviu · November 5, 2018

    Hi Andras,

    Many thanks for your reply 🙂
    I understand you. I also bought an Atmel ICE programmer and I agree with you that it is a good programmer. But I also teach many students and they don’t have money to buy this kind of programmer and also me don’t have money to buy 30 or more Atmel ICE programmers, one for each; so I decided to have a chipper solution. 🙂
    Probably in the future, we will try ho have our own solution to program Atmel microcontrollers

    I wish you all the best 🙂


Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s