Detailed STM32 GPIO output push-pull and open-drain output mouth

 

Push-pull output:

After two GPIO pin line protection diode, flows upwardly "input mode" configuration, flow down to the "output mode" configuration. Look at the output mode section, through a P-MOS and the N-MOS circuit consisting of the pipe line unit. This structure allows the GPIO having a "push-pull output" and "open-drain" models.

A so-called push-pull mode, based on the working mode of the two MOS transistors named. It high in this configuration, after the reverse, upper conductive P-MOS, N-MOS downward closed, the external output high; and when the low level is input in this configuration, after the reverse, N-MOS tube is turned on, P-MOS closed, the external output low. When the pin is high and low switches, two alternately conducting tubes, P responsible for sinking the tube, N is responsible for pulling the tube current, switching speed and its load capacity than the ordinary way greatly improved. Push-pull output low level is 0 volts, 3.3 volts for the high level, with particular reference to FIGS. 8-2, which is an equivalent circuit of the push-pull mode.

 

Open-drain output

And when the open drain output mode, the top of the P-MOS tube does not operate. If we control output is 0, the low level, the P-MOS pipe closed, N-MOS turns on, the output to ground, if the control output is 1 (it can not directly output a high level), the P-MOS tube and N-MOS tubes are closed, the output pin is neither high nor low output, high impedance state. Is normal external pull-up resistor must be used, with reference to the equivalent circuit of FIG. 8-3. It has a "line" feature, that is, if a lot of open drain mode pin connected together only when all pins are high impedance state to a high-level only by the pull-up resistor, this high electric voltage level of the external pull-up resistor connected to the voltage supply. If one pin is low, it is equivalent to short-circuit ground line, so that the entire line are low, 0 volts.

Push-pull mode generally used in an output level of 0 and 3.3 volts and require high-speed switching state of the switch case. STM32 application, in addition to the occasion must be open-drain mode, we are accustomed to using a push-pull output mode.

开漏输出一般应用在I2C、SMBUS通讯等需要“线与”功能的总线电路中。除此之外,还用在电平不匹配的场合,如需要输出5伏的高电平,就可以在外部接一个上拉电阻,上拉电源为5伏,并且把GPIO设置为开漏模式,当输出高阻态时,由上拉电阻和电源向外输出5伏的电平,具体见图 8‑4。

STM32 IO 口 如何 与 5V 的传感器连接

 

Guess you like

Origin www.cnblogs.com/lweleven/p/mcuioout.html