New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released

Author
PICkit2Dev
Super Member
  • Total Posts : 994
  • Reward points : 0
  • Joined: 2006/09/27 08:41:47
  • Location: 0
  • Status: offline
2009/01/13 11:07:02 (permalink)
0

New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released

A new version of the PICkit 2 command line software PK2CMD has been release with Linux and Mac OS X support, and is available for download from the PICkit 2 webpage.

New features in v1.20 include:
- New device support
- Faster PIC24 and dsPIC33 programming operations.
- Faster PIC18F6xJxx and PIC18F8xJxx programming.
- Auto-detection of devices.
- New % complete option for programming operations and GUI interfaces.
- New command to reduce programming speed for loaded ICSP signal lines.
(similar to disabling "Fast Programming" in the PICkit 2 Programmer GUI)
- New command to specify the location of the Device File when updating PATH is not practical.
- The -I command now shows the device name matching the returned Device ID.
- Binary file format import/export for Serial EEPROM devices.
- New help option to list or search supported devices in the current Device File.

Bug Fixes include:
- Fix for USB lockup issue in previous versions on Mac OS X.
- Fix for -GF command sometimes creating filenames with an extra space at the end.
- PIC32 Programming Executive updated to fix problems programming some devices.
- Serial EEPROM verification issue fixed.
- Baseline checksum error when Code Protected fixed.
- Bug displaying long UnitID names fixed.
- The operation of -T and -R commands for VDD and MCLR are now more consistent.

See the attached readmes for the different OS versions for more information.

Linux:
Buildable source code for Linux is provided for download on the PICkit 2 webpage, along with binary executables for Linux kernels 2.4 and 2.6.  It is recommended that you build from the source code on your system, and only use the executables if you run into problems building.  A makefile and documentation is included in the source download.  The libusb open source USB library is required to compile and run PK2CMD on Linux.  See the Readmes included in the downloads for more information.

Apple Mac OS X:
A Universal Binary executable is available for download from the PICkit 2 webpage, supporting Mac OS 10.4 (Tiger) and 10.5 (Leopard) on PowerPC and Intel based systems.  The command-line interface runs in the OS X Terminal.  The Mac OS port may also be built from the source code.  See the included Readmes for more information.

Please Note: The Linux and Mac OS source and executables of the PICkit 2 PK2CMD software and all accompanying documentation are provided "as is" and may be downloaded and used at your own risk.  Microchip Technology Inc. does not offer any support related to the use of this software or information.
You may be able to obtain assistance from other users of the software by posting in this forum or the Programmers forum.


Thanks to Jeff Post, Xiaofan Chen, Shigenobu Kimura, Alain Gibaud, and others for their contributions to development of these ports of the PK2CMD software.
post edited by PICkit2Dev - 2009/01/13 11:08:39
#1

