pickit2

I see lots of questions about this programmer and I hate to type something more than once, so I created this FAQ instead. It is a quick job, mainly to document my hack of the bootloader. Feel free to contribute requests, comments and/or additions.


1. What is a PICkit 2?
2. What is 'in-circuit'?
3. What is 'prototype'?
4. What is a 'bootloader'?
5. How can I download/update the PICkit2 firmware'?
6. The software in my PICkit 2 seems to be corrupt, what can I do?
7. What is the purpose of that button?
8. Which USB driver do I need?
9. I get 'USB device not recognised', what should I do?


1. What is a PICkit 2?

The PICkit 2 is an USB in-circuit prototype programmer manufactured (and sold) by Microchip.

The PICkit 2 contains an 18F2550 chip. This chip can update its code (write to its own FLASH memory). The PICkit 2 contains a bootloader that makes this possible. You can use this feature to update the firmware of your PICkit 2.

2. What is 'in-circuit'?

The PICkit 2 is an in-circuit programmer, which means that it does not have a ZIF or similar socket to plug the target chip (the chip to be programmed) in. Instead it has a connector for a 6-pin, which you must connect to the target chip. With some care this enables you to program the target chip without removing it from its circuit. This is a big time-saver compated to ex-circuit programming (take the chip out of the target circuit, put it in the programmer, program it, take it out, put it back into the target circuit).

3. What is 'prototype'?

To be realy realy sure that a PIC is correctly and long-term reliably programmed it must be verified (by reading the code back and comparing it to the original) at the low and high extremes of the power supply voltage that it will be used with. Microchip calls a programmer that can do this a 'production' programmer. A programmer that does not have this capability is called a 'prototype' programmer, indicating that it should be used for development only, not for production work. The PICkit2 hardware has a limited ability for varying the supply voltage for the target chip (it can only regulate down from the voltage supplied by the USB connection, and its only reference is that voltage), and the current PICkit2 software uses this ability only to reduce the supply voltage to 3.3V for chips that cannot use a higher voltage. Hence the PICkit2 is called a 'prototype' programmer.

Whether this protype/production distinction matters for programming FLASH PICs, especially when the chip is powered by a 7805 regulator (which should limit the power voltage variations to a minium) is an ongoing debate.

4. What is a 'bootloader'?

Generally speaking a bootloader is a (small) program, which sole purpose is to load another program (the application) into memory (and probably to start that application). In the context of FLASH microcontrollers a bootloader is a program that can write an application program to the FLASH memory of the microcontroller (it can of course write only to the part of the FLASH that is not occupied by the bootloader itself). The PICkit 2 contains a bootloader that will takes control when the PICkit 2 is powered. When the bootloader does not find an application program already in FLASH, or it finds the PICkit 2 button pressed, it will remain in control. Otherwise it will pass control to the application program (the PICkit 2 firmware itself).

When the bootloader is in control it will blink the Busy LED.

5. How can I download/update the PICkit2 firmware'?

The PICkit 2 XP programn supplied by Microchip has a menu entry 'Download PICkit 2 OS firmware' under 'tools'. This will instruct the PICkit 2 application to pass control to the firmware and let you pick a .hex file to be downloaded.

If your PICkit 2 contains the bootloader but no application the bootloader will remain in control (the Busy LED will blink). When you start the PICkit PC program it will take some time during which nothing seems to happen (don't panic). Then a window appears that allows you to choose the application .hex file to download. This also takes ome time. Then the normal PICkit 2 application window will appear, but it shows a nonsense message about a strange firmware version. You can ignore that message.

6. The software in my PICkit 2 seems to be corrupt, what can I do?

If an application is present in the PICkit 2 but it is corrupted (or it is not the PICkit 2 firmware) you can not use the normal software update method. Instead you must plug the PICkit 2 in (USB cable) while pressing the button. This forces the bootloader to invalidate the application and take control. Now you can proceed as stated in the previous answer.

7. What is the purpose of that button?

The PICkit2 has a small black button right above the power LED. When it is pressed while the USB connection is made the bootloader will claim control instead of activating the PICkit2 firmware. This can be used to update a damaged firmware.

The PICkit2 hardware has two 24LC512 EEPROMs. With the current firmware these EEPROM are not used. With appropriate firmware (which to my knowledge does not yet exist) the PICkit2 could be used as a stand-alone programmer: use a PC to load the software update into the EEPROMs, drive to the device you want to update, plug the PICkit2 in, press the button, and the new software is programmed into the device. The device must provide power to the PICkit2, and the target PIC must be one that can be programmed with a Vdd-before-Vpp sequence.

8. Which USB driver do I need?

You don't need a special USB driver, the PICkit 2 uses the HID (Human Interface Device) driver that is part of Windows XP and most other modern OSes (Linux, OS/2, etc). This screenshot shows the PICkit2 device as shown by the XP device manager.

9. I get 'USB device not recognised', what should I do?

This problem is often reported by PICkit 2 users. I don't have a definitive solution, but some thing seem to help: