3
\$\begingroup\$

For at least some STM32F4 MCUs, push-pull + pull-up/pull-down is a valid GPIO configuration, but what would you ever use it for, and why? I assume there's some saner reason than "I just really felt I needed that juicy extra 100µA of wasted current per pin"...

The configuration is listed in section 8.3 of the reference manual, on page 269: enter image description here enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Making such strange combinations illegal would be a waste of silicon, and even if no-one can come up with valid usecase now that doesn't mean there can't be one found tomorrow. So making such configurations legal seems the logical choice to me. \$\endgroup\$ Commented May 9, 2015 at 7:32

2 Answers 2

3
\$\begingroup\$

Basically the chart shows that the PUPDR bits control the pull-up and pull-down connections independent of the OTYPER bit that switches between push-pull and open drain.

Probably you would not typically set PUPDR to anything but 00 when using the push-pull configuration.

One situation where you might do so is if you were going to switch the pin between output and input functions. You might want the pull-up or pull-down to be configured before you switch to input mode to avoid the input ever being in a truly floating state.

\$\endgroup\$
2
  • \$\begingroup\$ There's also an analog mode (MODER=11,OTYPER=x), which is only defined for PUPDR=00, leaving the combinations with other PUPDR values reserved. Does this explanation still make sense? (ie. if the weird configuration is for convenience, why doesn't the analog mode have pull-up/pull-down options or have PUPDR=xx?) \$\endgroup\$ Commented May 9, 2015 at 5:44
  • \$\begingroup\$ @AleksiTorhamo, You should generally not use any mode described as "reserved". That means that the behavior in the current product is undefined, but it might be used as a useful mode in a future version of the product. Since you don't know what the behavior will be in the future product, it's safest to avoid ever setting that combination of bits. \$\endgroup\$
    – The Photon
    Commented Jun 15, 2015 at 16:30
1
\$\begingroup\$

If, for some reason you decide to disconnect PP but leave PD, you won't have glitches while switching.

\$\endgroup\$

Your Answer

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

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