Difference between Open Drain and Push Pull

Submitted by Sangharsh on

I was reading the datasheet of ARM Cortex Chip, mainly that GPIO chapter, as i want to configure various GPIO pins to use them in "Alternate Function" mode for read/write access to SRAM.

for all the registers available for GPIO is didn't understand output type registers, as there are two choices for output type registers:

  • Open-drain
  • Push-Pull 

so my question is what is the difference between these two?

Thanks in advance.....

When you configure the GPIO pin of a microcontroller as Output. The Output pin can either be as Open-Drain type or  Push-Pull Type. Both these configurations tell us how the GPIO pin of uC is designed internally.

Open-Drain Type: In open drain type there will be only one switch (transistor/MOSFET) inside the uC and this switch is connected to Ground. 

Push-Pull Type: In Push-Pull type there will be two switches (transistor/MOSFET) inside the uC and one switch will be connected to Ground and the other will be connected to Vcc/Vdd. 

Both Open-Drain and Push-Pull Mode is illustrated in the below picture. In most cases the push-pull type will be more advantageous than Open Drain Type. And modern MCUs have Push-Pull type 

05outputs.png

  Joined August 16, 2016      1000
Tuesday at 12:29 AM

In Open Drain Type:

If you make the output pin HIGH the pin will be connected to ground through the switch and if you make the Output pin LOW the pin will be left floating since the switch will be turned off.

In Push-Pull Type:

If you make the output HIGH the pin will be connected to Vdd through the NPN switch and if you make the Output pin LOW the pin will be connected to Ground thorough the PNP switch. 

Since in the Open Drain type the pin is left as floating a pull-high or pull-down resistor is usually added to the GPIO pin. But in morden day MCUs most of the GPIO output pins are Push-Pull type 

  Joined September 07, 2017      256
Thursday at 12:15 PM

​Aisha,

Your answer explaining the push and pull phase was incorrect. I think it might create confusion for the readers. The correct working of push pull phase is as follows:

  • Push phase – When the Internal Signal connected to the gates of the transistors (see the figure above) is set to a low logic level (logic 0), the PMOS transistor is activated and current flows through it from the VDD to the output pin. NMOS transistor is inactive (open) and not conducting.
  • Pull phase – When the Internal Signal connected to the gates of the transistors is set to a high logic level (logic 1), the NMOS transistor is activated (closed) and current starts to flow through it from the output pin to the GND. At the same time, the PMOS transistor is inactive (open) and is not conducting current.

  Joined January 13, 2021      1
Wednesday at 01:38 PM

Unlike push-pull, an open-drain output can only sink current. In order to achieve a logical high output on the line, a pull-up resistor is used to connect the open-drain output to the desired output voltage level.

  Joined February 27, 2020      55
Thursday at 11:08 AM

hi plz tell me can se program stm8s005c6 using arduino ide 

  Joined November 26, 2022      1
Saturday at 07:37 AM

Push-Pull is used with available logic levels for Vdd and Vss (gnd).

Open Drain uses a pull-up resistor normally to a higher voltage needed for some output device. Check requirements of your outputs.

 

Consider that the impedance of the FETs used as switches may be computed from the datasheet if that is important to know.  It is generally around 25 Ohms but you may read near the end of specs the values for Vol and Iol and estimate Rol [ohms] = Vol [[mV] / Iol  [mA] which hav manufacturing tolerances of around 33% to worst case 50%.  This may be consider for driving LEDs and high slew rates for cables with 50  to 100 pF / m capacitance and T=RC for the 63% of target value,

Just choose the outputs you need then the codes for these modes on initialization.

 

  Joined February 06, 2023      6
Monday at 02:23 PM