Embedded Systems and Power Electronics

Total Pageviews

About Me

My photo
I am currently a PhD student at UC Berkeley, following a 6-year journey working at Apple after my undergrad years at Cornell University. I am a 2025 Paul & Daisy Soros fellow. I grew up in Dhaka, Bangladesh where my interest in electronics was cultivated, resulting in the creation of this blog.

BTemplates.com

Powered by Blogger.

Dec 5, 2026

Prog1454: Building a stripped-down PICkit2 clone


 

Fig. 1 - The programmer (left) connected to a PIC16F72 (right)

Background

While cleaning up my parts bins, I stumbled upon this small, low-cost PIC programmer board (shown in Fig. 1) I had developed a few years ago. The corresponding software was custom-designed and communicated over USB to load the firmware onto the target PIC. It is similar in spirit to the Quick and dirty PIC16F72 programmer with the Pico.

The schematic for the programmer is shown in Fig. 2. The brains of the circuit lie within the PIC16F1454. The other key component is a 5V-to-13V boost converter, centered around the TLV61046 part. A simple discrete boost converter such as that used in the Pico-based programmer (Quick and dirty PIC16F72 programmer with the Pico ~ Tahmid's blog) could be used instead here too. Other than that, the circuit contains a few discrete components. A lot of the programming hardware has been simplified since the goal was to only program a handful of parts rather than build a universal programmer like Microchip's PICkit.

Fig. 2 - Schematic for the programmer.
Drawn using Electrikz: https://people.eecs.berkeley.edu/~nageshpatle/electrikz/
Huge shoutout to Electrikz, which is beautiful and incredibly easy-to-use and combines the best features of all the drawing/ECAD tools I've used so far. I would highly recommend it to anyone for drawing figures, especially for circuits!

This got me thinking: instead of having custom software for the programmer, could I interface with Microchip's own? I had previously built a PICkit2 clone using the PIC18F2550, which is the main microcontroller in Microchip's design. There are designs for many such clones available online using Microchip's firmware for the PIC.

What would it take to turn this little programmer into a stripped-down PICkit2 clone? I couldn't find one online using a small low-end MCU like the PIC16F1454 and thought this would be a fun little project to get this going.

I have also been seeing a lot of content online about AI-assisted hardware and firmware designs, and this seemed like a fun opportunity to see what the hype is all about too. Fortunately, Microchip has released the source code for the PICkit2 software, which you can find from their MPLAB Development Ecosystem Downloads Archive. I used the PICkit 2 software for Windows Source v2.61.

Architecture

I started with two questions for this implementation.

1. How does the PICkit2 application communicate with the hardware? This can be replicated by looking at its behavior from Microchip's provided sources.

2. What compromises have to be made to implement the programmer on the PIC16F1454, which is smaller than the PIC18F2550. For comparison, the former has 14KB (8K words) of program memory and 1KB of RAM compared to 32KB and 2KB for the PIC18F, respectively.

The main architectural difference lies in the script execution. The original PICkit2 application sends device-specific scripts containing instructions for how to manipulate the GPIOs to shift data out, as well as for delays and loops. These are loaded into the programmer's RAM and interpreted when requested. Additionally, the firmware also reserves RAM buffers for downloading data from the PC to the target, as well as uploading data from the target to the PC. The original PICkit2 reserves 768 bytes of RAM for the downloaded scripts. These are shown in the table below.

Buffer RAM
Downloaded scripts 768 bytes
Download data (PC → target) 256 bytes
Upload data (target → PC) 128 bytes
Total 1152 bytes

These buffers alone require more RAM than is available on the PIC16F1454. So instead, the following scheme is used.

1. Look at the scripts downloaded for the target microcontrollers of interest (for this project, I decided on the PIC16F72 and the PIC16F877A).

2. Implement equivalent routines in the PIC16F1454 firmware and keep a catalog of the supported scripts in flash. When the PICkit2 software downloads a matching script, store only its catalog index in RAM and call the corresponding routine when execution is requested.

3. Use a shared 256-byte buffer for both download and upload. Fortunately, the PICkit2 doesn't really simultaneously use both download and upload buffers for these target microcontrollers, except the one special case for the application's communication check. This is easily handled by returning data from the same buffer.

The downside of this scheme is that we no longer have a general interpreter which has commands loaded from the PICkit2 software. Adding additional scripts consumes flash on the PIC16F1454, which doesn't have much to spare to begin with. In fact, I am almost out of flash supporting just these two microcontrollers now. You can see in Fig. 3 below that I'm already using 91% of the flash and 73% of the RAM.


Fig. 3 - Memory usage for the PIC16F1454

A couple of other things worth mentioning. The PIC16F1454 doesn't have an ADC, so I'm not measuring the VDD and VPP in the circuit. The voltage readings returned to the PICkit2 application are synthesized, instead of being real measurements. Additionally, this circuit does not have any switches/transistors inline with the VDD line, so power is always applied to the target microcontroller. I added U103 and U104 to allow turning off the higher-voltage VPP and for actively pulling it low, but the voltage is fixed by the 13V boost converter. Similarly, there is no ability to tune VDD.

Results

I think the trade-offs outlined above make for an interesting project and are why I am calling this a "stripped-down PICkit2 clone". And it actually works!

You can get the firmware here: https://github.com/SyedTahmidMahbub/Prog1454

The PICkit2 software can recognize the programmer, detect the connected PIC16F72 (Fig. 4), and successfully program it (Fig. 5), read back from the target microcontroller and verify that the programming was done correctly. I don't have a PIC16F877A on hand to test, but the firmware was developed to support programming its flash and EEPROM contents.

Fig. 4 - PICkit2 software recognized the programmer and detected the connected PIC16F72


Fig. 5 - PICkit2 software successfully programmed the connected PIC16F72

Conclusion

So, there we have the stripped-down PICkit2 clone with the PIC16F1454. It's no replacement for a proper programmer, but it is a fun exercise, nonetheless. And I finally found another use for this hardware that has been collecting dust in my parts bin.

I want to quickly touch base on the chicken-and-egg problem here. You still need a programmer to program the PIC16F1454 in the first place. If you don't have a programmer on hand, you can't build this programmer. And if you have a programmer on hand, why do you need to build this programmer? If you need multiple programmers, you can build these for super cheap. You can also customize them for batch programming or to serve some unique application-specific need. For flashing the PIC16F1454, I used my old PICkit3 programmer. I learned that I had to install MPLAB X v6.20 to use the PICkit3, since newer versions have dropped support for this old piece of tech.

I also want to conclude with two points of reflection.

1. This is not the first or second or even third programmer I've talked about in my blog. Why do I like building these? Firstly: I think they're fun. They're simple enough to build fairly quickly but still have enough complexity to learn something new or build something useful. They are also easy and quick to verify and exercises a different line of thinking than what I do in my day job.

2. This is targeting microcontrollers that are fairly ancient. Why? First - there's nothing stopping you from taking these ideas and implementing them on a newer microcontroller yourself. Second - these microcontrollers are still supported by Microchip and are used by many people globally in many low-cost applications. I also find tinkering with these older parts sort of like retro-gaming, with all their limitations, quirks and charm. It's still pretty cool to see what you can build with so few resources.

Disclosures

AI usage disclosure: I used OpenAI's Codex to analyze the PICkit2 protocol from Microchip's source and to help develop the compatibility firmware. I set the requirements, defined and chose the architecture, designed the hardware and performed the testing. The writeup in this blog post is my own.

Disclaimer: This is an independent educational project exploring the implementation of a PICkit 2-compatible programmer using the PIC16F1454. It is not affiliated with, endorsed by, or supported by Microchip Technology Inc. PICkit is a trademark of Microchip Technology Inc. All third-party software and documentation remain subject to their respective licenses.

0 comments:

Post a Comment