
A2P2 Manual
===========


What is A2P2?
-------------
A2P2 is a microcontroller programmer designed to emulate both the 
AVR ISP Mark 2 (thus the A2 in the name) and the PICkit2 (thus the P2 in 
the name).  Named with a nod towards our favorite Star Wars robot.

The A2P2 is hardware compatible with the red button (latest) version
of the PICkit2.  It is a great little programmer but is also a great
learning tool for Microchip USB microcontrollers, using a microcontroller
to regulate a voltage supply, and using a microcontroller to create a higher
voltage.  We encourage you to look at the schematic that we provide
on the A2P2 product page, and to download the source code for the
firmware found at microchip.com/pickit2.

The programmer jumper provided with A2P2 can be used to connect to either
the standard 2x3pin AVR header (using J-AVR on the programmer jumper) or
to the standard 6x1pin PIC header (using J-PIC on the programmer jumper).
The programmer jumper also includes an area for you to create your own
custom programming interface if you choose. Note that the A2P2 is not
compatible with SlicBus but the programmer jumper can be used to connect
to SlicBus if desired since they share the same RJ25 jack.  Pinout information
for AVR, PIC, PICKit2's COM port, and SlicBus are printed on the
Programmer Jumper board.


How do I make it act like a AVR ISP Mark2 programmer?
-----------------------------------------------------
Run SMchange.exe and install the AVRispMk2 firmware.  See SMchangeReadMe.txt
for further details.  Note that we ship the A2P2 with the AVRispMK2 emulation
firmware installed.

When A2P2 is acting as a AVRispMk2, all software that works with AVRispMk2 will
work with A2P2.  This includes the gui programmer inside Atmel's AVR Studio and
the command line tool stk500.exe.  And, this also includes the open source tool
AVRdude (used in the Arduino IDE when programming the bootloader).

>> AVR Studio can be found at: atmel.com/avrstudio
>> stk500.exe is included with AVR studio

Special notes about AVRdude:
  AVRdude uses the open source usb driver libusb.  AVR studio uses
  the commerical usb driver from Jungo (commonly referred to as the Jungo
  USB driver).  The two are not compatible and we recommend that you install
  only the AVR studio Jungo driver and use either stk500.exe or AVR studio's
  gui to program your devices.
  
  If you wish to use both AVRdude and AVR studio, you should install the
  filter version of the libusb driver. 
  See  http://libusb.org/wiki/libusb-win32 for more details.

  Note that the issues involved with libusb and the Jungo driver apply
  to both the "real" AVRispMk2 and the A2P2 emulated AVRispMk2.


How do I make it act like a PICkit2 programmer?
-----------------------------------------------
Run SMchange.exe and install the PICkit2 firmware.  See SMchangeReadMe.txt
for further details.

When A2P2 is acting as a PICkit2, all software that works with PICkit2 will
work with A2P2.  This includes the programmer mode of the MPLAB gui as well
as the stand alone PICkit2 V2.61 programer gui and the PK2CMD command line
interface.

>> PICkit2 GUI and command line tool can be found at: microchip.com/pickit2
>> MPLAB can be found at: microchip.com/mplab



AVR ISP Mk 2 Use
----------------

  LEDs
  ~~~~

  The A2P2 and PICkit2 do not have the same LEDs as the real AVRispMk2.  Here 
  is how they were translated:

  Description              Real_AVRisp      A2P2_emulatedAVRisp
  .............................................................
  no target power          red ON           red ON
  idle with target power   green ON         red OFF
  busy/programming         yellow ON        red slow blink (1Hz)
  reversed cable           yellow blink     red fast blink (12Hz)


  Target Voltage Not Required
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Unlike a "real" AVRispMk2, the A2P2 can provide the target voltage
  to the device being programmed.  The A2P2 includes a poly fuse that
  will prevent your PC from being damaged should your target board
  draw more power than what is allowed over USB.

  To enable the target voltage, press and hold the button for 2 seconds.
  The red busy LED should go out and the yellow target voltage LED will
  light up.  If you briefly press the button now, the target voltage
  will be removed.


PICkit2 Use
-----------

  Regular Use
  ~~~~~~~~~~~

  For regular programming use, the A2P2 will operate the same as the
  "real" PICkit2.  In addition: the logic analyzer, the JTAG tool, and
  the serial port tool provided by the PICkit2 gui will also work.
  
  The only significant difference between the A2P2 and the "real"
  PICkit2 is with the PICkit2Go feature described below.
 
  Advanced Use - PICkit2Go
  ~~~~~~~~~~~~~~~~~~~~~~~~

  To save cost, the A2P2 board doesn't have the I2C EEPROMs populated.
  These are required only for the rarely used PICKit2Go feature which
  allows you to program PIC microcontrollers at the push of a button
  without using programming software on your PC.  (Note that you must 
  first load the EEPROM with the hex file you wish to eventually program 
  onto devices using the PICkit2 GUI on your PC.)  This is a great feature
  for manufacturing, where multiple boards are being programmed with
  the same firmware image.

  You can install the EEPROM yourself onto A2P2.  You can use either
  surface mount or through hole devices.  You can use 2 24LC512 devices
  as found on the "real" PICkit2 or you can use 1 or 2 24LC1025 devices
  to either match or double the memory found on the "real" PICkit2.
  When using the 24LC1025 devices, you must bridge the solder points
  marked "24LC1025" on the bottom of the board.  If installing only
  one EEPROM, install it in the IC4 position (NOT IC3 - yes, this is not 
  intuitive but matches Microchip's numbering).  IC4/U4 is the position
  closest to the USB connector.  Note 24LC512=64Kbyte, 24LC1025=128Kbyte.

  After 128Kbytes or 256Kbytes of EEPROM is installed, the A2P2 will 
  operate the same as the "real" PICkit2 in all modes of operation
  including the rarely used PICkit2Go feature.


Which is Installed?  AVR or PIC?
--------------------------------

To determine which firmware is installed, plug the board into usb WITHOUT
a target attached to the programmer jumper.  If the red BUSY LED is lit
unblinking after pressing the button once quickly, then you have the AVRispMk2 
firmware installed, if not then you have the PICkit2 firmware installed.

Note if you have a 3rd option for firmware then it may respond the same as 
either a PICkit2 or AVRispMk2 so be cautious of this.


Is the source code available?
-----------------------------

The source code for the PICkit2 firmware is available from Microchip at
microchip.com/pickit2 .

The source code for the AVRispMk2 emulation is not available.

