Challenge of the day - why is the MOSFET always on? - Page 1
Forum section: electronics / beginners

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 10, 2023, 07:41:37 am
content: HiJust went through this a few weeks ago, a very stupid mistake that I only saw after I ordered the board (of course).I though it could make an interesting challengeThe problem is: Q2 is always on, I cannot turn it off with the MCU. Why?If you think the answer is super obvious, then please do not answer, or at least wait a few days so that others have a chance at thinking at itCheersSimon

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 10, 2023, 08:11:04 am
content: What FET?Tim

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 10, 2023, 08:31:58 am
content: @karpouzi9: you're correct, GPIO must be configured output low for mosfet on, and as High-Z input ("turned off") for mosfet off.The on part works, though when putting the GPIO in High-Z the mosfet is still on.@Tim: I think this is way too easy for youNot sure I understand your question though? the FET is Q2

author: HwAoRrDk
author_rank: Super Contributor
timestamp: March 10, 2023, 08:44:52 am
content: Quote from: karpouzi9 on March 10, 2023, 08:09:26 amYes, I reckon that is the cause. Even when 'off', at 3.3V the gate will still be 1.7V below the source, and if the MOSFET has a Vgs(th)of something like -1.5V, it'll stay on.You'll also get a sub-mA current (determined primarily by R41) trickling into VDD from VBUS through the GPIO pin's protection diodes, will it not? Although that is probably inconsequential.Quote from: karpouzi9 on March 10, 2023, 08:09:26 amOr make it an open-drain output, which I would guess the GD32 supports.

author: Zero999
author_rank: Super Contributor
timestamp: March 10, 2023, 08:52:11 am
content: Ah someone beat me to it. I wanted the OP to look it up. It's the protection diodes which are the problem. Even if the pin is configured to open drain, it will still have a diode connected to VDD. Use another transistor to drive the MOSFET. You can use common base/gate configuration, that way the software doesn't have to be modified.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 10, 2023, 09:02:02 am
content: @HwAoRrDk: yes I should have said that this is the assumption is the output is in high-Z. And yes for GD's MCUs, as far as I know at least, a GPIO in open-drain "high" or input is exactly the same.@Zero999: spot on - HwAoRrDk mentioned it but yes it was the bloody diodesBasically when the output was in high-Z there was still the protection diode pulling it down to 3.smth volts, and the mosfet was in a weird state where it would pass some current (enough to turn on the device on the other side) but not all current - gave super weird behavior, definitely not recommended!To solve it one can use an extra transistor to drive the gate like Zero mentioned, or this MCU has many 5V tolerant pins (PA8 f.x.) which do not have a protection diode to VDD.

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 10, 2023, 09:32:41 am
content: Quote from: simonlasnier on March 10, 2023, 08:31:58 amI think he wants to know which FET you are using. So the model number not the identifier in the schematic.A search for Q_PMOS_GSD gives BSS84LT1 as a first result, but is that the correct one. (Google that is)Does not make much of a difference here with the somewhat obvious protection diodes throwing things of. Not sure if a 5V tolerant pin will make it work. Depends on how the internal setup in the MCU is for these pins. An external open drain coupling is a better solution.

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 11, 2023, 09:04:31 am
content: Ah ok, thanks for the clarification. Well the FED I am using is this onehttps://datasheet.lcsc.com/lcsc/1810171817_Alpha---Omega-Semicon-AO3401A_C15127.pdfI guess the point is about checking the Vgs(th) so we know if the diode is enough to keep it on?

author: janoc
author_rank: Super Contributor
timestamp: March 11, 2023, 09:41:06 am
content: Quote from: pcprogrammer on March 10, 2023, 09:32:41 amThat doesn't make much sense to Google - "Q_PMOS_GSD" is merely a generic Kicad part designator, "PMOS FET, Gate-Source-Drain pin ordering" (Gate is pin 1, Source pin 2, Drain pin 3).

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 11, 2023, 10:03:07 am
content: Quote from: janoc on March 11, 2023, 09:41:06 amHence the "but is that the correct one." And it turns out it ain't because Simon wrote that it is a AO3401A.And for your information, not every body uses Kicad or is up to speed with every component marking out there.

author: janoc
author_rank: Super Contributor
timestamp: March 11, 2023, 10:19:00 am
content: Quote from: pcprogrammer on March 11, 2023, 10:03:07 amI would assume that someone dabbling in electronics would know what "Q" and "PMOS" on a schematic mean, right?

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 11, 2023, 11:34:33 am
content: Quote from: janoc on March 11, 2023, 10:19:00 amOf course I do, and I also normally read a schematic as such that the Q2 in this one is the part enumerator and that it is then normal to mention the exact part name (type, identifier) near it, so that you know which part to order. The symbol itself already shows me that it is a P channel mosfet. The label Q_PMOS_GSD becomes a bit redundant then.