Maker Pro
Maker Pro

Problem using a mosfet to switch devices on/off

G

galapogos

Jan 1, 1970
0
Hi,
I'm trying to use a MOSFET whose gate is controlled by an MCU to
switch on/off the Vcc of 2 devices. I'm using a spare TP0610 P channel
enhancement mode vertical DMOSFET to accomplish this. Here are the
connections.
Source - 3.3V
Gate - MCU control output and 50K pullup(hence default switched OFF)
Drain - device Vcc and 1M pulldown(hence Vcc = 0V when mosfet OFF)

When I take the MCU out of the picture and simply use a jumper to
ground the gate input, and using this to switch the devices on/off, it
works perfectly. However, when I use the MCU to control the gate
voltage, I get some problems.

1) Drain voltage is initially 0V when power is applied. However, when
my MCU switches the mosfet ON and then OFF again, drain voltage
sometimes doesn't return back to 0V, but is about 1.2V

2) When the MCU tries to switch the mosfet ON by applying a logic 0,
my multimeter says it's not actually 0V but more like 300+mV. Does
this cause any problems, and why is logic 0 so high in the first
place?

I'm having some intermittent problems so I suspect that my hardware's
the problem here. Judging from the behavior and measurement I'm
getting this may very well be the case.

Any thoughts/suggestions/fixes?

Thanks!
 
C

CBFalconer

Jan 1, 1970
0
galapogos said:
I'm trying to use a MOSFET whose gate is controlled by an MCU to
switch on/off the Vcc of 2 devices. I'm using a spare TP0610 P channel
enhancement mode vertical DMOSFET to accomplish this. Here are the
connections.
Source - 3.3V
Gate - MCU control output and 50K pullup(hence default switched OFF)
Drain - device Vcc and 1M pulldown(hence Vcc = 0V when mosfet OFF)

When I take the MCU out of the picture and simply use a jumper to
ground the gate input, and using this to switch the devices on/off, it
works perfectly. However, when I use the MCU to control the gate
voltage, I get some problems.

1) Drain voltage is initially 0V when power is applied. However, when
my MCU switches the mosfet ON and then OFF again, drain voltage
sometimes doesn't return back to 0V, but is about 1.2V

2) When the MCU tries to switch the mosfet ON by applying a logic 0,
my multimeter says it's not actually 0V but more like 300+mV. Does
this cause any problems, and why is logic 0 so high in the first
place?

I'm having some intermittent problems so I suspect that my hardware's
the problem here. Judging from the behavior and measurement I'm
getting this may very well be the case.

Any thoughts/suggestions/fixes?

I'll give good odds that changing the pullup from 50k to 10k or
4.7k will cure it. Things leak.
 
S

Spehro Pefhany

Jan 1, 1970
0
Hi,
I'm trying to use a MOSFET whose gate is controlled by an MCU to
switch on/off the Vcc of 2 devices. I'm using a spare TP0610 P channel
enhancement mode vertical DMOSFET to accomplish this. Here are the
connections.
Source - 3.3V
Gate - MCU control output and 50K pullup(hence default switched OFF)
Drain - device Vcc and 1M pulldown(hence Vcc = 0V when mosfet OFF)

When I take the MCU out of the picture and simply use a jumper to
ground the gate input, and using this to switch the devices on/off, it
works perfectly. However, when I use the MCU to control the gate
voltage, I get some problems.

1) Drain voltage is initially 0V when power is applied. However, when
my MCU switches the mosfet ON and then OFF again, drain voltage
sometimes doesn't return back to 0V, but is about 1.2V

2) When the MCU tries to switch the mosfet ON by applying a logic 0,
my multimeter says it's not actually 0V but more like 300+mV. Does
this cause any problems, and why is logic 0 so high in the first
place?

I'm having some intermittent problems so I suspect that my hardware's
the problem here. Judging from the behavior and measurement I'm
getting this may very well be the case.

Any thoughts/suggestions/fixes?

Thanks!

Maybe you're connecting more than just the MCU to those switches-- and
the MCU is partially powering the devices through it's outputs and the
input protection diodes on whatever you are switching. If that seems
likely, try programming any such outputs to go low before you cut the
Vcc.

The 300mV does not make much sense, so it bears further investigation.
Scope the line to make sure there are not pulses on there, and check
that there is no voltage differential on your grounds.


Best regards,
Spehro Pefhany
 
G

galapogos

Jan 1, 1970
0
Maybe you're connecting more than just the MCU to those switches-- and
the MCU is partially powering the devices through it's outputs and the
input protection diodes on whatever you are switching. If that seems
likely, try programming any such outputs to go low before you cut the
Vcc.
Wow you're a genius. I figured that out after tracing my code to where
the problem starting appearing, and indeed it's the TX line that's
causing the problem. 1 of my devices communicates with the MCU's UART
and when I turned Vcc off, the TX was still set to output high. I set
it to become an input instead and now I get close to 0V when turning
off Vcc. Why would the TX matter though?

The 300mV does not make much sense, so it bears further investigation.
Scope the line to make sure there are not pulses on there, and check
that there is no voltage differential on your grounds.

The weird thing is that the 300mV only happens when I upload my
firmward to my flash MCU. When I'm debugging on my emulator, I get a
pretty clean 0V(<100mV at least).
 
Top