Help: p-channel MOSFET won't turn off - Page 1
Forum section: electronics / projects

author: rea5245
author_rank: Frequent Contributor
timestamp: December 16, 2021, 03:58:26 pm
content: OK, I know this question has been asked a lot on the web, and I think I might understand the cause of my problem, but I don't know the solution.I have a microcontroller running at 5V driving the gate of a P-channel MOSFET (an LP0701N3,https://ww1.microchip.com/downloads/en/DeviceDoc/LP0701-P-Channel-Enhancement-Mode-Lateral-MOSFET-Data-Sheet-20005447A.pdf).The source is tied to 5V and the drain is tied to a load. At startup, the uC pin is high and the MOSFET is off. When I set the pin low, the MOSFET turns on. When I set the pin high again, the MOSFET does not turn fully off.I've tried some variations. I added a 10K pullup resistor on the gate but that didn't help. Then I changed the uC pin to open drain, hoping that would "help" the pullup resistor some more. That didn't fix it either.From what I've found on the web, I think the problem is that I need to get the gate a little higher than the source, to get the MOSFET to fully turn off. But how would I do that? 5V is all I have.Alternatively, is there a different MOSFET that would behave better?Thank you.

author: gamalot
author_rank: Super Contributor
timestamp: December 16, 2021, 04:39:05 pm
content: If your MCU is powered from the drain of the PMOS it controls, maybe you can consider using a push-pull output GPIO pin to control an open collector NPN transistor to control the gate of the PMOS.

author: rea5245
author_rank: Frequent Contributor
timestamp: December 16, 2021, 04:43:52 pm
content: Quote from: gamalot on December 16, 2021, 04:39:05 pmIt's not. It's powered from the same 5V that the MOSFET's source gets.

author: strawberry
author_rank: Super Contributor
timestamp: December 16, 2021, 05:01:47 pm
content: load have capacitor orMCU port is not pulling high enoughMOSFET Gate threshold is 0.5V

author: rea5245
author_rank: Frequent Contributor
timestamp: December 16, 2021, 05:13:20 pm
content: Quote from: strawberry on December 16, 2021, 05:01:47 pmThe load is an MCP1700 3.3V regulator, which in turn powers a radio module. As with many voltage regulator circuits, there's a 1uF cap between Vin and GND. That cap is, therefore, between the MOSFET's drain and GND.Could that be the problem? Why would a 1uF between drain and GND cause this and, more importantly, what can I do about it?The MCU port is should be pulling to 5V, especially when I set it to open drain and added a 10K pullup resistor to 5V. I can't pull it any higher than that.

author: Terry Bites
author_rank: Super Contributor
timestamp: December 16, 2021, 05:16:06 pm
content: This MOSFET has a very low threshold so if your drive pin is only slightly below Vdd the transistor my fail to turn off.Do you really need a MOSFET here, do not fear the pnp!Just save yourself the headache and use an LDO with a shutdown pin eg NCP163ASN330T1G

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 16, 2021, 05:25:05 pm
content: Yes, the threshold is ultra low for a MOSFET. In the OP's case, it's a drawback more than anything else. Just pick a PMOS with a higher threshold. There are thousands of them.

author: Peabody
author_rank: Super Contributor
timestamp: December 16, 2021, 06:10:19 pm
content: What does the gate voltage actually measure when it's supposed to be 5V?How do you know the mosfet isn't turning off? Is it because the radio module is still on? Is it possible the mosfet *IS* turning off, but the radio module is being partially powered from one or more GPIO port pins of the processor?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: December 16, 2021, 06:12:52 pm
content: Start by posting a picture of a schematic.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 16, 2021, 06:22:21 pm
content: People again misunderstand what threshold means.Vgs(th) value given in the datasheetguaranteesthe FET is off (meaning, Id < 1mA) when Vgs < -0.5V. Assuming the microcontroller has a CMOS output (which is a very fair assumption in 2021) which can output the full Vcc supply voltage given very high output impedance of the MOSFET gate, there is no issue here.The problem has to be elsewhere. A schematic and/or a photo would help narrow things down.Measure Vgs (directly across the MOSFET pins) with a multimeter when it is wrongly in the on state.

author: rea5245
author_rank: Frequent Contributor
timestamp: December 16, 2021, 06:34:22 pm
content: Here's the schematic (from before I added the pullup resistor).

author: Siwastaja
author_rank: Super Contributor
timestamp: December 16, 2021, 06:37:32 pm
content: Schematic lacks the interesting parts, what is driving "Radio Power On" net, and is it powered by the same +5V net.Measure Vgs with multimeter when erroneously on and post the result.

author: rea5245
author_rank: Frequent Contributor
timestamp: December 16, 2021, 07:04:47 pm
content: Quote from: Siwastaja on December 16, 2021, 06:37:32 pm"Radio Power On" is driven directly by a microcontroller pin on a Microchip PIC18F47K42. No pullup resistor. The uC is powered by the same 5V that's on the MOSFET's source.Quote from: Siwastaja on December 16, 2021, 06:37:32 pmVgs is -0.009V. Voltage at the drain, relative to ground, is 0.781V.

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 16, 2021, 07:11:44 pm
content: Quote from: rea5245 on December 16, 2021, 07:04:47 pmAnd from that, you concluded that the MOSFET is not off...

