Skip to content

Program with modified USBASP

Niel Nielsen edited this page Apr 14, 2020 · 3 revisions

USBASP to program ATXMEGA chips (PDI interface)

Since I had a need to program the Chameleon Mini Rebooted (RevE), and I did not have the AVRISP MKII, or the money, I decided to give it a shot using one of my cheap USBASP clones (less than a dollar on Aliexpress)

To do that, a few modifications were necessary, one is the programmer itself, two is a modified cable, with two resistors added to create the DATA line for PDI programmer, and third, avrdude needs to be patched, so that it knows how to handle the PDI interface of the modified USBASP programmer.

None of the modifications are difficult, but you do need a soldering iron, and compiler/patching knowledge.

Using this cheap device, I have successfully unlocked the bootloader of the Chameleon, and flashed new firmware.

A note though, is that I needed to use Windows. As with dfu-programmer, Linux have some issues (which seems to be related to libusb, and, perhaps the fact that all Linux distros now are 64 bit). Using Windows gave however no issues.

The needed commandline to flash, and erase (neccessary, or verification will fail) is (avrdude will figure out the filetypes):

avrdude -c usbasp -p x32a4u -e
avrdude -c usbasp -p x32a4u eeprom:w:ChameleonMini.eep
avrdude -c usbasp -p x32a4u application:w:ChameleonMini.hex

This, as many of you know by now, is extremely helpful, if you happen to brick your device, and I hope having a (cheaper) option, than the AVRISP MKII is going to help many.

More details on how to Build and flash usbasp modified firmware (main.hex is in releases): https://github.com/nieldk/USBASP-PDI

Build avrdude (and a binary release for Windows): https://github.com/nieldk/avrdude

No more light: go back to stock

If you played too much with firmware flashing tools, end up with a bricked non lighting RevE, that is not even recognized as ATxmega32a4U on Windows devices tree in bootloader mode, and get such a message while flashing following this guide:

old_driver_bootloader
dfu-old-driver: no device present.

Then you may have "soft-bricked" your device. Do not panic and go back to stock brick, doing so:

avrdude -c usbasp -p x32a4u flash:w:ChameleonMiniRDV2.0_ATxmega32A4U.hex

Now your RevE should be blinking again and you can proceed to flash it again with a sane functioning firmware like told in this page.