3
\$\begingroup\$

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.

\$\endgroup\$
  • 2
    \$\begingroup\$ See this example of someone physically cutting off part of an MSP430 microcontroller, including its power pins, and still operating it: blog.greg.so/2012/01/making-6-pin-msp430-value-line-device.html \$\endgroup\$ – Anindo Ghosh Mar 22 '13 at 4:11
  • \$\begingroup\$ @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. \$\endgroup\$ – Kaz Mar 24 '13 at 3:56
  • \$\begingroup\$ @Kaz I just checked, the link works for me. Else, this Hackaday link should lead you there. Hack a day. How appropriate. \$\endgroup\$ – Anindo Ghosh Mar 24 '13 at 4:03
  • \$\begingroup\$ 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! \$\endgroup\$ – Kaz Mar 24 '13 at 5:20
  • \$\begingroup\$ @AnindoGhosh a better link would have been hackaday.com/2011/09/26/barebones-pic-rfid-tag A pic powered via gpio, from a rfid inductor only. Completely wireless :D \$\endgroup\$ – Passerby Apr 22 '13 at 15:04
8
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Adam Lawrence Mar 22 '13 at 16:03
  • 1
    \$\begingroup\$ @Madmanguruman - that might prevent the program from running, but it won't resolve the electrical concern. \$\endgroup\$ – Chris Stratton Mar 22 '13 at 16:41
  • \$\begingroup\$ I didn't imply that it did. I merely suggested a way of stopping the code from running. \$\endgroup\$ – Adam Lawrence Mar 22 '13 at 17:27
  • 1
    \$\begingroup\$ 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? \$\endgroup\$ – mFeinstein Mar 23 '13 at 22:03
  • \$\begingroup\$ @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. \$\endgroup\$ – Connor Wolf Mar 24 '13 at 3:28
2
\$\begingroup\$

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.

\$\endgroup\$

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.