ZEPPP : Zero External Parts PIC Programmer

A couple of months ago I was asked if I could prepare a sort of workshop on one of my favorite topics: ASM Programming for PIC microcontrollers, which I of course accepted on the spot.  Now, I wanted to include a couple of “hands-on” lab sessions in this workshop, and because of this, I needed a way for all attendants to actually work with real PICs that hopefully did not involve purchasing PIC-programming hardware in bulk for what is probably going to be a one-shot activity.

The Quest

Simple DIY programming circuits exists, and in fact, my first PIC programmer was a home-built “Enhanced” NOPPP (No-Parts PIC Programmer); a fully functional device that required only a couple of components (Not really “No-parts” but pretty close to it). The problem is that it used the PC parallel port (R.I.P), and required an external power supply. And this goes for pretty much every “classic” DIY PIC programming circuit; they all either require extra hardware or can no longer be used on current computers.

The main obstacle here is that PIC devices are normally programmed using HVP (High Voltage Programming), which involves using a voltage way above their regular operating level. This is part of the reasons they require additional hardware. In old designs this higher voltage was obtained normally from an external power supply or from highly-specific hacks that only worked on ports no longer available on PCs (*cough* RS232 *cough*). Modern designs use voltage-boosting circuitry, or still resort to external power.

But I know that several PICs support LVP (Low Voltage Programming) which means they can be programmed using only ~5V; greatly simplifying the required hardware. With this in mind I thought that it should be easy to make a cheap and “no-parts” (In the sense that requires no external components nor assembly) LVP PIC programmer using something like an Arduino.

Using Arduino also has many advantages; Compatible boards (especially “nano” and ” Pro mini”  variants) are not only widely available, but also quite cheap, and more than capable of handling all the handshake and 5V logic needed to program a PIC, with no extra components required. They are also quite popular, so chances are that any person interested in this project already has one.  They also connect to the computer via USB (well, a “comm” port managed by a USB-Serial chip, but still counts) so it should work for everyone with a computer manufactured after 1996.

More importantly, however, a bunch of Arduinos will still be useful to me after the workshop is over, and getting a dozen of them won’t be a problem.

Great, right?

Well, thing is…if you start looking for “Arduino PIC programmer” online, you’ll be greeted by a number of abandoned projects, solutions made for a family of PIC devices that are NOT compatible with the one I want to use, alternatives that require needless extra circuitry (like a custom Arduino shield or external power adapters … because HVP…duh), or slightly-related projects made for platforms so expensive that it doesn’t even make sense to even consider them an alternative for what I need (Yes, I’m talking about THAT one project that uses a RaspberryPi).

As none of the existent solutions worked for what I wanted, I decided to roll my own, focusing (at least initially) on the PIC I wanted to use for the workshop; The simple yet versatile PIC 16F628A.

Also, I thought this was a fun challenge to tackle and something I’d enjoy working on. I’ve done many tools for micro-controllers in the past, but this was my first dive into the hardware-specific side of the programming procedure.

The Result

Fast-forward through the couple of weekends several months working on this  (sorry, other projects got in the way), I’ve managed to make a firmware for Arduino boards that can program a handful of LVP-ready PICs using nothing but the Arduino board and a CLI (Command Line Interface) utility that communicates with it. The CLI was written in Java for portability, so it should work on Windows, Linux, OSX, etc.

Programming a PIC 16F628A with nothing but an Arduino nano and a PC.

It can currently program the following devices:

  • 16F87, 16F88
  • 16F627A, 16F628A, 16F648A
  • 16F873A, 16F874A, 16F876A, 16F877A.

More PIC devices can be added later I guess, but I reckon it won’t be a simple task; different families of microcontrollers support different programming commands and algorithms, and I’ve only implemented those supported by the microcontrollers above.

You can find both the firmware and the command line interface on my GitHub repo.

Usage

All the information to run this project can be found on the GitHub repo. And you can always run the command line utility without arguments to get a list of available parameters, but to further illustrate how truly “no external parts” this programmer is, this is how you would connect an Arduino Uno with ZEPPP to a 16F628A:

A 16F628A connected to an Arduino with ZEPPP

I’d say this is one of the “simplest” PIC programmers out there.

14 thoughts on “ZEPPP : Zero External Parts PIC Programmer

  1. Hello, i have a problem:

    Opening port COM4…
    Waiting 2000 ms …
    Detecting connected device…
    — Device Name: 16f628a
    — Device ID: 0x0083
    — Device Revision: 0x0005
    Reading input Hex file: GRI.hex
    Connecting to ZEPPP interface…
    — Interface detected: ZEPPP 1.0.0 20180630
    Erasing CHIP Memory…
    INFO: Selected PIC does not support the CHIP Erase command. All memory areas will be erased separately.
    Erasing Configuration and Program Memory…
    Erasing Data Memory…
    Writing User IDs…
    INFO: Verification skipped. ZEPPP does read-back verification for word-based writes.
    Writing PGM Memory…
    INFO: Verification skipped. ZEPPP does read-back verification for word-based writes.
    Writing Data Memory…
    INFO: Verification skipped. ZEPPP does read-back verification for word-based writes.
    Writing Config Words…
    INFO: Your code seems to disable Low-Voltage Programming. This won’t be saved in PIC memory!
    INFO: Verification skipped. ZEPPP does read-back verification for word-based writes.
    That took 7009 ms
    Can you help me?

    • Hi Max,
      Well, you can ignore most of the INFO output that is just telling you that the device cannot read back the value it just wrote for verification purposes (which means you’d need to add a verify step yourself after the write operations, if you want the code to be verified). However, the worrying part is the “Your code seems to disable Low-Voltage Programming. This won’t be saved in PIC memory!” Warning. That message appears when you are disabling LVP in the CONFIG word in your HEX file, and it tells you that the configuration will most likely NOT be written to the device because of that flag (Which is not something ZEPPP enforces. I believe that’s the behavior I observed in my tests; The PIC will refuse to write that word because of the flag). Make sure the CONFIG word you are setting in your code is NOT disabling LVP.

  2. Hi, i used this project and it worked very well at the first attempt. Thank you very much for sharing it! I have a bit of a problem right now though because I need the LVP disabled when the programming is finished. Is there a way to achieve this?

    Cheers,
    Chris

    • Sorry for the late reply, for some reason your comment was flagged by the blog as possible spam :/

      Glad to hear this programmer worked for you, at least initially.
      In theory the CLI exists LVP mode and resets the PIC after it’s done with all the specified operations so the PIC should no longer be in LVP mode when it’s done running the operations.
      If you meant disabling LVP (so it can’t be programmed again in Low Voltage Mode) after it’s done, then I don’t think it’s possible. From what I remember the PIC will not write a configuration word that disables LVP when using LVP to program the device. You’d need to do that with an HVP programmer.
      Would love to hear more about your setup and your use case, though, as I’m not quite sure what you meant.
      Regards,

Leave a Reply

Your email address will not be published. Required fields are marked *