3

If I connect the Rx pin of my PIC18F2550 and GND to another already powered-on circuit, the PIC turns on and starts running code. There is nothing in the datasheet preventing this. Is this normal?

PS: Rx and SDA are connected toghether, but still the PIC shouldnt turn on at all.

mFeinstein
  • 4,333
  • 13
  • 47
  • 85
  • 2
    See this example of someone physically cutting off part of an MSP430 microcontroller, including its power pins, and still operating it: http://blog.greg.so/2012/01/making-6-pin-msp430-value-line-device.html – Anindo Ghosh Mar 22 '13 at 04:11
  • @AnindoGhosh What if you expose it to daylight, or garlic? If that doesn't help, it may be necessary to drive a little nail right through the center of the die. The link doesn't work, BTW. – Kaz Mar 24 '13 at 03:56
  • @Kaz I just checked, the link works for me. Else, this Hackaday link should lead you there. Hack a day. How appropriate. – Anindo Ghosh Mar 24 '13 at 04:03
  • I am getting "Firefox can't find the server at blog.greg.so". Maybe addresses in the Somalia TLD do not resolve from where I am. Oops! – Kaz Mar 24 '13 at 05:20
  • @AnindoGhosh a better link would have been http://hackaday.com/2011/09/26/barebones-pic-rfid-tag/ A pic powered via gpio, from a rfid inductor only. Completely wireless :D – Passerby Apr 22 '13 at 15:04

2 Answers2

8

You are parasitically powering your IC through the protection diodes on the Rx IO line.

I'm assuming you have voltage on the Rx line (presumably 3.3V or 5V). This is getting into the PIC Vcc through the protection diodes on the IO pins.

From the PIC18F2550 datasheet:

I/O pins have diode protection to VDD and VSS.

There's not much you can do about this, and having any current flow through the protection diodes is a bad idea (they're not intended for this). You will have to modify your circuit to prevent voltage from being present on any of the PIC pins when the PIC is not powered.

If you can't prevent voltage from being present on the PIC IO lines when it's unpowered, you should clamp the Rx line to Vcc and Gnd with shottky diodes. Since the diodes in the PIC are constructed on the silicon die in the MCU, they are plain-old silicon diodes, with a \$V_{F}\$ of ~0.6v. Since the clamp diodes are schottky, they will begin conducting before the internal diodes on the PIC, so the MCU will be safe.

Of course, if the source driving the Rx line can source enough current to power your whole circuit, you'll wind up simply powering your circuit this way. To compensate you'll need to add a series resistor inline with the Rx line.

Connor Wolf
  • 32,168
  • 6
  • 79
  • 138
  • One way to control the PIC power-up is by _MCLR. If you were to monitor VDD with an external circuit and pull up _MCLR only when VDD reaches a certain threshold, you effectively have controllable brown-out and can set the detector so that the parasitic VDD (one diode drop low) can be ignored. – Adam Lawrence Mar 22 '13 at 16:03
  • 1
    @Madmanguruman - that might prevent the program from running, but it won't resolve the electrical concern. – Chris Stratton Mar 22 '13 at 16:41
  • I didn't imply that it did. I merely suggested a way of stopping the code from running. – Adam Lawrence Mar 22 '13 at 17:27
  • 1
    Thanks for the answer. I am just using the Rx line to debug the system, but maybe there will be a seria connection on the final project. If I make a clamping circuit the way you said, wont I be short-circuting the connected circuit? I will be protecting my MCU but still destroying the other cirtuit, connected to Rx. Maybe a 10K resistor in series will do? It will limit the current, but I think it will still power the PIC right? – mFeinstein Mar 23 '13 at 22:03
  • @mFeinstein - You are correct. A series resistor would be needed. I updated my answer. I was distracted thinking about how to protect the IC pins, not how to address the problem you were having. – Connor Wolf Mar 24 '13 at 03:28
  • It's not like the diodes are shorted to the power supply; there is a series resistance which limits current, namely the PIC itself. There are steps you can take to reduce its current consumption below 1 mA. Run it on a slow clock rate, avoid sourcing current through pins/peripherals, etc. – Kaz Mar 24 '13 at 05:39
  • @Kaz - Uh... that's exactly what's happening. Some external source is driving the IO lines of the PIC. The internal protection diodes are going conducting, and as a result, the PIC (and any components it shares a power rail with) are being powered through the diodes. – Connor Wolf Mar 24 '13 at 07:31
  • @ConnorWolf Yes, which means that the device is limiting the current through the diodes via its current draw. It can be configured and operated in ways such that the current is only somewhere in the hundreds of microamperes. Maybe the diodes can deal with such small currents. – Kaz Mar 24 '13 at 09:58
  • @Kaz - I think I see what you're saying, it's just an odd way of saying it. Basically, the device is drawing so little current, that the diodes may be ok. Saying it's limiting the current (at least to me) indicates it's taking an active role in not drawing too much current, which is not the case here (I could be reading too much into your statement). Also, we don't know what other devices are connected with the PIC, so assuming the power draw is just the PIC power consumption is not a good idea. – Connor Wolf Mar 24 '13 at 11:03
  • Guys I believe the whole problem is not the diodes burning out...but the system operating when it shouldnt...if there is no power, the system is supposed to be turned off, since this can lead to erratic behaviour. Saving the diodes is fine for sure, but I think the problem is how to to avoid the PIC powering up itself, understand? – mFeinstein Mar 25 '13 at 04:20
3

An alternative approach is to use a pull-up resistor on the Rx pin - I find 100k adequate - and a reverse diode in the serial line. This is indeed the only approach I have found to work consistently; symptoms of a device being powered through the substrate diode include random or unreliable resets as well as unexpected voltage levels and the OP's symptom of unexpected operation. It should be remembered that most if not all pins have these protection diodes and that the problem is not restricted to the serial ports.

When the incoming Rx line is high - i.e. idle - the series diode is reverse biased and blocks the substrate diode in the PIC; the PIC is powered only by its own supply, if present. When the PIC is powered the pull-up ensures that it sees the idle condition on the line; when the Rx line goes low that forward biases the diode and drops the Rx input to about 0.6v; well below the logic zero level in most cases.

Similar problems occur when parts of the circuit have to work at different voltage levels.