Programming AVR ATxMega using USBasp and ATxmega microcontroller

Summary of Programming AVR ATxMega using USBasp and ATxmega microcontroller


The ATxmega uses PDI instead of ISP, so standard AVR programmers like USBasp need modification. Szu converted USBasp by repurposing SCK as PDI DATA and MOSI as PDI CLK, and added level shifting (zener + resistor) to drop from 5V to 3.3V. Firmware must also be upgraded to a USBasp build that supports PDI to program ATxmega devices.

Parts used in the ATxmega USBasp hack:

  • USBasp programmer
  • Zener diode (for 3.3V level shifting)
  • Resistor (used with zener for voltage drop)
  • Connections/wiring to repurpose SCK as PDI DATA
  • Connections/wiring to repurpose MOSI as PDI CLK
  • ATxmega microcontroller (target device)
  • Firmware supporting PDI for USBasp

ATxmega programmer has different interface than 8-bit AVRs. It uses PDI interface instead of ISP. If you don’t want to buy new programmer for ATxmega you can try this little hack done by Szu. He uses USBASP (USB in-circuit programmer for Atmel 8-bit AVR controllers) with some modification to program AVR ATxmega. The hack convert SCK line to PDI DATA and MOSI becomes PDI CLK. Be sure to drop SCK and MOSI voltage from 5V to 3.3V using zener and resistor since PDI operates at 3,3V.
 Programming AVR ATxMega using USBasp
Next step is upgrading your USBASP Firmware with new firmware that supporting PDI.
For more detail: Programming AVR ATxMega using USBasp and ATxmega microcontroller

Quick Solutions to Questions related to ATxmega USBasp hack:

  • Can I use a USBasp made for 8-bit AVRs to program ATxmega?
    Yes, by modifying signals and firmware as described you can use a USBasp to program ATxmega.
  • How are SCK and MOSI repurposed for PDI?
    SCK is converted to PDI DATA and MOSI is used as PDI CLK.
  • Do I need to change voltage levels when hacking USBasp for PDI?
    Yes, drop SCK and MOSI voltage from 5V to 3.3V using a zener and resistor because PDI operates at 3.3V.
  • What kind of components are used for level shifting?
    A zener diode and a resistor are used to drop the voltage to 3.3V.
  • Is a firmware update required to support PDI on USBasp?
    Yes, you must upgrade the USBasp firmware to a version that supports PDI.
  • Why is a new programmer usually needed for ATxmega?
    Because ATxmega uses the PDI interface instead of the ISP used by 8-bit AVRs.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top