EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: unscripted on August 24, 2022, 12:04:49 am
-
Really a beginner question.. but I thought a N-MOS like a N-Channel MOSFET was activated with "1" logic but while using a STM32 GPIO as open drain output I realized the N-MOS is activated with a "0". I would appreciate any quick enlightenment or suggested documentation to read more about N-MOS and P-MOS. Thanks.
-
You are correct about turning on an isolated NMOS transistor, but in this case the magic happens in that "Output Control" box. There the "0" is inverted (and potentially disabled in order to force both the NMOS and PMOS transistors off when you want to use that pin as an input). The NMOS/PMOS transistors invert the polarity once again and so an logic "0" becomes 0V at the pin.
-
It's an arbitrary choice. 0 corresponds to output pulled down to GND, 1 corresponds to output pulled high to Vcc. In open drain mode, latter means, pulled high by external resistor. The polarity of voltages is of course the same in push-pull and open-drain modes.
One could have chosen opposite logic, so that 0 = higher voltage and 1 = lower voltage, but IMHO, that would be pretty weird. Even more weird would be to use different notations in push-pull vs. open drain mode.