Few days ago I got package from Helsinki Hacklab. Some generic component stuff and a couple Atmel xmegas and breakout boards for them. Nice bit more powerful MCU’s than normal atmegas & attinys, but they eat only up to 3.3v, so better not to kill them with 5V logic. Luckily most 5v logics detect 3.3v as high, and their higher output can be lowered with resistor divider. Programing these xmegas also differ from their li’l brothers. Xmegas use PDI, which is kind of two wire system, constant clock signal and data I/O. I did not have expensive atmel programmer, so I improvised cheap ~2€ programmer using usbasp and avrdude using these patches.Compiling firmware for usbasp was easiest part. usbasp-pdi-patch my version can be downloaded from here, but I recommend you compile this yourself, this file may or may not work, no guarantee. You need another programmer for updating usbasp firmware. Plug usbasp to another programmer and connect JP2 jumper. Flash .hex file to usbasp following guides of your programmer. I had 2 usbasp so I just used one to program other one.
The hard part is avrdude. I could not get it compiled either in debian 6, xubuntu or freebsd even though I had all needed libs&stuff. Same goes for cygwin, no luck there. But in MinGW it worked, although not all programmers etc. are supported in my binary version. avrdude-usbasp-pdi-bin go to libusb folder and plug usbasp to usb port, run Inf_wizard, select usbasp from the list and install crated .inf driver file if usbasp not used or installed before. Patched Avrdude should recognize it when -C usbasp is used.
You may want compile avrdude yourself, it is after all executable program, so don’t blindly trust mine(It is virus and malware free I can assure you I tested it, but it may not be compatible with your system, it is compiled under 64-bit windows). Follow guide from original creator, I have patched source but you should try download and patch it yourself. For MinGW you need to put libusb files into mingw folder. ./bootstrap && ./configure && make should do the job. If you don’t know how to do this, ask somebody else who knows, I can’t help much because I can’t either get it working on other systems and even with different MinGW installation it caused problems.
And then we go to hardware part. As said, xmegas should newer get 5V in any IC pin, it will broke, there is no protection, and these ICs are definitely not as robust as DIP AVR’s. My usbasp was stupidly constructed, VCC for programming header can be selected between 3.3 and 5v, but programming logic levels are 5v in both case. I made little hack and converted usbasp to use it’s own regulator for main vcc(mega8 is hearth of usbasp).Who needs fuses, usb should anyway be well protected, and original fuse would not blow anyway if output is shorted(tested that, computer rebooted). Be sure which side is usb and which is vcc for usbasp, wire going from regulator output must be soldered to vcc, and vcc must be separated from usb power.VCC is connected to center pin of voltage selection jumper, so vcc can be selected between 5V and 3,3V. USB 5v is connected to input side of regulator. Important: in this version of usbasp board track going to regulator input to R4 must be cut, it separates vcc from regulator input. Now whole usbasp should work at 3.3V when jumper is set so. That small regulator can’t handle very much current, so use external power for target circuit, if it pulls more than 10-20mA. Test usbasp before connecting it to xmega, and hopefully your usb ports are forgiving…Resistors connecting MISO and SCK together. Build cable using this schematics from original post. Mine is build using connectors from old computer cases. Useful tip: cut one unused pin from pinheader, and block corresponding pin from connector, so you can only plug it in one way.