2
\$\begingroup\$

I'm experimenting with PIC programming controlled by an Arduino Uno, and I'm using the PIC12F675. I actually got the PIC to enter programming/verify mode yesterday and was able to read out the device ID, but before that happened I actually burned off a PIC, but I'm not sure exactly what I did wrong.

The problem was related to the MCLR/VPP. In order to enter program/verify mode, this has to be driven to a high voltage (at least 3.5V higher than the power source) as part of a sequence of initialization events. So I connected the Arduino to a 12V power supply and used 5V to feed the Vdd on the PIC and the 12V to the MCLR (max is rated at 13.5V). At that point I thought that since the MCLR was the first signal to be driven high, I could simply tie it permanently to a high voltage source (12V). But after turning the board on, the PIC quickly became very hot and (as it turned out later) was burned out. The reason why I connected it directly without a resistor was that the programming specification (http://ww1.microchip.com/downloads/en/DeviceDoc/41191D.pdf ) said:

In the PIC12F629/675/PIC16F630/676, the programming high voltage is internally generated. To activate the Programming mode, high voltage needs to be applied to the MCLR input. Since the MCLR is used for a level source, the MCLR does not draw any significant current.

In other words, the high voltage input is not used as an actual power supply, it is just a way of signaling you want to enter programming mode. So I read the above (especially the "the MCLR does not draw any significant current") in the way that the PIC's MCLR PIN would have a high internal impedance and would thus not draw any significant current, hence it should not be necessary to provide any resistors etc. Also there's no note in the datasheet saying how much current you are allowed to transfer through any of the PIN's. But clearly that's not how it actually worked. Also earlier in the experimentation I was working with smaller voltages (8.5V) where I also connected direclty, and this didn't cause it to heat up so it can't just be a plain short circuit since then 8.5V should burn it out too.

Another question along the same lines: When connecting the analog PIN's of the arduino to the GP0/GP1 PIN's on the PIC, is it necessary to use resistors? Again, when the GP0/GP1 on the PIC are in input mode they should have high impedance, so I don't see why I could simply connect it directly to the Arduino. Now in this particular case, the data PIN (GP0) actually changes between input/output at specific points during programming and the Arduino has to do the same, so I guess one needs to be careful about changing at the same time so they are not both in the output state simultaneously (since that doesn't have high impedance). But to be sure I added some small resistors (470R) to limit how bad things can go. But it would be nice to know if this is really necessary, since again the datasheet doesn't say how much current you can transfer through the PIN's.

(in the new circuit I made that actually works I have 15K ohm between the 12V and the MCLR and I also control the MCLR through a transistor so I can turn it on at the right point in the sequence)

\$\endgroup\$
  • 1
    \$\begingroup\$ Could you check with a tester what voltage is giving the 12 V power supply when it is not loaded (i.e. open circuit)? If it is a wall charger you might have well above 12 V. \$\endgroup\$ – Roger C. Feb 1 '15 at 9:16
  • \$\begingroup\$ Hi Roger, with no load at all it reads 12.2V so there should be amble room up to the allowed 13V. But don't know if there could be transient spikes any way? \$\endgroup\$ – Morty Feb 1 '15 at 9:45
  • \$\begingroup\$ Also, another thing I've thought of: There's only 8 PIN's so all the PIN's has many functions in various situations. So I'm thinking, what if I failed to enter program/verify-mode for some reason and the PIC instead entered a state where the PIN was GP3 (which it can also be) in an output state, thus low-impedance? Since the output would be at a lower voltage (5V) the current might flow in the reverse direction due to the incoming 13V. I don't know if there's diodes internally in the PIC to protect against that when a PIN is in output mode? \$\endgroup\$ – Morty Feb 1 '15 at 9:46
  • \$\begingroup\$ @Morty I've become very interested in implementing my own programming solution with the UNO using a 12f683. What I would like to ask is, how are you performing the clocking on the chip and at what frequency? do you write to an arduino pin continuously ON and OFF? and also how are you transferring the actual hex file to the arduino? \$\endgroup\$ – AlanZ2223 Feb 4 '15 at 1:13
  • \$\begingroup\$ There is also someone who has successfully created a PIC programmer using an Arduino. He does not mention anything about the 12V supply except to reset the arduino before applying it. forum.arduino.cc/index.php?topic=92929.0 \$\endgroup\$ – AlanZ2223 Feb 4 '15 at 1:16
1
\$\begingroup\$

Not sure about your question about the burned out PIC and 12V MCLR but I can answer about the direct connection of the Arduino and the PIC GPIOs. If both are running off of the same power supply and your software in both is flawless, then there should be no issues with a direct connection.

However, I personally always connect them with resistors to limit the damage cause by software bugs and/or timing issues because there will inevitably come a time were I messed something up in the software and the resistor give's me the time to realize that I have a bug before something gets damaged.

