0
\$\begingroup\$

enter image description here

Hello,

above screenshot depicts output configuration in one of STM32 microcontroller. I would like to examine it a bit to understand what is going on and what I can expect.

First of all the manual says we can confugure output as either push-pull or open drain. Couple of questions here:

  1. If I understand correctly if "Output control" block produces adequate positive voltage then p-mos if off and output pin in n-mos drain - pin pulled to ground. Is it correct?
  2. How is the above scenario (n-mos active) different then Open drain which for me can only be realized in the same way by n-mos?
  3. Is there any other adventage of this push-pull configuration then just the possibility of having output pulled to low/high.
  4. I've been told that in push-pull the current flow is different then it is in case of open drain but I really don't see it. In Push pull current can flow either from Vdd to PIN or from PIN to Vss. In open drain only from PIN to Vss. So it looks like no difference but that person suggested that one configuration allows internal current flow while other external. Does it really?
  5. I see that PIN is protected by diodes. So if I put higher voltage then Vdd or lower then Vss it will be shorted imediately. Is it correct?
  6. What is the point of Schmitt trigger for input here?
\$\endgroup\$

2 Answers 2

3
\$\begingroup\$
  1. If I understand correctly if "Output control" block produces adequate positive voltage then p-mos if off and output pin in n-mos drain - pin pulled to ground. Is it correct?

Correct.

  • To give a high output P-MOS will be on and N-MOS will be off.
  • To give a low voltage P-MOS will be off and N-MOS will be on.
  1. How is the above scenario (n-mos active) different then Open drain which for me can only be realized in the same way by n-mos?

For a low output there is no difference. For a high output open drain voltage depends only on the external components.

  1. Is there any other advantage of this push-pull configuration than just the possibility of having output pulled to low/high.

Yes. Having an active push-pull is very useful for many reasons. Here are two:

  • The open-drain configuration cannot drive a load connected to ground.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. Circuit (a) output will fall quickly as C1 discharges via M1 but may charge slowly depending on the time-constant of R1C1. Circuit (b) will rise and fall at close to the same rate and only limited by the internal resistance of the FETs.

  • The push-pull arrangement is much better for driving capacitive loads such as a MOSFET device. Driving high and low will charge / discharge the gate capacitance much more quickly and provide rapid switching with low power dissipation in the MOSFET.
  1. I've been told that in push-pull the current flow is different then it is in case of open drain but I really don't see it. In Push pull current can flow either from Vdd to PIN or from PIN to Vss. In open drain only from PIN to Vss. So it looks like no difference but that person suggested that one configuration allows internal current flow while other external. Does it really?

Push-pull can source and sink current. This is useful for the reasons explained in 3 above.

  1. I see that PIN is protected by diodes. So if I put higher voltage then Vdd or lower than Vss it will be shorted immediately. Is it correct?

The diodes provide limited protection to current-limited over / under-voltage on the GPIOs - particularly when used as inputs. The diodes will have a limited current handling capability. The current is diverted to the power rails and if there is nothing there to consume the power then the power supply voltage may increase to the point of damaging the chip.

enter image description here

Figure 2. The protection diodes on most logic chips creates a sneak-path to positive supply. This will keep the PNP transistor permanently turned on and may damage the chip. Source: GPIO high-side driver fail.

The diodes can provide unexpected problems to designers with limited experience as shown in Figure 2.

  1. What is the point of Schmitt trigger for input here?

The Schmitt trigger provides well defined high and low switching points with hysteresis between them. In general, the input voltage will have to rise to 2/3 supply to register a '1' and fall to 1/3 supply to register a '0'. This is usually better than switching at 1/2 supply because chatter will result if the input voltage is just on the threshold.

\$\endgroup\$
2
  • \$\begingroup\$ One more question - what about what is the output inpedance of push pull and open drain in such configuration? \$\endgroup\$
    – DannyS
    May 11, 2018 at 22:18
  • \$\begingroup\$ Have a look at the datasheet IO specification. They'll give you the expected output voltage for sink or source at a selection of test currents. It probably won't give you a straight-line resistance relationship but you should be able to work out an approximation over your range of interest. \$\endgroup\$
    – Transistor
    May 11, 2018 at 22:37
1
\$\begingroup\$

If I understand correctly if "Output control" block produces adequate positive voltage then p-mos if off and output pin in n-mos drain - pin pulled to ground. Is it correct?

To make the output go low, this is correct.

For a high output, the "output control block" will have different outputs depending if you have the pin configured in push-pull mode or open drain mode.

How is the above scenario (n-mos active) different then Open drain which for me can only be realized in the same way by n-mos?

It isn't different. Open drain and push pull drivers look the same when producing a low output.

The difference happens when the output is high. For a high output, a push-pull driver will effectively connect the output to the positive supply, while an open drain driver will just present a high impedance.

Is there any other adventage of this push-pull configuration then just the possibility of having output pulled to low/high.

A push-pull driver will generally produce faster low-to-high transitions, and will consume less power in the output low state.

I've been told that in push-pull the current flow is different then it is in case of open drain but I really don't see it.

Again, push-pull and open-drain are only different when the output is high, not when the output is low.

I see that PIN is protected by diodes. So if I put higher voltage then Vdd or lower then Vss it will be shorted imediately. Is it correct?

Yes. Or rather, as soon as you apply more than 0.6 V or so above or below the rails, it will be effectively shorted.

What is the point of Schmitt trigger for input here?

Schmitt trigger is often used (for example) when you have a slowly varying input and you don't want the digital input value to chatter as the external signal ramps through the logic threshold.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.