Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC switched off - Bus signal on I/O pins?

Status
Not open for further replies.

-=Hulk=-

New Member
Hello

As you know, if a PIC, or in general a CMOS chip, has no power supply connected, the maximal voltage allowed on its I/O is limited to ~0.3V.

But how to handle a PIC (with no power supply connected) with an USB bus or SPI bus attached to another device????

Ok, one solution would be to use the USB power supply to supply current to the PIC, so that the USB D+ and D- couldnt harm the I/O pins.

But imagine, the power supply needed exceeds the max 500mA of the USB?

What would be the solution to protect the I/O pin?


Thank you!
 
One solution would be a resistor in series. But for high frequency signals it will not work very well. You can also use a buffer on the powered side, or TI makes some buffers that will tolerate being upowered and connected to outside voltage. Im not sure how that would go with USB, maybe the USB specs or chip specs have something to say about it?
 
That is what most chips contain, but that leaves the I/O pin powering the unpowered circuitry which can´t be good.
 
It helps prevent latch-up. I also thought that protection existed in all PIC's, but on searching with Google, I found several threads (mostly on EDA Board) dealing with PIC latch-up.

John
 
Hello

As you know, if a PIC, or in general a CMOS chip, has no power supply connected, the maximal voltage allowed on its I/O is limited to ~0.3V.

But how to handle a PIC (with no power supply connected) with an USB bus or SPI bus attached to another device????

Ok, one solution would be to use the USB power supply to supply current to the PIC, so that the USB D+ and D- couldnt harm the I/O pins.

But imagine, the power supply needed exceeds the max 500mA of the USB?

What would be the solution to protect the I/O pin?

No solution required, as I don't believe there's any problem that requires solving?, and certainly nothing that needs to 'protect' the input pins.

The main concern would be because of the protection diodes, which will power the PIC (and any connected circuitry) through the diode if you apply power to the input pin, but sensible choice of a current limiting resistor would prevent that. It's really a question of the design choices you make, USB isn't really a problem - either power the PIC from the USB, or the USB from the PIC, so no conflict can exist.
 
How about using a steering diode to shunt pin voltages greater than the applied Vdd to the power pin as shown in these application notes:

https://www.electro-tech-online.com/custompdfs/2013/01/00763c.pdf
https://www.electro-tech-online.com/custompdfs/2013/01/msan107-appnote.pdf

John
Thank you very much.
Those PDFs are very interesting.

I have a question.
I only need to protect the IOs, if and ony if the power supply is NOT plugged in. Right?

If the external power supply is not plugged in, the power circuit is open (no ground). How can the voltage that comes in from the outside through the IO power up the ICs???? It won't. Right?

The IO protection is only needed if the ground is connected to the external power supply (and the voltage regulator output switched off).
Right?

