Reverse polarity protection on ATMEGA16U2 - Page 1
Forum section: electronics / general

author: bfrigon
author_rank: Contributor
timestamp: October 04, 2018, 06:15:03 pm
content: Hi everyone,I'm designing my arduino board and I have a question about reverse polarity protection. I plan to use a LTC4367 chip to implement both reverse polarity and overvoltage protection.What happen if the polarity is reversed on the DC jack while USB is plugged in. The LTC4367 is going to do its job by turning off the MOSFET cutting the ground return path to VIN. But there is still a ground connected to USB through the ATMEGA16U2 IC.The UGND pin which is connected to USB connector ground is isolated from the rest of the circuit ground plane. What i don't know if is the UGND and GND on the ATMEGA16U2 IC are connected internally . I couldn't find that info in the datasheet. If that is the case, correct me if i'm wrong, then the UGND will happily serve as a ground return path through the IC.I attached a schematic of the USB section.Thank you

author: ajb
author_rank: Super Contributor
timestamp: October 04, 2018, 09:40:55 pm
content: Unless explicitly stated otherwise, always assume that all of the ground pins, and all of the supply pins of a specified voltage, are connected internally, and always need to be connected to the same net. The only likely difference between UGnd and the other grounds on the chip is that UGnd will carry the bulk of the ground current from the USB interface inside the chip.Protecting a device with multiple IO connections against all possible wiring faults is not trivial. If your reverse polarity protection IC opens the positive input but leaves the negative connected, then yes, you will have a path between the positive input of the external supply (which is connected to the ground terminal of your input connector) and the USB Gnd, however, this should be via the ground plane on your PCB,because both UGnd and all of the other ground pins need to be connected to the same ground plane. If your external supply is isolated, then no (appreciable) current will flow, and there's no problem. If the supply is not isolated, but is of a reasonable capacity, hopefully your ground plane will provide a robust enough pathway that the power supply will will shut down to protect itself before any damage is done. If the supply is not isolated and is some 1.5kW monster or something, then you might fry your board or your external wiring. In this case, some local, external current limiting is probably a good idea for a whole host of reasons. You will need to decide which possible wiring faults are worth protecting against.PS, your USB shield connection does not show any connection to ground, and you probably don't want that ferrite bead there. See here:https://www.eevblog.com/forum/projects/usb-shield-ground-connection/.

author: bfrigon
author_rank: Contributor
timestamp: October 05, 2018, 02:49:55 pm
content: Thank you!Isn't the usb connector shield connected to earth on the pc side (unless it's a laptop). Wouldn't that be enough to blow it up?If i put a p-mosfet between the UGND pin and the point that the usb connector ground and shield are connected with the gate tied to ground. That way, under normal condition, the mos will conduct current to usb ground. But if the ground plane becomes positive, it will block it.

author: bfrigon
author_rank: Contributor
timestamp: October 05, 2018, 02:57:07 pm
content: No i just realized... That will never workSource and gate are both equal under normal condition, it will never turn on...Is there a way to protect against reverse polarity on both the positive and ground? Every examples i found only protect the positive rail. This is enough when you have only one power source, but it won't work here...

author: PCB.Wiz
author_rank: Super Contributor
timestamp: October 06, 2018, 11:32:48 pm
content: Quote from: bfrigon on October 05, 2018, 02:57:07 pmSomeone has to work pretty hard to revers power a USB connected part.I've seen reverse protection on DC barrel jack powered devices, where is it just possible to find centre-negative wiring.

