"Reversing" current into an LDO? - Page 1
Forum section: electronics / beginners

author: jgalak
author_rank: Regular Contributor
timestamp: February 03, 2018, 03:53:16 pm
content: I am working on a micro-controller based project in which the "production" version will be powered through an external power source (battery, wall-wart, etc) feeding an on-board LDO linear regulator. However, during "development", the power will mostly come from the programming interface (FTDI basic breakout board and/or ISP programmer).I'm wondering if this is safe to do to the LDO. The external power will not be connected when it's being fed by the programmer, but current will still flow "into" the "out" pin of the LDO. Is this ok? Are there specific specifications I should be looking at when choosing the LDO to make sure this won't damage it? I've tentatively chosen an RT9193-33 LDO (http://www.richtek.com/assets/product_file/RT9193/DS9193-17.pdf), but that can be changed.I can add a jumper of some sort, but I know various Arduino boards do this safely without a mechanical interlock, so I'm wondering if it can be done in this way.

author: Peabody
author_rank: Super Contributor
timestamp: February 03, 2018, 04:39:37 pm
content: It's been a while since I looked at one, but the schematics for the various Arduinos are open source, and they will show you how multiple alternate supplies are handled without any mechanical switching. But it may be that your LDO would be ok. Essentially they operate by regulating the amount of source current needed to maintain the designated output voltage. But there is rarely anything in them that would actively pull down the output. So if the actual output voltage stays higher than the target output voltage, the LDO would just turn its pass transistor completely off and pretty much shut down. But at some higher voltage it would damage the LDO, and the datasheet is your best guide on that. Also, I suggest you actually measure the current that flows backwards through the LDO output during the charging setup. If it's just a few milliamps, it's probably not a problem - again, subject to the Absolute Maximums in the datasheet. But the LDO could have a reverse biased diode across it, which would protect the LDO, but pass lots of current.You can prevent any current flow by inserting a diode in the output line of the LDO. But a more elegant way, with almost no voltage drop, is to put a P-channel mosfet there, oriented so that its body diode is forward biased from output to the processor's Vcc. The gate would have a high-value pull-down resistor to ground, but would also be connected to the programmer power supply input. Normally the MOSFET would be fully on, but when the programmer is connected and that voltage comes up, voltage on the gate would go high, which would turn the MOSFET off. Kinda like reverse polarity protection for a battery-powered device.So Google for the datasheet for something like the Uno, or whichever one allows for USB power or external barrel connector power, and there may be a third option - battery or something. Based on the last time I looked, it's all pretty clevee the way they do it.

author: jgalak
author_rank: Regular Contributor
timestamp: February 03, 2018, 05:41:45 pm
content: Datasheet doesn't seem to say anything about reverse current.Note this wouldn't be used for charging - when programmer is attached, there'd be nothing connected to the LDO input. But the LDO GND is still tied to system ground, so I'm wondering if it's possible for the reverse current to do something nasty there.

author: David Hess
author_rank: Super Contributor
timestamp: February 03, 2018, 07:32:30 pm
content: Some regulators are tolerant to a voltage applied to their output with no input and some are not; datasheets may or may not say. You should assume that the input will be shorted and not open.

author: schmitt trigger
author_rank: Super Contributor
timestamp: February 03, 2018, 07:39:05 pm
content: Just to be safe:put a schotky diode, anode to output, cathode to input.Some old National Semi app notes recommended that trick.

author: Ian.M
author_rank: Super Contributor
timestamp: February 03, 2018, 07:45:11 pm
content: The functional block diagram on page 2 of the datasheet you linked shows the pass transistor (P-MOSFET) with a body diode that will pass reverse current till Vin is one diode drop below Vout. Excessive body diode current may possibly cause latchup. It also shows a N-MOSFET pulldown transistor controlled by the shutdown logic. The logic may glitch during powerup via Vout, and may crowbar Vout.IMHO its not worth the risk. Why not feed USB Vbus (5V) to the input of the regulator? If you need the programmer to be able to control the MCU's 3.3V Vdd rail, then apply the programmer's Target_Vdd signal to the regulator's EN pin.Caution: the regulator's Abs.Max. input voltage rating is 6V. If you use a low ESR input decoupling capacitor (e.g. ceramic), ringing with the supply lead inductance is likely to exceed that if the lead is hot-plugged. You'll need enough damping to prevent that e.g. use an ordinary electrolytic of at least 10x the value in parallel with the ceramic, or you'll need to clamp the input at no more than 5.5V.

author: jgalak
author_rank: Regular Contributor
timestamp: February 03, 2018, 07:45:46 pm
content: Looking at Arduinos, on the Pro Mini, there seems to be no protection. The "Raw" pin is connected to regulator input, and the "Vcc" pin and the FTDI basic "Vcc" pin are both tied to the regulator output.The Uno is more sophisticated, with possible inputs including barrel jack, USB, raw input to a pin, and regulated input to a pin. It seems to use a FET controlled by a comparator to disconnect the USB power when there is other power available, but that seems to be just there to protect the USB from a reverse current - the 5V regulator can still get a reverse current if one connects power only to the regulated input pin.So both of these devices appear to work in the way I was going to wire my circuit, no protection for the regulator from reverse current. Of course, they probably know their regulators better than I doI'd use the one on the pro mini, but it's lower power than I might need.

author: jgalak
author_rank: Regular Contributor
timestamp: February 03, 2018, 07:49:03 pm
content: Quote from: Ian.M on February 03, 2018, 07:45:11 pmI wasn't planning on feeding it 5V at all. The plan is to program with either an AVR-ICE using isp or with an FTDI Basic over serial (with a bootloader installed). Both of these feed 3.3V.The regulator is low dropout, so it may be possible to route those through the regulator? Not sure if the small voltage drop would adversely affect the system....

author: Zero999
author_rank: Super Contributor
timestamp: February 03, 2018, 08:45:27 pm
content: Quote from: Peabody on February 03, 2018, 04:39:37 pmCan you please post a schematic? If you're describing what I think you are: a standard MOSFET reverse polarity protection circuit, I can't see how it will work.https://electronics.stackexchange.com/questions/82692/reverse-polarity-protection-pmos-vs-schottkey-diodeIn the above circuit, the MOSFET will conduct if the source voltage is higher than the drain voltage. It will not prevent the load from back-feeding current into the power supply. The only time the MOSFET will turn off is if the drain voltage falls below the threshold voltage and then it will just behave like an ordinary rectifier diode.To prevent back-feeding, with a much lower voltage drop, than a Schottky diode, a more elaborate solution is required. Fortunately, there are ICs such as the LTC4359, which can be used to prevent back-feeding, with very little forward voltage drop.http://cds.linear.com/docs/en/datasheet/4359fc.pdf

author: Peabody
author_rank: Super Contributor
timestamp: February 03, 2018, 09:28:57 pm
content: Quote from: Hero999 on February 03, 2018, 08:45:27 pmThe mosfet will turn off if the gate voltage is high enough relative the source. If you tie the gate to the programmer input in some way, so that the gate will be low when the programmer is not connected, but high when it is, then the mosfet will turn off when the programmer is connected. The problem in this case is that the programmer power supply and the RT9193 output will both be connected directly to the processor's Vcc, which will always be high one way or another. But if he's using an FTDI USB-to-serial adapter, he could use one of the other FDTI outputs, such as DTR, which will be high only when the programmer is connected. He would need something like a 100K pulldown on the gate instead of tieing it directly to ground.The attached picture shows a more complicated arrangement for an *embedded* CP2102 USB-to-serial adapter (similar to FTDI). It depends on the fact that the 3.3V ouput pin of the CP2102 goes to ground when it's powered down. That turns on the mosfet, and turns off the hex buffer.

author: Peabody
author_rank: Super Contributor
timestamp: February 03, 2018, 09:49:22 pm
content: @jgalak: I've used the MCP1702 regulator in the past, and if the IN source is switched off, then it only sinks current back through the voltage divider sense resistors - a couple milliamps or so. It's only 250 ma, but if that's enough, and it's not too noisy, you might want to check it out. As the data sheet shows, it's a lot simpler in design than your RT9193, and has no active sink output.

author: djacobow
author_rank: Super Contributor
timestamp: February 03, 2018, 10:08:06 pm
content: Why not just leave the regulator off the board until you are done debugging?

author: jgalak
author_rank: Regular Contributor
timestamp: February 03, 2018, 10:13:18 pm
content: That's certainly a thought, though I've been moving to reflow soldering lately, so getting it all on at once is easier. Not a deal breaker though, those guys aren't hard to hand-solder, at least in a reasonable package.It does mean I can't do a test-reprogram-test cycle without a lot of effort, but it's certainly possible.

author: paulca
author_rank: Super Contributor
timestamp: February 04, 2018, 06:29:59 pm
content: I found my LM78L05s will short the Vout to ground if voltage is applied there.

author: jgalak
author_rank: Regular Contributor
timestamp: February 05, 2018, 01:22:24 am
content: Quote from: paulca on February 04, 2018, 06:29:59 pmThat's decidedly ungood....I think I'll order a few and play with them on the bench before settling on the design...

author: phil from seattle
author_rank: Super Contributor
timestamp: February 05, 2018, 04:53:41 am
content: Quote from: jgalak on February 03, 2018, 07:49:03 pmUh, no.If you are talking about the current Atmel-ICE, it does not supply Vcc. Says so clearly in several places. You need a separate supply.The FTDI 3.3V on chip regulator is rather puny. There are lots of warnings about not relying on it. I would figure out a way to feed VBUS from the FTDI adaptor to your on-board regulator. Use a couple of pin headers with a jumper or a 3-way solder bridge.

author: jgalak
author_rank: Regular Contributor
timestamp: February 06, 2018, 02:23:11 pm
content: Quote from: phil from seattle on February 05, 2018, 04:53:41 amHuh. Interesting. Will have to investigate further. My current breadboarded circuit uses a Arduino Pro Mini and both the uC, and the rest of the circuit (a few other chips) are happily running off the 3v3 power from the FTDI basic. But the final circuit will have more going on - there's at least two major blocks not yet designed.Thanks.

author: jgalak
author_rank: Regular Contributor
timestamp: February 06, 2018, 02:50:32 pm
content: I see what you mean, phil. So obviously for the ATMEL-ICE the voltage pin should just be for sensing the voltage, and external power should be used. That's fine.For the FTDI though, it does try to send +3V3 through the connector. Is it safe to just leave this pin disconnected and power externally? I suppose I can feed it to the regulator (the FTDI basic 3v3 is rated for 50mA current, but there's a larger "Beefy 3" from sparkfun that's good to 600mA - enough to fly to the moon), but even with the low drop out of this regulator that'll mean the voltage going from 3V3 to about 3V. I think all of my chips will be happy at that voltage, but not 100% certain...

author: Peabody
author_rank: Super Contributor
timestamp: February 06, 2018, 03:22:32 pm
content: The potential problem is that even ifyou don't use the 3.3V output of the FTDI, it's TXD, DTR, etc., outputs will all go to 3.3V. If you're driving a processor powered at 3V, that *probably* will work ok, but you would need to check the Absolute Maximums in the datasheet to see if Vcc +0.3V is ok. It almost always is. But driving 3.3V into a 2.8V or 2.4V processor could well be a problem. That's why it may be safer as a general rule to have the FTDI power the MCU during charging. But then you have the backflow issue through the other regulator.Say again why the voltage would need to drop to 3V?

author: jgalak
author_rank: Regular Contributor
timestamp: February 06, 2018, 03:26:00 pm
content: Quote from: Peabody on February 06, 2018, 03:22:32 pmThe regulator has a worst-case a dropout of about 300mV. So if I feed it the 3.3V from the FTDI Basic, it'll give me 3.0V, no?

author: schmitt trigger
author_rank: Super Contributor
timestamp: February 06, 2018, 08:23:28 pm
content: Unregulated 3,0 volts at best.Actual dropout voltage will be somewhat dependent on load current. Thus, the output voltage will shift with load variations.There are some LDOs that have guaranteed dropouts of 100 mV or less.

author: Simon
author_rank: Unknown
timestamp: February 06, 2018, 08:28:25 pm
content: depends on the regulator, if you use a regulator that requires external resistors you can put a diode on the output of the regulator and take the feedback from after the diode s you still get 5V but it's reverse protected.

author: Peabody
author_rank: Super Contributor
timestamp: February 06, 2018, 09:18:12 pm
content: Quote from: jgalak on February 06, 2018, 03:26:00 pmI may have misunderstood, but I thought Phil was suggesting that you feed the USB 5V into your regulator. That would leave its output at 3.3V. But I gotta say, the "Beefy 3" will supply 600 ma at a regulated 3.3V, and I would just go with that. It's the same price as the Basic, and its 3.3V supply comes from a separate voltage regulator that's probably as good as yours. So any FTDI shortcomings wouldn't apply. Seems to me that's the way to go. But damn, the Sparkfun stuff is expensive.