1
\$\begingroup\$

I have the circuit below using PIC16F627a, which should support ICSP (drawn in autocad instead of built in editor). IO pins which are not relevant to my question are omitted.

Outputs RB5 and RB6 have to be fed back to inputs RA5 and RA6 respectively. Those signals named 'reset' and 'inhibit' need to be combined with corresponding signals of identical units in two global signals for the whole system. All reset signals are logically ANDed, because all units have to agree on a global reset. Inhibits are logically ORed, because a single unit should be able to initiate this function.

As can be seen, 12V programming voltage would be fed back to output RB5 via diode D2, possibly damaging the PIC. To eliminate this danger, a 2k2 resistor R1 is included in the system, limiting the current that could flow back to RB5.

A similar concern may apply to IO pair RA6/RB6 but only when ICSP CLOCK voltage is low would RB5 be pulled to ground. I don't see any inherit dangers here, the diode used here is just to play it safe.

Will this simple solution applied to VPP eliminate the danger of getting 12V on RB5, destroying the IC?

enter image description here

Note: the additional units inside the cloud are to enhance to IO capacity of the system.

\$\endgroup\$
  • \$\begingroup\$ You are probably right. My electronics teacher was totally anti junction-dot. I probably got infected with this, too. \$\endgroup\$ – Bart Oct 21 '16 at 11:17
  • \$\begingroup\$ OK, junctions placed. \$\endgroup\$ – Bart Oct 21 '16 at 11:22
  • \$\begingroup\$ "As can be seen, 12V programming voltage would be fed back to output RB5". No, that can't be seen. It's not clear what exactly your circuit is trying to accomplish. \$\endgroup\$ – Olin Lathrop Oct 21 '16 at 11:29
  • \$\begingroup\$ @Olin: I enhanced the diagram. I hope it is more clear now. Because the system runs at 5V, anode D2 would be high with respect to it's cathode, thereby applying 12V voltage at RB5, a condition that I want to avoid. There is really not much to accomplish, it is just a system that requires outputs to be fed back to the inputs, and at the same time allowing ICSP. \$\endgroup\$ – Bart Oct 21 '16 at 11:58
  • \$\begingroup\$ Maybe I'm missing something. Why not eliminate the feedback to RA5 and RA6, eliminate the diodes at RB5 and RB6, put pull-up resistors on both of those. Then set-up RB5 and RB6 as open-drain outputs (the actual pin values can still be read). Make the reset logic active-high and the inhibit logic active-low. \$\endgroup\$ – Tut Oct 21 '16 at 13:24
1
\$\begingroup\$

2.2k will still allow quite a bit of current to flow and could push up the power supply rail on the chip.

I suggest using an NPN BJT wired-or rather than a diode to force /MCLR low (reverse the output logic on B5). I'm not sure the clock is an issue- it's not high voltage.

\$\endgroup\$
  • \$\begingroup\$ I indeed thought of using a transistor here and converting AND to OR, but I want to keep component count low. \$\endgroup\$ – Bart Oct 21 '16 at 11:55
  • \$\begingroup\$ What about using a larger resistor? Input impedance on the PIC is quite high, so there may be a lot of room for this. \$\endgroup\$ – Bart Oct 21 '16 at 12:02
  • \$\begingroup\$ You must have an unseen pullup on /MCLR so you have a ratio to worry about plus a diode drop. Plus using the protection network that way is not intended may have undesirable side effects. I sure wouldn't do it. Parts are cheap, trouble isn't. \$\endgroup\$ – Spehro Pefhany Oct 21 '16 at 12:09
  • \$\begingroup\$ There is a pull-up of 56k on MCLR, located at the top right of the schematic. A low voltage on RB5 will pull MCLR down to the diode forward voltage. As a sidenote, MCLR is disabled. The reset function is handled by the embedded program itself, because I need the input. If the diode forward drop is too high, I could use a Schottky. Actually the circuit has been built and tested satisfactorily, but I want to incorporate ICSP. \$\endgroup\$ – Bart Oct 21 '16 at 12:18
  • \$\begingroup\$ Push up the voltage, you mean through the body diode? Yes, that is what I am also trying to avoid. \$\endgroup\$ – Bart Oct 21 '16 at 12:34
1
\$\begingroup\$

You can't have your cake and eat it too.

From your comment of keeping component count low i assume your making a commercial product. In this case when the software is complete then all it has to be is loaded on chip before soldering. Many companies including DigiKey and Microchip themselves will sell you a chip loaded with your hex file. It is unlikely that you will have your customers field program the device.

If your looking to make a development platform to write the software then it won't have the same part count as the platform that is sold.

At best you can do is place a 0.1 in or 2mm header with a jumper in series with the reset line. Pull the jumper to isolate everything else from the VPP pin program or debug. Place the jumper back to run normally. You can also use a trace to connect across the jumper. This way the trace can be cut and jumper installed for development and for production just don't populate the jumper.

\$\endgroup\$
  • \$\begingroup\$ You are right, this is about a commercial product. That is also the reason I cannot be too specific about the purpose, I am not allowed to disclose this information yet. The first specimens of the PCB are going to be made by ourselves, but the idea is to later outsource the PCB manufacturing proces, including mounting of components. We then have the option of trusting our contractor with the program code, or flash it ourselves, the latter option requiring ICSP. \$\endgroup\$ – Bart Oct 21 '16 at 13:14
  • \$\begingroup\$ The jumper option is certainly something I have thought about before, but it leaves room for mistakes. Forget to remove a jumper prior to programming and we will have fried PIC for dinner. \$\endgroup\$ – Bart Oct 21 '16 at 13:17
  • \$\begingroup\$ @Bart Providing the manufacturer with the hex file is usually standard. The hex file is a binay and is difficult if not impossible to reverse engineer. Further slapping the manufacturer with and NDA is also standard. Depending on what chip package your using a socket that programs the chip out of circuit is also a good option. Program a batch of chips and then solder them down. The PM3 programmer has a number of attachments to do this. The risk of frying a chip with the jumper installed may be just something that you have to live with. \$\endgroup\$ – vini_i Oct 21 '16 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.