\$\endgroup\$
  • \$\begingroup\$ Hi Mathieu, what type of software bugs would it be that could wreck havoc if the resistors aren't there? Would that be having them both in the output state at the same time for instance? \$\endgroup\$ – Morty Feb 1 '15 at 14:55
  • \$\begingroup\$ Yes for example. Another software issue that could burn a controller is a timing issue. For example: With controllers A and B, A sets high impedance 100ns after B drives the pin; for 100ns, the pin is beeing dual driven and overloads one or two output transistors. \$\endgroup\$ – Mathieu L. Feb 1 '15 at 18:02
1
\$\begingroup\$

To address your statement about the datasheet not specifying how much current each PIN can source/sink, section 12: Electrical Specifications, of the data sheet gives the maximum source/sink of any pin at one time as 25mA, and the sum of PIN currents cannot exceed 125mA.

As for the MCLR question, I have done similar projects in past, with a voltage of 9V, and never had a problem, much like yourself.

\$\endgroup\$
  • \$\begingroup\$ Thanks but I think it is unclear is these are what you can expose the device to or what it will draw itself. For instance, in the same table it says "Maximum current into Vdd pin" = 250 mA. Does that mean I can't connect Vdd directly to a 5V power source but have to put a resistor in to limit the current to below 250 mA? I thought the chip would control how much it sucks in that case. Right now I don't have such a resistor and it's not hot at all so seems to be limiting the current itself. \$\endgroup\$ – Morty Feb 1 '15 at 20:36
  • \$\begingroup\$ Also it would be tempting to take the working setup I have now and try to connect the PIN in question directly to 12V to see if that was really the cause, or if it could have been something else. But I don't want to ruin another PIC just to find that out ;) \$\endgroup\$ – Morty Feb 1 '15 at 20:37
  • \$\begingroup\$ In general, you do not want to put a current limiting resistor on your VDD supply pin, this is very power inefficient and could lead to operating instability. If you place a resistor between your 5V power supply and the VDD pin, as the current the device needs increases, the voltage drop across your limiting resistor increases, leaving less voltage for the PIC, and the PIC will see a changing VDD voltage. This could lead to strange operating behavior and should be avoided. \$\endgroup\$ – dataBus Feb 2 '15 at 2:20
  • \$\begingroup\$ The PIC will draw from the power supply only what it needs. Therefore, it should only exceed its current limits if you make a mistake. For example, if you drive an output pin high (say 5V) and short it to ground, with only resistance through your bread board (say 1 ohm) the pin will attempt to drive 5 A. Because the pin is attempting to use 5A, the VDD pin attempts to get 5A for it. Something will melt, and soon. Since all mistakes show up at the VDD pin, and we dont want a resistor there, the best protection is a fuse of some type. \$\endgroup\$ – dataBus Feb 2 '15 at 2:27
  • \$\begingroup\$ dataBus: Thanks that was my impression as well that you don't need to take care of VDD specifically. By the way, wondering if you could answer the following: What if I have to different IC's powered by different power supplies (with each their own grounds). How does that even work, because the power from the one IC (originating from one power supply) will go to the ground of the other? And what if the ground level isn't the same - it could be that there's a difference in potentials between the grounds even before starting? Should the two grounds be attached to avoid that? \$\endgroup\$ – Morty Feb 2 '15 at 6:30
0
\$\begingroup\$

Since you hard-wired the power lines, it is possible that the 12 volts appeared before the 5 volts did. I can't find anything in the datasheet that specifically addresses applying Vpp at power-on, but it's clear from their discussion about going into program mode that they expect the chip to be already powered before bringing MCLR to Vpp.

If something goes wrong in a power up sequence, the chip could "latch up", at which point Vdd will happily burn the chip out without any help from Vpp. This includes powering the Arduino (and driving some PIC I/O pins) before applying power to the PIC itself.

not draw any significant current, hence it should not be necessary to provide any resistors

The fact that it will not draw any significant current means that some resistance placed in series will have negligible effect on the voltage at the pin. This is somewhat opposite reasoning to yours. For some reason people tend to associate "no current" with "no resistance".

\$\endgroup\$
  • \$\begingroup\$ Actually on the timing diagrams they have two modes to enter program/verify mode and you are supposed to apply 12 V before Vdd for Vpp mode \$\endgroup\$ – AlanZ2223 Feb 4 '15 at 1:18
  • \$\begingroup\$ Actually in the current setup where everything is working, I cut off both Vdd and MCLR and then apply MCLR for a whlie and that doesn't cause problems. But I think there could have been some problem (don't know specifically what) that caused MCLR to be an output PIN, and the low impedance would cause the 12V to flow in unrestricted. I'm also not sure about your commeont on low resistance vs low current. If the datasheet says it draws low current this to me indicates it is self-limiting i.e. not required to be limited externally. Otherwise it isn't a characteristic of the chip. \$\endgroup\$ – Morty Feb 4 '15 at 5:55

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.