Download Print this page
Atmel AVR1612 Application Note
Atmel AVR1612 Application Note

Atmel AVR1612 Application Note

Pdi programming driver 8-bit avr microcontrollers

Advertisement

Quick Links

AVR1612: PDI programming driver
Features
• PDI driver for devices with PDI programming interface as target MCU's
• PDI instruction set and timing
• Programming application example for ATAVRXPLAIN/AT90USB1287
- Chip erase
- Write and read application flash
- Write and read EEPROM
- Read and write Fuses
- Read and write lock-bits
- Read target device id
1 Introduction
The Program and Debug Interface (PDI) is an Atmel
external programming and on-chip debugging of the device.
The PDI supports high-speed programming of all Non-Volatile Memory (NVM)
spaces; Flash, EEPOM, Fuses, Lock-bits and the User Signature Row. This is
done by accessing the NVM Controller trough the PDI interface, and executing
NVM Controller commands.
The PDI is a 2-pin interface using the Reset pin for the clock input (PDI_CLK), and
the dedicated pin for data input and output (PDI_DATA).
This application note describes how to implement PDI programming. It is based on
the Atmel Xplain evaluation board and clarifies the protocol and timing of the PDI
programming. Please also refer to application note
User's Guide
for how to start with the kit.
The
Figure 1-1
shows the Xplain PDI programming block diagram. The firmware of
the application is for the Atmel AT90USB1287 microcontroller; however it can be
easily ported to other Atmel's chip that features USART.
Figure 1-1. Xplain PDI Programming block diagram.
AT90USB1287
PDI
ATxmega128A1
®
proprietary interface for
AVR1907: Xplain Hardware
8-bit
Microcontrollers
Application Note
Rev. 8282A-AVR-11/10

Advertisement

loading

Summary of Contents for Atmel AVR1612

  • Page 1 (PDI_DATA). This application note describes how to implement PDI programming. It is based on the Atmel Xplain evaluation board and clarifies the protocol and timing of the PDI programming. Please also refer to application note...
  • Page 2 2-2, output data (either from the programmer or from the PDI) is always set up (changed) on the falling edge of PDI_CLK, while data is always sampled on the rising edge of PDI_CLK. Figure 2-2. Changing and sampling of data. AVR1612 8282A-AVR-11/10...
  • Page 3 AVR1612 2.3 Hardware Connection with AT90USB1287’s USART The Atmel Xplain kit uses the Atmel AT90USB1287’s USART port to implement the PDI port’s hardware. Figure 2-3 shows the PDI hardware connection between the AT90USB1287 to the Atmel ATxmega128A1. Figure 2-3. Hardware connection between AT90USB1287 to ATXmega128A1.
  • Page 4 Store data to PDI Control and Status Register Space KEY (0xE0) Set Activation Key REPEAT (0xA0) Set Instruction Repeat Counter Note: For more information, please refer to “PDI instruction set summary” in the “Program and Debug Interface” section of XMEGA A MANUAL AVR1612 8282A-AVR-11/10...
  • Page 5 AVR1612 PDI instruction usage example: • Write a 32-bit address into PDI Controller's pointer Pseudo Directive: ST ptr 0x12345678 PDIBUS hex code: 0x6B 0x12 0x34 0x56 0x78 NOTE ”0x6B” stands for “ST ptr” command. • Write a value to a address with *(ptr++) instruction through the PDI Controller...
  • Page 6 Erase & Write EEPROM Page PDI Write 0x06 Read EEPROM PDI Read Notes: For more information, please refer the “External Programming” section of XMEGA A MANUAL 1. If the EESAVE fuse is programmed the EEPROM is preserved during chip erase. AVR1612 8282A-AVR-11/10...
  • Page 7 AVR1612 3 The Programming Interface The PDI low level driver layer handles the basic interface to the USART driver. The physical layer uses a bi-directional half-duplex synchronous serial receiver and transmitter (as a USART in USART mode). The physical layer includes start-of-frame detection, frame error detection, parity generation, parity error detection, and collision detection.
  • Page 8: Memory Programming

    The NVM consist of the Flash Program Memory, User Signature and Calibration rows, Fuses and Lock Bits, and EEPROM data memory. For external programming the device is accessed through the PDI and PDI Controller, using PDI physical connection. Through the PDI, the external programmer access all AVR1612 8282A-AVR-11/10...
  • Page 9 PDI memory space. Figure 3-3 shows the PDI memory space and the base address for each memory space in the Atmel ATxmega128A1. Figure 3-3. Memory map for PDI accessing the data and program memories. 8282A-AVR-11/10...
  • Page 10 2. Write the selected memory address by doing a PDI Write operation. Since the Flash page buffer is word accessing and the PDI uses byte addressing, the PDI must write the Flash Page Buffer in correct order. AVR1612 8282A-AVR-11/10...
  • Page 11 AVR1612 3.4.2.4 Erase & Write Page The Erase & Write Application Section Page, Erase & Write Boot Loader Section Page, and Erase & Write EEPROM Page is used to erase one page and then write a loaded Flash/EEPROM page buffer into that page in the selected memory space, in one atomic operation.
  • Page 12 • Write the fuse bits 1. Write the “Write Fuse” (0x4C) command to the NVM controller. 2. Use the “STS ptr” command to set the fuse bits’ value. 3. Polling the NVM busy bit until it has been cleared. AVR1612 8282A-AVR-11/10...
  • Page 13 AVR1612 5 The Hierarchy of the code The code of this application can be divided into four layers. Figure 5-1 shows the hierarchy of this application code. 1. Application Layer: Integrate each module. User code may go into this layer.
  • Page 14 AVR Studio WINAVR-20090313 (or later) from http://sourceforge.net/projects/winavr/files/. 3. Extract the AVR1612’s code to a specific location (any location can be used, here used “C:\xplain_pdi_prog\”). 4. Open either the GCC project file or the IAR™ project file and compile the source code.
  • Page 15 Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL...