I'm doing a project on stm32f407. I want to configure one of the GPIOs to the timer6 of stm32f407. Which output mode (push-pull mode or open drain mode) of GPIO is most suitable to configure the timer6? It would be really helpful to know why that mode is most suitable for the same too.
-
\$\begingroup\$ What timer mode will you use? PWM, Input Capture, Encoder, etc.? \$\endgroup\$– Bence KaulicsCommented Jun 21, 2017 at 10:57
-
1\$\begingroup\$ Timer module doesn't depend on the output mode. It is all about your circuit outside. \$\endgroup\$– AyhanCommented Jun 21, 2017 at 11:35
-
\$\begingroup\$ PWM @BenceKaulics \$\endgroup\$– Harshita NadigCommented Jun 22, 2017 at 3:31
1 Answer
As Ayhan says, the output mode used relates to the external circuit that you are driving, and is essentially independent of the signal source - whether it is a timer or something else.
Pushpull mode is probably the more useful if you had to choose one.
In pushpull mode the load is actively driven high or driven low.
If you are driving a resistive load, a logic input or most other loads, push pull will usually work.
Open-drain mode is used to drive high connected loads.
Then the output is "low" the pin drive MOSFET is on and the load current is "sunk" to ground. When the output is high the pin is pulled high by the high connected load. The pin rise time will usually be slower than when a push-pull drive mode is chosen as the drive current via the load has to charge the stray and port capacitance via the load.
Open collector is useful in allowing combining of two OC pins. If both are high the output is high. If either is low the output is also low.
If both are high the output is high.