Back

PDI_Interface

Loading views...

PDI_Interface

Category: Debug/Programming

Overview

PDI (Program and Debug Interface) is Atmel's 2-wire programming and debugging interface for XMEGA AVR microcontrollers. It uses CLK and DATA lines and provides both programming (flash, EEPROM, fuse) and run-time debugging capabilities.


1. Theory & Fundamentals

  • Pins: PDICLK + PDIDATA (2-wire half-duplex)
  • Combines programming and debugging in single interface (unlike older ISP)
  • Communicates via USART in MSPI mode or dedicated PDI hardware on Atmel-ICE
  • Access: Flash, EEPROM, fuses, lock bits, user row, SRAM, IO registers
  • NVM controller: PDI writes through XMEGA's NVM controller
  • Tools: Atmel-ICE, AVR Dragon, Atmel Studio / Microchip MPLAB X

2. Frame / Packet Structure

Protocol-specific to PDI_Interface.
See official documentation for complete frame formats.

3. Protocol Mechanics

  • Standard Debug/Programming mechanics apply
  • See hardware implementation for specific protocol flow

4. Hardware Implementation

  • Dedicated hardware probe/interface required
  • Standard MCU/embedded connection

5. Register-Level / Configuration

// PDI accessed via Atmel-ICE or avrdude

// avrdude example:

// avrdude -c atmelice_pdi -p atxmega256a3u -U flash:w:firmware.hex:i

// PDI NVM programming sequence:

// 1. Enable PDI (set PDI enable bit in RESET register)

// 2. Issue LOADDATALOW/HIGH command

// 3. Write NVM controller commands via PDI

// 4. Issue CHIP_ERASE, then program pages

// XMEGA specific: Must write NVM key (0x9D 0x45 0x57...) to unlock NVM


6. Driver / Software Development

  • Implement send/receive based on protocol specification
  • Use official SDK or library where available

7. Debugging & Testing

  • Use official debug tools for analysis
  • Logic analyzer for signal verification
  • Common issues: Timing, voltage levels, clock configuration

8. Real-World Applications

  1. MCU programming in production
  2. In-system firmware updates
  3. Debug during development
  4. Post-mortem fault analysis
  5. Test automation

9. Advanced Topics & Edge Cases

  • Advanced features depend on specific MCU family
  • Security lock bits and read protection
  • Production programming automation

10. Standards & Variants

Interface MCU Family
PDI_Interface See overview

๐Ÿ’ก Practical Examples

Ex 1: Basic usage โ€” connect probe and program device.

Ex 2: Read memory contents during debug session.

Ex 3: Set breakpoint and inspect register state.


๐Ÿงช Practice Questions

Beginner: 1) What MCUs use PDI_Interface? 2) Pin count? 3) Programming vs debugging? 4) Required tools? 5) Entry sequence?

Intermediate: 1) Protocol timing. 2) Read/write commands. 3) Breakpoint types. 4) Security bypass? 5) Production programming flow.

Advanced: 1) Custom programmer implementation. 2) Automated test via PDI_Interface. 3) Unlock locked device. 4) CI/CD integration. 5) Multi-device programming.


Checklist

  • [ ] Connect PDI_Interface probe correctly
  • [ ] Program flash via PDI_Interface
  • [ ] Set hardware breakpoint
  • [ ] Step through code
  • [ ] Read/write memory
  • [ ] Configure fuses/config bits
  • [ ] Automate with CLI tool
  • [ ] Handle security/lock bits