19 Replies Related Threads

    sureideas
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2009/04/03 11:35:45
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2009/04/13 11:32:57 (permalink)
    0
    That is the Good news. I must say it addresses almost all the questions..I had some problem with the bugs earlier with this update I hope I can solve it..
    #2
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2009/05/04 02:07:53 (permalink)
    0
    This may be interesting to some PICKit 2 user under Linux.
    PICkit 2 Serial Port tool for Linux.
    http://zwizwa.be/darcs/staapl/tools/

      USB_Links and libusb
    #3
    TBallance
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2010/04/02 18:23:16
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/04/02 18:51:34 (permalink)
    0
    Hello,

    I'm new to this forum, so I apologise if this is the wrong place to post this.

    I've recently built a PICkit2 programmer, and have had no problems with it using the Windows driver software. With pk2cmd1.20 however, I found (after much confusion) that some of my configuration registers were not being written to properly. The specific PIC I am writing to is a 18F2431, and I can write these registers perfectly well with the Windows software.
    To solve this problem, I changed the configuration bit mask for this PIC in PK2DeviceFile.dat. I currently have device file version 1.55.00, as reported by pk2cmd (I think this is the most current version). The fix was changing byte 4c17 in the PK2DeviceFile.dat from '80' to '1D', allowing for the necessary configuration bits to be written (by altering the Config3H byte bit-mask). I have not experienced any further problems due to this now.

    That said, pk2cmd is a wonderful application and I'm very grateful that it has been made available. It is also very nice to be able to do all my development outside of Windows.

    I hope someone finds this helpful,
    Tim Ballance.



    #4
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/04/02 19:29:25 (permalink)
    0
    You can use this one to see the difference between different version of the device data file.
    http://www.microchip.com/forums/tm.aspx?m=473925



      USB_Links and libusb
    #5
    TBallance
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2010/04/02 18:23:16
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/04/03 08:02:57 (permalink)
    0
    Ah, thanks. I should have searched for something like that... It would have made my life easier ^^
    #6
    spinnaay
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2009/10/26 12:39:59
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/04 11:30:26 (permalink)
    0
    Hi,

    I've been looking for a Mac OSX solution for a while now. This looks like it could be a perfect solution for me as I have a PICkit2. I have downloaded it and have a good look around the readme.
    My question is how easy will this be for me to use? I don't have any experience in UNIX or in the terminal. Will I be able to work all this out?

    Thanks

    Thom
    #7
    cbfh
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2010/05/13 18:55:45
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/13 19:13:27 (permalink)
    0
    Hi,
    sorry if this may not be exactly the right thread but it appears to be the one most suitable for my two questions.

    I am trying to get my PIC32 Starter Kit running from my Linux PC (Ubuntu). As far as I can see, the current PK2CMD tools do not support the board, connected directly via USB. So is there a way to get PK2CMD operating upon the PIC32 Board, directly, or is there another similar native Linux tool for this board?

    However, if none of these applies, there is another plan to get it to work: As it appears from the various schematics, the P18 ICSP header (J3 on the PIC32 board) looks like there were chances to solder some connector to the board and connect to it via the PICkit2 programmer. Does anyone know if this is likely to work and if so, what has to be specifically considered to do so?
    Best regards
    #8
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/13 22:30:20 (permalink)
    0
    ORIGINAL: cbfh
    So is there a way to get PK2CMD operating upon the PIC32 Board, directly, or is there another similar native Linux tool for this board?


    It is possible but not that easy to port pk2cmd to the board -- to addpat the PICkit 2 firmware to the USB PIC18 on the starter kit. I think there will be quite some work and may not be worth the time.

    If you have the Explorer 16 board, then there is a port of pk2cmd for the on-board PIC18LF4550.



      USB_Links and libusb
    #9
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/13 22:32:22 (permalink)
    0
    Another alternative: buy the UBW32 and there is a Linux utility for the bootloader.
    http://www.schmalzhaus.com/UBW32/
    http://www.paintyourdragon.com/uc/ubw32/index.html

      USB_Links and libusb
    #10
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/13 23:20:17 (permalink)
    0
    ORIGINAL: cbfh
    However, if none of these applies, there is another plan to get it to work: As it appears from the various schematics, the P18 ICSP header (J3 on the PIC32 board) looks like there were chances to solder some connector to the board and connect to it via the PICkit2 programmer.


    The J3 is used to program the PIC18F4550 (QFN44 packaging), not the PIC32.

      USB_Links and libusb
    #11
    cbfh
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2010/05/13 18:55:45
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/15 18:54:40 (permalink)
    0
    Hi Xiaofan,
    thanks a lot for your pretty quick reply.

    ORIGINAL: xiaofan

    It is possible but not that easy to port pk2cmd to the board -- to addpat the PICkit 2 firmware to the USB PIC18 on the starter kit. I think there will be quite some work and may not be worth the time.

    If you have the Explorer 16 board, then there is a port of pk2cmd for the on-board PIC18LF4550.


    I don't know the Explorer 16, I've only got the PIC32 Starter Kit and the PICkit2 Starter Kit with the PICkit2 LPC Demo board. So as far as understand your information as well as the code I've seen so far, there are four possible alternatives:

    1. It would be possible to add the functionality to interface with the PIC18 firmware of the PIC32 board instead of the PICkit2 OS. This looks like the cleanest solution, but I haven't seen any information about the firmware on the PIC32 board, so far. So I don't know the interface and I cannot presume the effort this takes.

    2. The existing firmware could be mixed with the interface part of the PICkit 2 Bootloader/OS, so that it acts like PICkit 2 but still uses JTAG behind the scene. This appears to be the biggest effort and, to me, lacks by the missing sources of the PIC32 board firmware.

    3. I could modify the PICkit 2 code to work on the PIC32 board. It looks to me like this is not too hard to do. I think the main tasks were to change the code to
    - move initialization of MCLR_TGT from RA5 to negated level ~PIC32_MCLR on RC0 (correct?)
    - disable Vdd_TGT on RA1 (as Vdd aplies constantly to the whole board)
    - move initialization of ICSPDAT from RA2 to RB0
    - move initialization of ICSPCLK from RA3 to RB1
    - adapt Clock/PLL/Timer settings to the 8MHz instead of the 20MHz crystal
    The USB port uses the same port pins on both PIC18s. Most of this stuff should reside in boot_main.c, io_cfg.h and pickit.c. Do you know if the charge pump for Vpp is applicable/necessary for the PIC32? Until now, I haven't understood, the exact structure, which means: Which objects are part of the boot loader and which ones belong to the "OS"? There are no makefiles nor structural documentation included within the PICkit 2 sources.
    After changing and building the code, I could use the J3 connector to attach the PICkit2 and download the new boot loader. Subsequently, I should be able to update the OS via the regular USB connector between PK2CMD on host side and the new boot loader on PIC18 side. After this I should be able to program the PIC32 with PK2CMD (but without debugging and without JTAG), right?

    4. I could solder some thin wires to the corresponding PIC32 pins PGC2, PGD2, GND, Vdd (again: what about Vpp/~MCLR?) or to the corresponding pins of a fit J2 Application Board Connector counterpart, and attach my PICkit2 to it.

    Do you agree with this or is there a general mistake in my thoughts?
    Best regards
    #12
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/15 19:08:49 (permalink)
    0
    I think you have to forget about 1) and 2) for now as the firmware is not open.

    As for 3), I think it is doable. But you may have to read a bit more about the programming specification of PIC32. I am not really into PIC32 to answer your question.

    As for PICkit 2 firmware, the bootloader and the application are separated: each has its own project workspace.

    As for 4) it could be done. Vpp/~MCLR is always necessary for programming.

      USB_Links and libusb
    #13
    cbfh
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2010/05/13 18:55:45
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/16 19:08:52 (permalink)
    0

    ORIGINAL: xiaofan

    As for 3), I think it is doable. But you may have to read a bit more about the programming specification of PIC32. I am not really into PIC32 to answer your question.

    As for PICkit 2 firmware, the bootloader and the application are separated: each has its own project workspace.


    OK. On the CD I received with the PICkit2 Starter Kit I can find three directories under "Unsupported":
    - "Default Demo Code" (which I believe has nothing to do with the firmware)
    - "PIC18F2550 Source Code" (which looks like the firmware, but I don't know whether bootloader or OS)
    - "ProgrammingInterfaceSourceCode" (looks on first sight like Win* host side programmer code)
    So can you tell me which one is which, and where the missing parts are?

    ORIGINAL: xiaofan

    As for 4) it could be done. Vpp/~MCLR is always necessary for programming.


    I just digged a bit deeper and 4) looks a bit tricky, right now: While the PICkit 2 operates at the 5V level provided by the USB, the PIC32 is specified for a maximum Vdd of 3.6V. even the PGCx and PGDx pins are non-5V-tolerant. However, approach 3) (flashing modified PICkit 2 firmware to PIC18LF455) would not circumvent this problem, as the whole PIC32 board (including the PIC18LF4550) must only be powered by 3.3V and the maximum input voltage of the PIC18 is specified as Vdd. So the pure signals would be too high to reprogram the PIC18 as well.

    As a consequence of this I cannot simply connect the pins of the PICkit2, but will rather have to create an adapter in the following manner:

    - Pin1 (Vpp/~MCLR): As far as I understand the documentation and data sheets, the PIC32 seems to provide the appropriate programming voltage without the need (and even existence) of an external Vpp pin. Following this, the only use of Pin1 lies in pulling down the ~MCLR pin to switch to ICSP mode. So the adapter could connect Pin1 with a diode with the p-side towards the target board and the n-side towards the PICkit 2 and the high voltage of the charge pump (documented: "...typically +12V...") is kept out from the target board.

    - Pin2 (Vdd_TGT): Powering 5V to the target must be avoided. Additionally the PIC32 consumes up to 75mA when running at 80MHz and the circuitry (including the PIC18) consumes some more. The PICkit 2 shuts down operation on USB when consuming more than 100mA. For this reason it makes sense to isolate Pin2 and drive the target board with a separate power supply.

    - Pin3 (GND): This one can be connected directly.

    - Pin4 (ICSPDAT): This pin is signaling on 5V level and is necessary to be connected. So, it has to be level reduced in either of two ways:
    * two counter-parallel paths (one in each direction) of three diodes in serial mode in one direction (p-side pointing toward PICkit 2 and n-side toward target) and one in the other direction (P-side toward target), using their voltage loss (~0.7V each) to reduce the 5V to ~2.9V
    * two serial resistors (150 and 220 Ohms) to ground dividing 5V to ~3V with an output current of 13.5mA on the pin (inside the range of <25mA). The target board adds an additional resistor from the PGD2 pin to ground, but this one being 4k7 does not influence the calculated values significantly.

    - Pin5 (ICSPCLK): The same as Pin4 except there is no additional resistor from PGC2 to ground.

    - Pin6 (AUX): This pin is not needed and can be omitted.

    In this, it might be an advantage, that, according to the documentation, the PIC18LF4550 firmware only uses the JTAG connection, so it might hopefully not interfere with ICSP signals from PICkit 2. As I am no electrical engineer, do you think, these dirty "signal-hacking-approaches" are likely to work without destroying my PIC32 board (or my PICkit 2)? Are my assumptions true at all, or has the PICkit 2 any means to reduce the levels itself according to the device data, using the feedback channels on AN0 and AN1?
    Another question: Do you know if there is a special, commonly used name for the 120 pin connector type on the PIC32 board, so I can try to search and purchase one?
    Best regards
    #14
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/16 19:39:02 (permalink)
    0
    ORIGINAL: cbfh
    OK. On the CD I received with the PICkit2 Starter Kit I can find three directories under "Unsupported":
    - "Default Demo Code" (which I believe has nothing to do with the firmware)
    - "PIC18F2550 Source Code" (which looks like the firmware, but I don't know whether bootloader or OS)
    - "ProgrammingInterfaceSourceCode" (looks on first sight like Win* host side programmer code)
    So can you tell me which one is which, and where the missing parts are?


    My version is very old so I do not have the above directory. I think you are about right.
    Anyway, I will recommend you go to the website to download the latest version of the source codes.
    http://www.microchip.com/pickit2
    http://ww1.microchip.com/downloads/en/DeviceDoc/FirmwareV2-32-00.zip
    http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit2_PCAppSource_V2_61.zip

    Also of interests:
    http://www.microchip.com/forums/tm.aspx?m=338210



      USB_Links and libusb
    #15
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/16 19:40:50 (permalink)
    0
    If you are not an electrical engineer, I will suggest you buy the Explorer 16 instead. Then you can use the alternative PICkit 2 Lite firmware here.
    http://www.microchip.com/forums/tm.aspx?m=338210

      USB_Links and libusb
    #16
    cbfh
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2010/05/13 18:55:45
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/17 18:24:23 (permalink)
    0

    ORIGINAL: xiaofan

    My version is very old so I do not have the above directory. I think you are about right.
    Anyway, I will recommend you go to the website to download the latest version of the source codes.
    http://www.microchip.com/pickit2
    http://ww1.microchip.com/downloads/en/DeviceDoc/FirmwareV2-32-00.zip
    http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit2_PCAppSource_V2_61.zip

    Also of interests:
    http://www.microchip.com/forums/tm.aspx?m=338210


    Thanks again, I checked for the firmware you linked to. This version contains a very helpful documentation. As far as I have read, the PICkit is able to adapt its Vdd and Vpp. However it doesn't say anything about the ICSPDAT and ICSPCLK levels, so I assume, that they will be automatically adjusted to Vdd, won't they? In that case there may be no need to do any special HW adaptations. What the doc still doesn't mention is, how to build the bootloader in contrast to the OS i.e. which files belong to which one. Can you give me a hint?

    And do you know the "official" name of the connector type?
    Best regards
    #17
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/18 03:53:28 (permalink)
    0
    ORIGINAL: cbfh
    What the doc still doesn't mention is, how to build the bootloader in contrast to the OS i.e. which files belong to which one. Can you give me a hint?


    I am not so sure why you ask this. The workspace file names are quite obvious.
    PICkit2Bootloader.mcw -- for the bootloader
    PICkit2_FWv2.mcw -- for the main application

    I do not have the PIC32 starter kit so I am not able to answer your question about the connector.


      USB_Links and libusb
    #18
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/18 03:57:14 (permalink)
    0
    All in all, I will think this is not really worth the efforts.
    If you continue, I wish you good luck. I will stop here myself...

      USB_Links and libusb
    #19
    cbfh
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2010/05/13 18:55:45
    • Location: 0
    • Status: offline
    RE: New PICkit 2 PK2CMD v1.20 for Linux & Mac OS X Released 2010/05/18 14:07:32 (permalink)
    0
    Hi xiaofan,

    ORIGINAL: xiaofan
    I am not so sure why you ask this. The workspace file names are quite obvious.


    I'm very sorry for bothering with noob questions. This is my first attempt to get my PIC boards running. As I haven't installed or experienced MPLAB on my Linux system, I'm not quite in to its binary workspace or project file structure, and these files don't look too informative in vi ;°) Actually I didn't even know that they are workspace files, at all. Nonetheless, your information pointed me to some very good starting points, and I appreciate them a lot. Many thanks again for all your quick and helpful replies.
    Best regards
    #20
    Jump to:
    © 2018 APG vNext Commercial Version 4.5