Wednesday, October 19, 2016

(Almost) Free PIC Programmer (with limitations)

Microchip has made a $10 PIC board to showcase their online IDE, MPLAB Xpress. The board is called the... MPLAB Xpress Board. (Consequence: unhelpful search results!) How do you make it so an online IDE can program your PIC part? Make the programmer look like a USB mass storage device. Now you can (theoretically) use it on any computer the Internet.

I was lucky and was able to snag one of these board for free! They gave away 2000 of them. Free? I can't pass that up. I had never used PIC and never had any real interest. (8-bit? Pffft! But they do have DIP packages...) Did that stop me from getting something for free? No. No it did not. Well after playing with it and looking into all the neat peripherals that PIC parts have, I decided to make this board more useful. I would have put some pin headers on to be able to separate the programmer from the on-board target device but they didn't ask for my input (weird, right?). But they did put some breakout pads on the back of the board (which are pointed out in that linked-to Hackaday article). Obviously we can't have the programmer trying to program two chips at once. So I took the matter of cutting traces into my own knife-wielding hands. I just need to cut right here...

Oops. Wrong spot. (I may get a little impatient when I'm excited to try out an idea.) Actually right there would be better.

Too late now. Two of those five pads are disconnected because I didn't think twice. Luckily some current-limiting resistors provided a nice alternative place to solder some wires to. Crisis averted. A little hot glue to give some mechanical support to my wires and now I have a free PIC programmer!

The firmware for the programmer side is available on GitHub. Here's one drawback listed in the README: "The programming algorithm is currently supporting only the new 8-bit LVP-ICSP protocol common to the PIC16F188xx (5 digit) devices. It is also assuming a fixed row size of 32 words." So... that's a pretty small subset of devices you can program with this. (I count 7 parts that are PIC16F188xx. You want me to read datasheets to figure out if there's more? No thanks. (Okay. I looked at the PIC16F18325/45's datasheet. I'd guess it's compatible based on row size. But no more!)) But I got it for free so I'm not going to complain. And even if they update the firmware source, how am I supposed to update my programmer? (A PICKit 3. But if I had that...)

I even tried it out on a DIP packaged PIC16F18855. It works great! The programmer also has the necessary pull-up resistor for the MCLR line so you can program the chip all by itself in your breadboard.

It's not running in the picture but that LED will blink.
Those wires go to my hacked programmer.

Eventually I'm going to use my PIC16F18855 to drive a strip of WS2812B LEDs. That'll be for another post.

Other links:
MPLAB Xpress forum (for both the IDE and the board, I guess)
Board Schematic