Open Source XMEGA PDI Programmer!

Over the last week, I’ve been implementing what might be the world’s first *open source* XMEGA PDI programmer, thanks to a generous loaner XPLAIN board from Ross McKenzie (a fellow AVRFreak) and a lot of PDI related assistance from Justin Mattair. The programmer is now in a working beta release, available either as a prebuilt HEX for the XPLAIN board (see here) or as source code via the LUFA SVN.

The PDI programmer is part of the LUFA AVRISP MKII project, located in Projects/AVRISP of the LUFA codebase. From the latest AVRStudio4 release the official AVRISP-MKII supports XMEGA PDI programming mode, which means that I’ve been able to add it to my open source clone firmware too. It’s been a lot of work and taken many late nights, but it’s now ready for public consumption. It is able to program the complete XMEGA family of AVRs via any of the USB AVRs, as well as the normal AVRs via ISP mode. Both PDI and ISP modes can be selectively removed to save on compile space, allowing the programmer firmware to fit into even the 8KB USB AVRs (but 16KB is recommended).

Two pinouts are supported; a faster hardware USART mode which breaks compatibility with the official AVRISP-MKII pinout, but is very fast, and a slower bit-banged USART mode which is quite slow, but follows the official device’s pinout exactly. When compiled for the XPLAIN board, ISP mode is automatically removed and the hardware USART enabled for the fastest possible programming experience.

Note that AVRDude 5.8 is currently broken, and won’t work with my (or the official) AVRISP-MKII – you’ll need to download the AVRDude source and apply this patch until a newer release becomes available.

Have a Merry Christmas every one, and I hope this will lead to many new XPLAIN related projects in the future, now that everyone can program them easily without an external programmer! Look out for a new LUFA release soon.

 

Comments: 19

Leave a reply »

 
 
 

WOW. I am not sure how I missed this for so long. I have been really looking for a OS PDI programmer for the XMEGAS.

Do you have any updates for this post?

Thanks!

Ril3y

 

Not all that much – latest code’s in the official LUFA 100219 release, and the avrdude bug has been patched (I believe) in the avrdude 9.10 release. Hope you find it useful!

– Dean

 

Hello Friends

I need the Xmega programer MKII with ATMEL model.

Could you tell me a website, which I can to buy this device.

Best Regards

 

HIT ME! Wheres it at! 🙂

 

Steve, see http://www.fourwalledcubicle.com/AVRISP.php for the project information.

– Dean

 

Hello!
I need in-build information of xmega programer
are you can help me?

 

To make the programmer, you’ll have to construct the basic circuit shown in the USB section of your chosen USB AVR’s datasheet, for bus powered operation. For the connections to the target, you can use the connection pin-out information shown in the project AVRISP-MKII.txt documentation – PDI/PDI just requires a pair of resistors on the Tx and Rx lines to bridge the two lines together into a single PDI data line.

– Dean

 

Hello dean,
thank you for your work.
Is it possible to use a xmega for build this programmer?

MasterQ

 

Not at the moment – the low level drivers (SPI, etc.) would need to be ported. One of the main reasons I haven’t done this is the 3.3V limit of the XMEGAs, which would make simple programming of 5V targets difficult.

– Dean

 

I see your point,
but xmega’s has a high availability, and most (maybe all) targets with pdi interface are working with 3.3V and there are many open source spi programmers out there which can be used to program 5V targets.
Maybe i’m able to help by porting the firmware to xmega.
If you wish to do that.

MasterQ

 

Hello Dean,
tonight i mostly ported the avrisp2 firmware to xmega.
The problem is that i not know much about usb and the structure of LUFA, and there are some problems, i can’t fix that fast.
Have you time to help me to solve that problems.
If, just write me a mail, then i will send a diff.

Regards

MasterQ

 

Hello Dean,
tonight i mostly ported the avrisp2 firmware to xmega.
The problem is that i not know much about usb and the structure of LUFA, and there are some problems, i can’t fix that fast.
Have you time to help me to solve that problems.
If, just write me a mail, then i will send a diff.

Regards

MasterQ

 

You can email patches to me – I’m not fussed how I receive community contributions, as it’s only me that’s working on the implementation. Send it to the email on my contact page and I can take a look.

Cheers!
– Dean

 

Hi Dean,
impressive work! I am struggling to find a way to update firmeware on a xmega “helper controller” from an ARM platform (e.g. raspberry) directly with as less hardware as possible. In my understanding the PDI could be emulated by an I2C interface. Do you know of any ressources / links to follow up on this idea?

Help is much appreciated! Thanks and greetings – Stefan

 

Hi Stefan,

PDI is based on a half-duplex UART, rather than I2C; you can either bit-bang it (very slow) or use a hardware serial port to speed things up (to around 2MHz or so). Atmel have released an appnote on PDI programming using another AVR which can be ported to the Raspberry Pi.

Perhaps an easier method would be to instead program in an I2C, Serial, SPI or other bootloader into the XMEGA, and then update the XMEGA via that.

– Dean

 

hello
how is everyone today?
this chip(xmega32d4) was build in the circuit board of electric meter is there any way of reprogram it so as t make some modification to the chip if it possible i will attach the photo of the meter.
thanks

 

If it is a commercial mains meter, it would be at best unwise, and most likely extremely illegal to attempt to modify it. If it’s a consumer piece of equipment such as a “Kill-a-Watt” measurement tool for checking how much power a given appliance uses, it might be possible, but the existing firmware is almost certainly locked. Unlocking the XMEGA would destroy the existing firmware contents, so you’d have to write replacement firmware from scratch.

– Dean

 

Hi Dean,
How’re you?
Hope you’re doing fine.exactly thats what i want if there is any possibility of getting the firmware or rebuilding it.or copying it and edit it to meet our requirments it’s better.let me know how we could get in touch
-jeff

 

Of course – it’s open source. The firmware can be built from the latest LUFA source (Git Mirror) from the “Projects/AVRISP-MKII Clone” folder.

LUFA is MIT licensed, so as long as you include the full license text with your device, you can make and sell your commercial devices using it for free.

– Dean

 

Leave a Reply

 
(will not be published)
 
 
Comment
 
 

 

Vital Stats

  • 30 Years Old
  • Australian
  • Lover of embedded systems
  • Firmware engineer
  • Self-Proclaimed Geek

Latest Blog Posts

RSS