Release Notes for PICkit 2 Command Line Interface PK2CMD.EXE v1.01 Device File v1.42.00 PICkit 2 Firmware v2.10.00 (minimum required) February 12, 2008 ----------------------------------------------------------------------------- Table of Contents ----------------------------------------------------------------------------- 1. Tool Definition 2. Device Support List 3. Operating System Support List 4. What's New or Updated 5. Known Problems 6. Important Notes 7. Installation 8. Upgrading the PICkit 2 Operating System 9. Command Line Options 10. Command Line Examples 11. Return Codes 12. Customer Support ---------------------------------------------------------------------------- 1. Tool Definition ---------------------------------------------------------------------------- PICkit 2 Command Line Interface (PK2CMD) is a 32-bit command-line interface to the PICkit 2 device programmer. This interface is designed for programming devices in an evironment where batch files or custom controlling software is desired. The PK2CMD executable requires the "PK2DeviceFile.dat" file for execution. This file should be kept in the same directory as the executable. This Readme is targeted to users of the command-line interface. Refer to "PICkit 2 User's Guide" for more information about the PICkit 2 Programmer. ---------------------------------------------------------------------------- 2. Device Support List ---------------------------------------------------------------------------- Device support is dependent on the device file version installed with the PICkit 2 device programmer. For the versions listed above device support is listed below. When selecting a part using the "P" option (section 9), use the full name from the list below. + Indicates parts that require 4.75V minimum VDD for programming. PICkit 2 may not be able to generate sufficiently high VDD, so an external 5.0v power supply may be required. # indicates Midrange parts that support low Vdd programming Baseline Devices ---------------- PIC10F200 PIC10F202 PIC10F204 PIC10F206 PIC10F220 PIC10F222 PIC12F508 PIC12F509 PIC12F510 PIC12F519 PIC16F505 PIC16F506 PIC16F526 PIC16F54 PIC16F57 PIC16F59 Midrange Devices ---------------- PIC12F609 PIC12HV609 PIC12F615 PIC12HV615 PIC12F629 PIC12F635# PIC12F675 PIC12F683# PIC16F610 PIC16HV610 PIC16F616 PIC16HV616 PIC16F627 PIC16F628 PIC16F639 PIC16F627A PIC16F628A PIC16F648A PIC16F630 PIC16F631 PIC16F636# PIC16F676 PIC16F677 PIC16F684# PIC16F685# PIC16F687# PIC16F688# PIC16F689# PIC16F690# PIC16F72+ PIC16F73+ PIC16F74+ PIC16F76+ PIC16F77+ PIC16F716 PIC16F737+ PIC16F747+ PIC16F767+ PIC16F777+ PIC16F785 PIC16HV785 PIC16F84A PIC16F87# PIC16F88# PIC16F818# PIC16F819# PIC16F870 PIC16F871 PIC16F872 PIC16F873 PIC16F874 PIC16F876 PIC16F877 PIC16F873A PIC16F874A PIC16F876A PIC16F877A PIC16F882# PIC16F883# PIC16F884# PIC16F886# PIC16F887# PIC16F913# PIC16F914# PIC16F916# PIC16F917# PIC16F946# PIC18F Devices -------------- PIC18F242 PIC18F252 PIC18F442 PIC18F452 PIC18F248 PIC18F258 PIC18F448 PIC18F458 PIC18F1220 PIC18F1320 PIC18F2220 PIC18F1230 PIC18F1330 PIC18F2221 PIC18F2320 PIC18F2321 PIC18F2331 PIC18F2410 PIC18F2420 PIC18F2423 PIC18F2431 PIC18F2450 PIC18F2455 PIC18F2458 PIC18F2480 PIC18F2510 PIC18F2515 PIC18F2520 PIC18F2523 PIC18F2525 PIC18F2550 PIC18F2553 PIC18F2580 PIC18F2585 PIC18F2610 PIC18F2620 PIC18F2680 PIC18F2682 PIC18F2685 PIC18F4220 PIC18F4221 PIC18F4320 PIC18F4321 PIC18F4331 PIC18F4410 PIC18F4420 PIC18F4423 PIC18F4431 PIC18F4450 PIC18F4455 PIC18F4458 PIC18F4480 PIC18F4510 PIC18F4515 PIC18F4520 PIC18F4523 PIC18F4525 PIC18F4550 PIC18F4553 PIC18F4580 PIC18F4585 PIC18F4610 PIC18F4620 PIC18F4680 PIC18F4682 PIC18F4685 PIC18F6310 PIC18F6390 PIC18F6393 PIC18F6410 PIC18F6490 PIC18F6493 PIC18F6520 PIC18F6525 PIC18F6527 PIC18F6585 PIC18F6620 PIC18F6621 PIC18F6622 PIC18F6627 PIC18F6628 PIC18F6680 PIC18F6720 PIC18F6722 PIC18F6723 PIC18F8310 PIC18F8390 PIC18F8393 PIC18F8410 PIC18F8490 PIC18F8493 PIC18F8520 PIC18F8525 PIC18F8527 PIC18F8585 PIC18F8620 PIC18F8621 PIC18F8622 PIC18F8627 PIC18F8628 PIC18F8680 PIC18F8720 PIC18F8722 PIC18F8723 PIC18F_J_ Devices ----------------- PIC18F24J10 PIC18F25J10 PIC18F44J10 PIC18F45J10 PIC18LF24J10 PIC18LF25J10 PIC18LF44J10 PIC18LF45J10 PIC18F63J11 PIC18F63J90 PIC18F64J11 PIC18F64J90 PIC18F65J10 PIC18F65J11 PIC18F65J15 PIC18F65J50 PIC18F65J90 PIC18F66J10 PIC18F66J11 PIC18F66J15 PIC18F66J16 PIC18F66J50 PIC18F66J55 PIC18F66J60 PIC18F66J65 PIC18F67J10 PIC18F67J11 PIC18F67J50 PIC18F67J60 PIC18F83J11 PIC18F83J90 PIC18F84J11 PIC18F84J90 PIC18F85J10 PIC18F85J11 PIC18F85J15 PIC18F85J50 PIC18F85J90 PIC18F86J10 PIC18F86J11 PIC18F86J15 PIC18F86J16 PIC18F86J50 PIC18F86J55 PIC18F86J60 PIC18F86J65 PIC18F87J10 PIC18F87J11 PIC18F87J50 PIC18F87J60 PIC18F96J60 PIC18F96J65 PIC18F97J60 PIC18F_K_ Devices ----------------- PIC18F24K20 PIC18F44K20 PIC18F25K20 PIC18F45K20 PIC18F26K20 PIC18F46K20 PIC24 Devices ------------- PIC24FJ16GA002 PIC24FJ16GA004 PIC24FJ32GA002 PIC24FJ32GA004 PIC24FJ48GA002 PIC24FJ48GA004 PIC24FJ64GA002 PIC24FJ64GA004 PIC24FJ64GA006 PIC24FJ64GA008 PIC24FJ64GA010 PIC24FJ96GA006 PIC24FJ96GA008 PIC24FJ96GA010 PIC24FJ128GA006 PIC24FJ128GA008 PIC24FJ128GA010 PIC24HJ12GP201 PIC24HJ12GP202 PIC24HJ16GP304 PIC24HJ32GP202 PIC24HJ32GP204 PIC24HJ64GP206 PIC24HJ64GP210 PIC24HJ64GP506 PIC24HJ64GP510 PIC24HJ128GP206 PIC24HJ128GP210 PIC24HJ128GP306 PIC24HJ128GP310 PIC24HJ128GP506 PIC24HJ128GP510 PIC24HJ256GP206 PIC24HJ256GP210 PIC24HJ256GP610 dsPIC33 Devices --------------- dsPIC33FJ12GP201 dsPIC33FJ12GP202 dsPIC33FJ16GP304 dsPIC33FJ32GP202 dsPIC33FJ32GP204 dsPIC33FJ64GP206 dsPIC33FJ64GP306 dsPIC33FJ64GP310 dsPIC33FJ64GP706 dsPIC33FJ64GP708 dsPIC33FJ64GP710 dsPIC33FJ128GP206 dsPIC33FJ128GP306 dsPIC33FJ128GP310 dsPIC33FJ128GP706 dsPIC33FJ128GP708 dsPIC33FJ128GP710 dsPIC33FJ256GP506 dsPIC33FJ256GP510 dsPIC33FJ256GP710 dsPIC33FJ12MC201 dsPIC33FJ12MC202 dsPIC33FJ16MC304 dsPIC33FJ32MC202 dsPIC33FJ32MC204 dsPIC33FJ64MC506 dsPIC33FJ64MC508 dsPIC33FJ64MC510 dsPIC33FJ64MC706 dsPIC33FJ64MC710 dsPIC33FJ128MC506 dsPIC33FJ128MC510 dsPIC33FJ128MC706 dsPIC33FJ128MC708 dsPIC33FJ128MC710 dsPIC33FJ256MC510 dsPIC33FJ256MC710 dsPIC30 Devices --------------- dsPIC30F2010 dsPIC30F2011 dsPIC30F2012 dsPIC30F3010 dsPIC30F3011 dsPIC30F3012 dsPIC30F3013 dsPIC30F3014 dsPIC30F4011 dsPIC30F4012 dsPIC30F4013 dsPIC30F5011^ dsPIC30F5013^ dsPIC30F5015 dsPIC30F5016 dsPIC30F6010A dsPIC30F6011A dsPIC30F6012A dsPIC30F6013A dsPIC30F6014A dsPIC30F6015 ^ These two dsPIC30 devices must be programmed at Vdd >= 4.5 Volts. dsPIC30 SMPS Devices -------------------- dsPIC30F1010 dsPIC30F2020 dsPIC30F2023 KEELOQ HCS Devices ------------------ HCS200 HCS201 HCS300 HCS301 HCS320 HCS360 HCS361 HCS362 See below for connection information Serial EEPROM Devices --------------------- NOTE: Other supported voltage grades are listed in parentheses next to the device. Select the "LC" part number to program these other voltage grades. 24LC00 (AA)(C) 25LC010A (AA) 24LC01B (AA) 25LC020A (AA) 24LC02B (AA) 25LC040A (AA) 24LC04B (AA) 25LC080A (AA) 24LC08B (AA) 25LC080B (AA) 24LC16B (AA) 25LC160A (AA) 24LC32A (AA) 25LC160B (AA) 24LC64 (AA)(FC) 25LC320A (AA) 24LC128 (AA)(FC) 25LC640A (AA) 24LC256 (AA)(FC) 25LC128 (AA) 24LC512 (AA)(FC) 25LC256 (AA) 24LC1025 (AA)(FC) 25LC512 (AA) 25LC1024 (AA) 93LC46A 93LC46B (AA)(-C) NOTE: For 'C' devices, select the 'A' or 'B' 93LC56A 93LC56B (AA)(-C) device depending on the ORG pin setting. 93LC66A 93LC66B (AA)(-C) 93LC76A 93LC76B (AA)(-C) 93LC86A 93LC86B (AA)(-C) Connections for HCS devices --------------------------------------- PICkit 2 Pin HCS Device Pin (2) Vdd 8 (3) GND 5 (5) PGC /3 HCS20x, 320 \3 -or- 4 HCS30x, 36x (4) PGD 6 (1) VPP 2 HCS360, 361 only Connections for 24LC devices --------------------------------------- PICkit 2 Pin 24LC Device Pin (DIP) (2) Vdd 8 Vcc (3) GND 4 Vss (5) PGC 6 SCL (driven as push-pull) (6) AUX 5 SDA (requires pullup) 7 WP - disabled (GND) 1, 2, 3 Ax pins Connect to GND unless Vdd required by datasheet (EX. 24LC1025) Connections for 25LC devices --------------------------------------- PICkit 2 Pin 25LC Device Pin (DIP) (1) VPP 1 nCS (2) Vdd 8 Vcc (3) GND 4 Vss (4) PGD 2 SO (5) PGC 6 SCK (6) AUX 5 SI 7 nHOLD - disabled (Vdd) 3 nWP - disabled (Vdd) Connections for 93LC devices --------------------------------------- PICkit 2 Pin 93LC Device Pin (DIP) (1) VPP 1 CS (2) Vdd 8 Vcc (3) GND 5 Vss (4) PGD 4 DO (5) PGC 2 CLK (6) AUX 3 DI 7 PE - enabled (Vdd) 6 'C' Device ORG Set to select word size ---------------------------------------------------------------------------- 3. Operating System Support List (Tested) ---------------------------------------------------------------------------- Windows XP SP2, and Windows Vista™ (32-Bit)* OSs * Only initial testing has been performed on 32-bit Vista for this release. 64-bit Vista is not supported at this time. ---------------------------------------------------------------------------- 4. What's New or Updated ---------------------------------------------------------------------------- Initial Release ---------------------------------------------------------------------- 5. Known Problems ---------------------------------------------------------------------- ---------------------------------------------------------------------------- 6. Important Notes ---------------------------------------------------------------------------- PICkit 2 Operating System firmware v2.10 is required at a minimum. However, later versions of firmware may be used. The latest firmware can be downloaded from the PICkit 2 webpage at www.microchip.com/pickit2 In Windows, the environment variable %comspec% and option /k can be used to precede a call to PK2CMD so that the console window remains open after PK2CMD exits. For example: %comspec% /k pk2cmd –ppic16F887 –i ---------------------------------------------------------------------------- 7. Installation ---------------------------------------------------------------------------- No installation process is required. Note that the device file "PK2DeviceFile.dat" should be kept in the same directory as the executable. The Microsoft .NET Framework is NOT required for PK2CMD. ---------------------------------------------------------------------------- 8. Upgrading the PICkit 2 Operating System ---------------------------------------------------------------------------- If the executable detects an incompatible OS, an updated operating system may be downloaded using the -D command line option. The latest OS firmware can be downloaded from the PICkit 2 webpage at www.microchip.com/pickit2 ---------------------------------------------------------------------------- 9. Command Line Options ---------------------------------------------------------------------------- The following commands are available in the command line interface. PICkit 2 COMMAND LINE HELP Options Description Default ---------------------------------------------------------------------------- A Set Vdd voltage Device Specific C Blank Check Device Do not Blank Check D OS Download None E Erase Flash Device Do Not Erase F Hex File Selection None G Read functions None Type F: = read into hex file, path = full file path, range is not used Types P,E,I,C: = ouput read of Program, EEPROM, ID and/or Configuration Memory to the screen. P and E must be followed by an address range in the form of x-y where x is the start address and y is the end address both in hex, path is not used (Serial EEPROM memory is 'P') H Delay before Exit Exit immediately K = Wait on keypress before exit 1 to 9 = Wait seconds before exit I Display Device ID Do Not Display K Display Hex File Checksum Do Not Display M Program Device Do Not Program memory regions: P = Program memory E = EEPROM I = ID memory C = Configuration memory If no region is entered, the entire device will be erased & programmed. If a region is entered, no erase is performed and only the given region is programmed. All programmed regions are verified. (serial EEPROM memory is 'P') P Part Selection. Example: PIC16f887 None R Release /MCLR after operations Assert /MCLR T Power Target after operations Vdd off U Program OSCCAL memory, where: Do Not Program is a hexidecimal number representing the OSCCAL value to be programmed. This may only be used in conjunction with a programming operation. V Vpp override Device Specific W Externally power target Power from Pk2 X Use VPP first Program Entry Method VDD first Y Verify Device Do Not Verify P = Program memory E = EEPROM I = ID memory C = Configuration memory If no region is entered, the entire device will be verified. (Serial EEPROM memory is 'P') Z Preserve EEData on Program Do Not Preserve ? Help Screen Not Shown Each option must be immediately preceeded by a switch, Which can be either a dash <-> or a slash and options must be separated by a single space. Example: PK2CMD /PPIC16F887 /Fc:\mycode /M or PK2CMD -PPIC16F887 -Fc:\mycode -M Any option immediately followed by a question mark will invoke a more detailed description of how to use that option. Commands and their parameters are not case sensitive. Commands will be processed according to command order of precedence, not the order in which they appear on the command line. Precedence: -? (first) -D -P -A -F -V -W -X -Z -C -U -E -M -Y -G -I -K -R -T -H (last) The program will return an exit code upon completion which will indicate either successful completion, or describe the reason for failure. To view the list of exit codes and their descriptions, type -?E on the command line. type -?V on the command line for version information. ---------------------------------------------------------------------------- 10. Command Line Examples ---------------------------------------------------------------------------- COMMAND LINE OPERATION PERFORMED ----------------------------------------------------------------------------- PK2CMD /? Help screen displayed. PK2CMD /?E All eXit (error) codes displayed. PK2CMD /?V Display version information for the PK2CMD executable, PK2DeviceFile.dat, and the OS firmware of the connected PICkit 2 programmer. PK2CMD /M? Help for the /M option displayed. PK2CMD /DPK2V022000.hex Firmware file PK2V022000.hex downloaded to PICkit 2 PK2CMD /PPIC16F887 /FPROGRAM.HEX /MP PICkit 2 set to a PIC16F887. Vdd and Vpp set to the device's default value. File PROGRAM.HEX is loaded. The device's program memory is programmed, with blank values in the locations not specified by PROGRAM.HEX. NOTE that the program memory is NOT erased first. PK2CMD /PPIC16F887 /FPROGRAM.HEX /M -A3.3 PICkit 2 set to a PIC16F887. Vdd is set to 3.3 Volts and Vpp set to the device's default value. File PROGRAM.HEX is loaded. The entire device is programmed, with blank values in the locations not specified by PROGRAM.HEX. NOTE that the entire device is erased before programming. PK2CMD /PdsPIC30F6014A /FHEXCODE.HEX /Y PICkit 2 set to a dsPIC30F6014A. Voltages are set to the device's default values. The device is verified against the contents of HEXCODE.HEX. NOTE that any programming operation -M<> verifies the data programmed automatically. PK2CMD /PdsPIC30F6014A /FHEXCODE.HEX /M /Y PICkit 2 set to a dsPIC30F6014A. The file HEXCODE.HEX is loaded. Voltages are set to the device's default values and the device is programmed. After programming, the device is verified against the contents of HEXCODE.HEX. Note: The Program (/M) operation implicitly performs a Verify when it completes the programming portion of the operation. Specifying a Verify (/Y) in the above manner effectively causes two Verify operations to be performed. PK2CMD /P18F4220 /FAPPCODE.HEX /Z /M PICkit 2 is set to a P18F4220. The file APPCODE.HEX is loaded. Voltages are set to the device's default values. All of the device's memory is programmed, with blank values in the locations not specified by APPCODE.HEX. The /z switch specifies PICkit 2 to preserve EEData. PK2CMD /P18F4220 /FAPPCODE.HEX /E /ME PICkit 2 is set to a P18F4220. The file APPCODE.HEX is loaded. Voltages are set to the device's default values. All of the device's memory is erased before the device's Program Memory is programmed, with blank values in the locations not specified by APPCODE.HEX. PK2CMD /P24LC128 /GP0-FF PICkit 2 is set to a 24LC128 serial EEPROM. Voltages are set to the device's default values. Device memory from location 0x00 to 0xFF is displayed. PK2CMD /P24LC128 /GFC:\PROJECT\EEVALUES.HEX PICkit 2 is set to a 24LC128 serial EEPROM. Voltages are set to the device's default values. The entire Device memory is read and saved in the hex file EEVALUES.HEX at the given path. Notes ----- If downloading firmware, all other commands are ignored. If not downloading firmware, a device must be specified. It is necessary to load a hex file every time a device is programmed. All values not specified in the hex file are set to blank (erased) values. Some Midrange, PIC18F, and dsPIC30F parts require a row-erase procedure to erase the chip at Vdd < 4.5 Volts. This will be done automatically if the selected device supports this function and the Vdd setpoint or detected target Vdd is below 4.5V. A warning will be issued for devices that only support bulk erases at Vdd >= 4.5 Volts if an erase is attempted at a lower voltage. The PICkit 2 VDD and VPP voltages can be calibrated using the PICkit 2 Programmer GUI application. The calibration will remain valid when used with PK2CMD on the same USB port. ---------------------------------------------------------------------------- 11. Return Codes ---------------------------------------------------------------------------- Value Code Notes ----- ---- ----- 0 OPSUCCESS Returned if all selected operations complete successfully. 5 VOLTAGE_ERROR A Vdd and/or Vpp voltage error was detected. This could be due to PICkit 2 being improperly connected to a part, incorrect part selection, or interference from other circuitry on the target board. 7 OPFAILURE Returned if an operation fails and a more specific error does not exist. 10 NO_PROGRAMMER The PK2CMD executable is unable to find a connected PICkit 2 programmer. 11 WRONG_OS Returned if the OS firmware must be updated before being used with this version of PK2CMD. 15 FILE_OPEN_ERROR Returned if a file specified for reading to (-gf...) cannot be opened for writing. 24 DEVICEFILE_ERROR The PK2CMD executable cannot find the device file PK2DeviceFile.dat or the device file may be corrupted. 28 UPDGRADE_ERROR Returned when an OS firmware upgade (-d...) fails. 34 PGMVFY_ERROR Returned if a program or verify operation fails. 36 INVALID_CMDLINE_ARG A syntax error in a command line argument was detected, an invalid combination of operations was entered, an invalid value was entered, or a memory region was selected that is not supported by the current device. 37 INVALID_HEXFILE Error opening or loading a specified hex file (-f...). ---------------------------------------------------------------------------- 12. Customer Support ---------------------------------------------------------------------------- The Microchip Web Site ---------------------- Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information: * Product Support - Data sheets and errata, application notes and sample programs, design resources, user's guides and hardware support documents, latest software releases and archived software * General Technical Support - Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listing * Business of Microchip - Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives Development Systems Customer Change Notification Service -------------------------------------------------------- Microchip's customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. To register, access the Microchip web site at www.microchip.com, click on Customer Change Notification and follow the registration instructions. The Development Systems product group categories are: * Compilers - The latest information on Microchip C compilers and other language tools. These include the MPLAB C18 and MPLAB C30 C compilers; MPASM(TM) and MPLAB ASM30 assemblers; MPLINK(TM) and MPLAB LINK30 object linkers; and MPLIB(TM) and MPLAB LIB30 object librarians. * Emulators - The latest information on Microchip in-circuit emulators. This includes the MPLAB ICE 2000 and MPLAB ICE 4000. * In-Circuit Debuggers - The latest information on the Microchip in-circuit debugger, MPLAB ICD 2. * MPLAB IDE - The latest information on Microchip MPLAB IDE, the Windows(R) Integrated Development Environment for development systems tools. This list is focused on the MPLAB IDE, MPLAB IDE Project Manager, MPLAB Editor and MPLAB SIM simulator, as well as general editing and debugging features. * Programmers - The latest information on Microchip programmers. These include the MPLAB PM3 and PRO MATE(R) II device programmers and the PICSTART(R) Plus and PICkit(TM) 2 development programmers. Additional Support ------------------ Users of Microchip products can receive assistance through several channels: * Distributor or Representative * Local Sales Office * Field Application Engineer (FAE) * Technical Support Customers should contact their distributor, representative or field application engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is available on our website. Technical support is available through the web site at: http://support.microchip.com