Skip to main content
Topic: Lightweight PicKit2 using USB serial LCD backpack or an UBW (Read 6659 times) previous topic - next topic

Lightweight PicKit2 using USB serial LCD backpack or an UBW

Hello,

I had to fully reflash my PicKit3 clone programmer and had no other programmer.

After spending a lot of time trying to use the BusPirate V4 PIC programmer (doc unclear of how to use it and which firmware and PC software to use. May be i missed something ...) i decided to go an other way.

Microchip provides on its site the PicKit2 source firmware and the hardware description, based on an 18F2550, is in the user's guide.

Then i decided to try to use the LCD backpack which has the same microcontroller as the basis for a lightweight PicKit2 programmer.
In fact, the LCD Backpack is a quite full PIC18F2550 breakout board with a 20 MHz quartz.

The standard PicKit2 programmer application can be used on the PC side.

Changes in the firmware :
- Locate the firmware just after the Diolan bootloader used on the LCD Backpack which is smaller (2kB) than the PicKit2 Microchip one (8kB)
- Invert the MClr polarity as we have a direct connection to the targer rather the one via a transistor in the PicKit2 glue
- Remove the Vpp regulation within the ISR (otherwise that generate an error as we do not have all the glue to generate Vpp)
- Un-comment the lines that setup a pattern at the end of flash that tells the firmware is loaded (otherwise it asks to reload the firmware and we don't want that)

As we don't have all the glue around the pic, we have some limitations:
- We can only program PICs in LVP mode as we don't have Vpp. That means the LVP config bit must be = 1 (default value of new chips). A PIC whose LVP config bit = 0 can only be programmed with a high voltage (Vpp), at least to erase the whole chip (and by the way the LVP config bit). Then take care not to program the LVP config bit to 0 if you want to be able to reflash it with this lightweight PicKit2.
- Only 5V PICs and those which are 5v tolerant on digital pins (see datasheets) can be programmed
- The target must use its own power supply as we don't have the glue to generate Vdd. For 5v PICs we can meanwhile use the LCD Backpack 5v (Vcc pin) to power the target
- PIC detection does not work as it requires the high voltage (Vpp) mode which is not available with this lightweight PicKit2. Then use manual mode (select the pic family then the device)
- In tools menu, set the "Use LVP program entry"

Connections with the target (ensure there is no incompatibility with your target hw) :

MClr/Vpp : LCD Backpack R/W pin connected to the target Vpp pin
PGD        : LCD Backpack D6  pin
PGC        : LCD Backpack D7  pin
Vdd        : LCD Backpack D5  pin, used only to sense the target Vdd
Gnd/Vss  : LCD Backpack Gnd pin
Aux        : LCD Backpack EN  pin, used to connect to the target PGM pin for some PICs (ex : target 18F2550 RB5 pin)

To install the lightweight PicKit2 firmware in the LCD Backpack, please follow the description in the LCD Backpack page :
http://http://dangerousprototypes.com/docs/USB_and_serial_enabled_LCD_backpack_firmware_updates
Just use the fw_update_32k.exe PC side software in place of the fw_update.exe as the lightweight PicKit2 firmware is larger than 24kB. You can find it in this post :
http://http://dangerousprototypes.com/forum/viewtopic.php?f=60&t=5301#p51274

I have used this programmer successfully with a few PICs : 12F1840, 18F2553 (with PGM RB5 pin), 24FJ64GA002, 24FJ256GB106 (Present in BusPirate V4 and in the PicKit3)

[attachment=0]

PicKit2 programmer application can be  downloaded from Microchip site :
http://http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit%202%20v2.61.00%20Setup%20A.zip

For some recent PICs such as the 12f1840, you must download a recent PicKit2 device library from the Microchip site :
http://http://ww1.microchip.com/downloads/en/DeviceDoc/PK2DFUpdate-1-62-14.zip

Note :
It is also possible to use this lightweight Pickit2 on an UBW hardware with a 20 MHz quartz whose bootloader (B) is also 2k.
To program it, please follow the instructions provided on the UBW site (replace the D firmware by the lightweight PicKit2 firmware)
http://http://www.schmalzhaus.com/UBW/
The cabling is :
MClr/Vpp :UBW RA5 pin of the 18F2550
PGD        : UBW RA2 pin of the 18F2550
PGC        : UBW RA3 pin of the 18F2550
Vdd        : UBW RA1 pin of the 18F2550, used only to sense the target Vdd
Gnd/Vss  : UBW Gnd pin
Aux        : UBW RA4 pin of the 18F2550, used to connect to the target PGM pin for some PICs (ex : target 18F2550 RB5 pin)


[attachment=2]
[attachment=1]

Re: Lightweight PicKit2 using USB serial LCD backpack or an

Reply #1
Thanks for sharing, this is really amazing!
Got a question? Please ask in the forum for the fastest answers.