author: rea5245
author_rank: Frequent Contributor
timestamp: December 16, 2021, 07:25:09 pm
content: Quote from: SiliconWizard on December 16, 2021, 07:11:44 pmWell... um... uh... you make an interesting point...But the thing is, before I turn the radio on the first time, the drain voltage is a rock-steady 0V. Then I turn the radio on and off, and the drain stays at 0.781. And the reason I care is that it causes some sound to come out of the speaker.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 16, 2021, 07:50:06 pm
content: Sounds being emitted means significant power being leaked.Any possibility something else back-feeds power to U1 through the IO pin protection diodes? I.e., external voltage in RadioReset, RadioCS, SCL, SDA..? That would also go though U4 to its input, to be measured by you at Vdrain.Is that 0.781V reading stable or is it diminishing slowly?When you read 0.781 at the input of U4, what's the voltage at output of U4, i.e., difference over the regulator?What happens if you just cut the input to U4 and solder in a fixed load resistor for a simple test?

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 16, 2021, 08:08:04 pm
content: It seems likely that you are powering the Mikroe module through one of its IOs from one of the IOs of the MCU connected to it. When powering it off, the MCU will need to switch all its IOs connected to the Mikroe module to 0. The problematic part will still be I2C, since the lines are pulled up. If the MCU has internal pull ups, activate them when the module is powered on, and disable them when it's off, and get rid of any external pull ups. If you can't do that...

author: rea5245
author_rank: Frequent Contributor
timestamp: December 16, 2021, 08:29:54 pm
content: Since my uC is running at 5V and the MikroE module runs off 3.3V, the four signals going to the module (Reset, CS, SDA, SCL) are all set to open drain on the uC and have external 10K pullup resistors going to 3.3V. That's the same 3.3V that's output by the MCP1700 - which is turned off by the MOSFET.In other words, the MOSFET powers the 3.3V regulator, which powers the radio module and the pullup resistors for the signals coming from the uC. Since those signals are OD, the module can't be getting power from the uC.The emitted sounds are soft ticks every 1/2 second.

author: Peabody
author_rank: Super Contributor
timestamp: December 16, 2021, 10:00:11 pm
content: Then you should be able to disconnect those four lines, one at a time, and the noise will still be present. And if you remove the mosfet, everything should turn off. All of that would tend to confirm that the mosfet is the problem.But if the mosfet is fully off when you power up initially, and turns fully on with no problem, it is highly unlikely there is anything wrong with it. It seems much more likely the .7V is coming from the radio, flowing backwards though the 3.3V regulator to the drain. Anyway, if you can, you need to just try removing or disconnecting things until you figure it out.It would be helpful if you could measure the voltage at some of the important points, and report what they are when things are still On but should be Off. Like - those four I/O pins, and the Vcc pin of the radio module.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 17, 2021, 07:34:23 am
content: Measured low value of Vd and audible ticks every 500ms sure sounds like this is a very small current leakage which charges up the capacitors, makes the CPU boot and emit sound, again discharging the caps. You can verify this diagnosis by adding additional resistive load, like 1kOhm, in parallel with C2 and/or C3.You still need to measure where the current is coming from. If nothing else, add a series resistor of a few ohms, or even a few tens of ohms, between Q1 drain and U4 Vin, so you can measure current (be careful to also measure direction of current correctly!).

author: rea5245
author_rank: Frequent Contributor
timestamp: December 17, 2021, 03:45:12 pm
content: The radio module is socketed, so I can just pull it out. That will eliminate any possibility of the four signal pins leaking back to the 3.3V.With the module out, the initial state is 0V on the MCP1700's Vout. When I turn it on, Vout is 3.29V. When I turn it off again, Vout is 1.09V. Vin (which is also the MOSFET's drain) is 0.7V.If I short the drain to gnd, Vout drops to 0.395V, but as soon as I remove the short, Vout goes back up to 1.09V.If I short Vout to gnd, then remove the short, Vout goes back to 1.09V.

author: AndersJ
author_rank: Frequent Contributor
timestamp: December 17, 2021, 04:06:06 pm
content: Make sure you have more load than a high-z multimeter.

author: rea5245
author_rank: Frequent Contributor
timestamp: December 17, 2021, 04:15:12 pm
content: Quote from: AndersJ on December 17, 2021, 04:06:06 pmAre you thinking there's some capacitance holding a charge? I shorted the drain to gnd and I shorted the MCP1700's Vout to gnd. As soon as I removed the shorts, the drain voltage and the Vout voltage went back up.

author: Peabody
author_rank: Super Contributor
timestamp: December 17, 2021, 04:16:28 pm
content: Quote from: rea5245 on December 17, 2021, 03:45:12 pmAre the pullup resistors on the signal lines also removed when you remove the radio module? If not, then the signal lines could be powering the MCP1700's Out pin through the pullups. And if you still have voltage there when you ground the mosfet drain, then the current can't be coming from the mosfet.

author: 741
author_rank: Frequent Contributor
timestamp: December 17, 2021, 04:58:14 pm
content: What (if anything) happens when the Mikroe module is powered up stand-alone by 0.781V? I'm simply wondering whether C2's potential comes out unaltered and vaguely powers the radio.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 17, 2021, 05:58:13 pm
content: With drain (aka Vin of regulator) shorted to ground, and still voltage measured at Vout of regulator, proves the current is coming somewhere from the output side. It's just passing through the regulator to its input in reverse direction because there is internal diode structure from out to in inside the regulator.

author: rea5245
author_rank: Frequent Contributor
timestamp: December 17, 2021, 06:09:18 pm
content: OK, thanks to all your input, I've found the problem.Power was, indeed, leaking back through the 10K pullups on the I2C pins. When I turned on the radio, code deep down in the library configured those pins to be I2C instead of GPIO. When I turned the radio off, those pins remained as I2C. Thus, my setting the GPIO to low outputs had no effect.Thank you all for your advice!