PDA

View Full Version : Flash PIC16F688 In-Circuit



dirknerkle
04-06-2010, 10:13 PM
With the new Renard Start_Addr firmware, I thought it might be helpful to come up with a way to flash the pic while it was on the board. My thinking was that there would be less wear-and-tear on the chip itself, since those little pins can bend pretty easily.

I cobbled together this solution. I had an old 16-pin test clamp, and I took a piece of cat5, soldered some connectors to wires on both ends, plugged it into my PIC programmer and then clamped it onto the 16F688 in my SS24 when the SS24 was NOT powered up. I was able to read the chip, erase it and reflash it very easily.

The closeup of my PIC programmer shows the ICSP header pins, and after a little research, I tried the following, which seemed to work fine for the 16F688 chip. Reading the PIC programmer's pins from left to right:

LOW - no connection
PGC - to pin 12 (RA1/ICSPCLK)
PGD - to pin 13 (RA0/ICSPDATA)
GND - to pin 14 (VSS)
VCC - to pin 1 (VDD)
VPP - to pin 4 (RA3/MCLR)

This was just a test to check for feasibility and it worked out very well. Now the task is to make a more permanent connector and cable, and hopefully one that isn't as stiff as the cat5.

ErnieHorning
04-07-2010, 12:03 AM
I made one similar except for surface mount. I used flat 6 wire CAT3 cable soldered directly to the clip strain relieved it with 5 minute epoxy. My programmer uses a 6 pin RJ11 connector. I usually make these about a foot long because it seems to be the most manageable length.

I made one that was two feet long and it worked without issue but I found that it easily got caught on everything.

Matt_Edwards
04-07-2010, 02:31 AM
Great solution to an awkward problem.
I also use both:

8 pin DIL for Tiny13 in my Ikea Mood lights
20pin Soic for my RGB Kittys.

The 3M clips have a strong spring in them and after programming 50 chips your fingers get sore, and the push on terminals break. I end up soldering them.

The Blue T&B clips are easier to use.

mrpackethead
04-07-2010, 04:38 AM
I don't know why the ISCP header was never put on the renard boards.. I always put it on any boards i design, just leaving the pads, and not even putting a plug in.

ErnieHorning
04-07-2010, 09:50 AM
I don’t bother with the ISCP header on any of the boards I make for myself. For something that’s seldom or never used again, I don’t find the extra space necessary.

If I was going to make a lot of boards that I would be changing a lot, I would just make a fixture with pogo pins. Since I have the CAD files, it’s nothing to make a drill plot for the pin locations. I usually use a CNC machine to make such a fixture, but I’ve also just printed the locations and used it as a template for hand drilling.

I guess it’s all in what you like, have always used or what you feel is necessary.

djulien
04-10-2010, 09:18 PM
The closeup of my PIC programmer shows the ICSP header pins, and after a little research, I tried the following, which seemed to work fine for the 16F688 chip. Reading the PIC programmer's pins from left to right:

LOW - no connection
PGC - to pin 12 (RA1/ICSPCLK)
PGD - to pin 13 (RA0/ICSPDATA)
GND - to pin 14 (VSS)
VCC - to pin 1 (VDD)
VPP - to pin 4 (RA3/MCLR)

This was just a test to check for feasibility and it worked out very well.

Will that work with more than one PIC on the board? for example, if there are multiple PICs that are sharing VSS, VDD and RA3, do you need to make sure that VPP only goes to one of the PICs while it is being flashed?

don

dirknerkle
04-10-2010, 11:46 PM
Will that work with more than one PIC on the board? for example, if there are multiple PICs that are sharing VSS, VDD and RA3, do you need to make sure that VPP only goes to one of the PICs while it is being flashed?

don

It's a good question. I think the best idea is to flash the chip with the board powered off. Pins 12 and 13 are not shared by any other PIC and I believe that's enough to keep it local to the PIC in question.

But you have piqued my curiosity... I'll have to give it another test. ;)

EDIT: I reflashed the 1st PIC on an SS24 with the diagnostic code (so I could tell the difference) and it flashed only the chosen PIC and nothing down the line.

djulien
04-11-2010, 02:26 AM
I think the best idea is to flash the chip with the board powered off.

I was looking at a board where the VSS pins were all on a common trace and the VDD pins were all connected with another trace, so if one PIC had power then they all would. In that case, is there a distinction between one PIC having power vs. the whole board having power?


Pins 12 and 13 are not shared by any other PIC and I believe that's enough to keep it local to the PIC in question.

But you have piqued my curiosity... I'll have to give it another test. ;)

EDIT: I reflashed the 1st PIC on an SS24 with the diagnostic code (so I could tell the difference) and it flashed only the chosen PIC and nothing down the line.

Thanks for checking that! I have a board with multiple PICs on it that I was trying to fit in a 2-pin header on the VPP line that could be shunted or not, but if that is not needed then that will make the ICSP connections simpler.

don

budude
04-11-2010, 02:52 AM
The MCLR line (pin 4) is also required for programming but since it is tied together on most Renards (it's the ZC input) you will hold all the PICs in reset mode at the start of programming. Since the ICSPCLK and ICSPDATA lines (pins 12 and 13) are separated from each other this should allow you to program each PIC separately. This is how I am planning to program my boards that have 6 PICs on them since I did not want to tie up space/cost for an ICSP header for each.

BF210
04-11-2010, 01:22 PM
The next question is whether the programmer (PICkit or similar) has enough current available to hold all the PICs (8 for Ren64XC) at Vpp, plus power the whole circuit through Vcc. On some boards the programmer might see the PIC, a diagnostic LED, and an opto coupler load on the clock and data lines.

But this ain't NASA, so try it and see what color the smoke is.
(yet another Don)

pblais
04-11-2010, 10:09 PM
The next question is whether the programmer (PICkit or similar) has enough current available to hold all the PICs (8 for Ren64XC) at Vpp, plus power the whole circuit through Vcc. On some boards the programmer might see the PIC, a diagnostic LED, and an opto coupler load on the clock and data lines.

But this ain't NASA, so try it and see what color the smoke is.
(yet another Don)

I use my ICD programmer/debugger

Pierre