author: Mr. Scram
author_rank: Super Contributor
timestamp: October 06, 2018, 11:48:22 pm
content: Quote from: PCB.Wiz on October 06, 2018, 11:32:48 pmAgreed. You get to keep the spoils if you pull that one off. You've earned them.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 07, 2018, 02:45:53 am
content: What? The hell are these...https://www.bourns.com/docs/Product-Datasheets/MLC.pdfThey're not back-to-back zeners (as shown on the schematic), MOVs I guess but they sure aren't spec'd like MOVs.1. The specs areidenticalfor all rated voltages? What the hell?2. Capacitance is nice and low, but that doesn't sound like an MOV to me, not one worth anything anyway. I don't even...3. 25V clamping voltage is pretty bad among high speed bus clamp diodes already (most are 10-20V).4. But wait, there's a note. 30ns after peak? WTF? Who ever specifies a clamp that way?!5. Trigger voltage? Is this a GDT secretly???5a. 250V peak? Holy shit! This thing is fucking useless!6. Now I'm really curious how they determine "response time". 1ns is comparable to the risetime of an IEC 61000-4-2 waveform. How would you know? Is it 1ns after the 250V peak? Who knows, because...7. They don't have any graphs. Nothing. Nada. The manufacturer's website hardly even says anything. Is this the best they have?https://www.bourns.com/docs/technical-documents/technical-library/chipguard/apno_high_speed_comm_ports.pdf?Status=Master&sfvrsn=7dcb0660_18. Also, they hint that it's actually a polymer device, which I've heard of before but not seen very often, and it seems they're just not as good as semiconductor devices. Needless to say they are NOT "metal oxide varistors" as the acronym "MOV" implies!Suffice it to say, this product will NOT be a design win for anything I touch!Regarding the USB,always ground the shield, early and often. If you don't have a ground plane, pour one. Make multiple connections to the shield.If you must have galvanic isolation between shield and circuit, use four or more ceramic chip caps around the connector to provide at least an okay AC ground path. But that doesn't really check out, either: the V- wire is always going to be grounded on both ends, and DC current doesn't care if it's carried by a thinner wire or a beefier shield (the data signals care though!).Ah, and by the same token, the polyfuse is useless -- hit the circuit with a surge or the wrong voltage, and that poor MCU is toast in a hundred microseconds, no matter what. A hundred thousand microseconds later, and the polyfuse opens. Maybe.Most of all though -- USB is designed to be safe and protected. That's why the shield sticks out beyond the connectory-bits: ESD sparks to the shield first, which is why the shield needs to be tied into circuit ground, so it's shunted away along a safe (shielding) path, away from onboard signals and vulnerable data lines. The only hazard that should be present, is a charged cable, which should be handled nicely by a small TVS.Typically, you'd use a combo ESD diode array device, which has clamping diodes on the data lines (diodes = less capacitance, instead of TVS/zeners directly which have higher capacitance), clamping to a TVS on the power line (where the capacitance doesn't matter). There are also TVS arrays with internal filtering (compatible with USB full or high speed, as the case may be) and pull-up/down resistors, very handy indeed.Alas, yes, you can find a lot of conflicting, and just outright bad, information out there. The only sure thing is to learn the reasoning how to work it through yourself. Measurement is king!Tim

author: bfrigon
author_rank: Contributor
timestamp: October 08, 2018, 01:04:23 pm
content: Quote from: Mr. Scram on October 06, 2018, 11:48:22 pmhmmm, No i'm not trying to reverse polarity protect a usb connector... although It looks like that on the schematic, it's not what i'm trying to do here.Maybe i wasn't clear enough in my first post...What i'm trying to prevent is current return on the usb ground which is connected to ground from the DC jack... If that ground is reversed, then current flow from the DC jack ground (which is now positive) to the usb ground (which is still ground)....That's what i don't want here, large amount of current flowing to the usb ground...

author: bfrigon
author_rank: Contributor
timestamp: October 08, 2018, 01:33:19 pm
content: I based my schematic on the arduino mega 2560... I admit that I didn't put too much thoughts into that... I just assumed everything was fine...Regarding the MLC... i'll remove them and put a SR-05 instead, as i used previously on another design...As for the polyfuse... in this configuration, it's pretty much useless... On the arduino schematic, the USB power can also power the rest of the rest of the circuit, but here it goes straight to the IC, only powering the USB vreg in the IC... So, gone...Back to the original problem... I still feel the need to implement a current limit on the usb ground. If i understand it correctly.... Because the DC jack ground is connected to the USB ground, the reverse polarity protection at the DC jack isn't going to prevent current from flowing to the usb ground if positive voltage is present on the ground plane. I was thinking of adding a poly between the USB ground and the ground plane.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 08, 2018, 08:24:06 pm
content: You never showed where or what this DC jack is.It is safe to assume all two-prong DC adapters are isolated, so it doesn't matter if they are common ground or not. (3-prong adapters may be grounded through, check with an ohmmeter.)Tim

author: bfrigon
author_rank: Contributor
timestamp: October 08, 2018, 08:56:39 pm
content: Quote from: T3sl4co1l on October 08, 2018, 08:24:06 pmHi, thank you for your answerIt's a 2 prong DC jack... So yeah, i'm gonna use an isolated power supply.I'm sorry, i'm trying to understand here. If i measure the resistance between the USB shield and an outlet earth pin, i get about 1 ohm. So i assume the usb shield is connected to earth... If i connect my ground plane to the shield and 5v is present on the ground plane because polarity was reversed, then all available current from the power supply is going to flow through the usb shield to earth on the PC side, is it not?I took my bench power supply, set a current limit of 0.2 amps and shorted the output to a USB connector shield plugged in my PC... And, the current limiting kicked in...My circuit is going to use about 1.5 to 2 amps at 5V. Let's say that i choose a power supply that can deliver 2.5 amps... Is it safe to dump 2.5 amps through the usb shield to the pc? My instinct tell me no...

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 09, 2018, 12:28:31 am
content: Quote from: bfrigon on October 08, 2018, 08:56:39 pmClearly your bench supply is not isolated!Usually there is a ground lug on the front, which can be strapped to +/- as needed when a grounded supply is desired. Or left open otherwise. (Check the supply's manual for how much ground offset voltage is acceptable -- usually there's something limiting this, like a capacitor which would be damaged if exceeded.)Tim