(I'm a noob in electronics :D )
 
Please re-read posts #5 and #6. The real question is do you need it? Has someone told you that you need additional protection?

As I mentioned (#5), if you search on PIC latch up, you will fine it discussed. However, considering the huge number of PIC's in service, that problem may be quite infrequent, as Nigel suggests.

John
 
If the external power supply is not plugged in, the power circuit is open (no ground). How can the voltage that comes in from the outside through the IO power up the ICs???? It won't. Right?
Actually it will power the supposedly unpowered ICs, because almost all chips have these protection diodes built-in. That is why you need a resistor in series or some other way to make it work. Also these diodes won´t survive much current (typically 20mA or something similar) so you can destroy the chips this way if the remaining load is high.
 
I only need to protect the IOs, if and ony if the power supply is NOT plugged in. Right?

If the external power supply is not plugged in, the power circuit is open (no ground). How can the voltage that comes in from the outside through the IO power up the ICs???? It won't. Right?

You need to be far more specific - we can't comment on your exact question unless we know what it is?.

However, there's rarely any need for anything extra to normal PIC practices, which are mostly common sense.
 
However, there's rarely any need for anything extra to normal PIC practices, which are mostly common sense.
pic are not that easy to break and the D+ and D- are data pins not power pins. The in current is in Microamps so is SPI

There is no clamping diodes on the D- and D+ pins just pullup's look at the data sheet.
 
Last edited:
Please re-read posts #5 and #6. The real question is do you need it? Has someone told you that you need additional protection?
The datasheet (of every CMOS Chip, it's inherent to the CMOS technology) told me that :D

Max voltage on I/O pins: -0.3V to VCC + 0.3V

When Vcc = 0 there can be max 0.3V on the I/O pins.

Actually it will power the supposedly unpowered ICs, because almost all chips have these protection diodes built-in.
Ok I will try it. Serial resistors + clamping diodes. ;)
I only have to take care that the sum of the current that flows though the I/Os doesn't exceed the 10-20mA so that the internal diode doesn't burn out.


For the USB or SPI could I use very high resistence value, it doesn't matter, 3.3k-10kΩ for instance?
Does the USB/SPI spécifications allows it?

You need to be far more specific - we can't comment on your exact question unless we know what it is?.
Well imagine a PCB with:
- a PIC controller that uses USB and/or SPI to connect to a computer or another PIC on another board
- a voltage regulator for the PIC and other Chip (I2C chips for instance), that can be switch off or not.

That's it.

Questions:
* Can I keep the USB cable connected to the PIC even if the power supply of the PIC is switched off (voltage regulator output disbaled)?

* Can I keep the USB cable connected to the PIC even if the power supply is NOT pulleg in -> no ground -> open circuit. Latchup still possible?

* One solution would be to use the USB power supply to power up the PIC (and only the PIC), so no latch-up possible with the USB data lines connected to the PIC. But it would require to have a common ground between the PCB and the USB ground. In that case how can I avoid that too much current flows back to the PC through the USB ground (when we assume that there are other device on the PCB powered by an external power supply and that the consume more then the 500mA allowed by the USB standart).
Is it a problem? Will the current only flows thought the external power supply ground or also the USB ground???


Is it clearer? :eek:
(Sorry for my bad english :/ )




Ok I will try then the serial resistor on all IO + camping diodes.

I would be glad to get an answer about the last question (common USB ground).

Thank you!

pic are not that easy to break and the D+ and D- are data pins not power pins. The in current is in Microamps so is SPI

There is no clamping diodes on the D- and D+ pins just pullup's look at the data sheet.
Ok thank you for the confirmation.

So as long the current is limited there are no concern about a possible latch-up.
 
Last edited:
For the USB or SPI could I use very high resistence value, it doesn't matter, 3.3k-10kΩ for instance?
Does the USB/SPI spécifications allows it?
Definitely not for USB, it needs to maintain 90ohm impedance between the two data wires, and they should have about 45ohm impedance to ground. Best option would be to power the micro either from USB or powerplug through diodes. So adding the typical internal on-resistance of the drivers, older usb use ~27ohm reistors in series outside the chip to drive the bus properly.
 
...
Ok I will try it. Serial resistors + clamping diodes. ;)
I only have to take care that the sum of the current that flows though the I/Os doesn't exceed the 10-20mA so that the internal diode doesn't burn out.
...

It's not that simple. All current through the resistor will have the effect of trying to raise the "unpowered" PICs Vdd. You need to have as little current as possible (very high value resistors) so the PIC remains "unpowered". Alternatively you can put a load on Vdd-Vss like a low value resistor (180 ohms), so this makes a voltage divider and allows you to use lower value series resistors on the port pins.

...
For the USB or SPI could I use very high resistence value, it doesn't matter, 3.3k-10kΩ for instance?
Does the USB/SPI spécifications allows it?
...

See above, 3.3k or 10k might be too low and allow enough current for the PIC to start running, especially the newer PICs that run from very low currents and at low Vdd.

Really, I think the best options is just to put the PIC into sleep mode and draw a few uA or so (depends on which PIC) and then the PIC would easily be powered by the pin leakage on any input pins that are HI at the time.
 
Well imagine a PCB with:
- a PIC controller that uses USB and/or SPI to connect to a computer or another PIC on another board
- a voltage regulator for the PIC and other Chip (I2C chips for instance), that can be switch off or not.

Nothing to imagine - USB wise you power from either end (depending master or slave), so no problem.

Other options, why would you want to power some chips and not others? - apply a little sense to the design.

But none of this is PIC specific, it applies to any chips at all - simply design the circuit sensibly.
 
If you enable the powerup timer the chip will remain in reset for a few ms on powerup, and if you have a spare pin you can use this for the chip to detect whether it has power or not.
If one of the pins of the chip sees a rapid pulse train the powerup timer will keep the chip in reset so not much current will be pulled, then in the code right at the start (if power is applied to an i/o for longer than the powerup timer period) you can put a piece in that checks on power up that the device is powered from its vcc pin rather than an i/o, if power is not present on vcc then you can keep all the i/o set as inputs and put the chip in sleep mode consuming little power from the bus lines.
And when vcc is present run the main code as normal, this does need an i/o pin wired to vcc with possibly a diode and a pulldown resistor.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top