8
\$\begingroup\$

I bought an stm32f103ret6. When I saw the reference manual, I saw that it has several I/O modes.

For input: floating, pull-up, pull-down
For output: analog, open-drain, push-pull

I have already worked with AVR MCUs which have tri-state and pull-up. So I can understand pull-up and pull-down, but, I can't understand the modes floating, analog, open-drain, push-pull. What do these modes mean and when do I use which?

\$\endgroup\$
8
\$\begingroup\$

Floating: neither pull-up nor pull-down. Your input goes effectively straight to the gate of a FET somewhere. Should be used with external driver or pullup/down only; don't leave it entirely floating to pick up ESD.

Analog (output): not quite clear from the datasheet, but I'd assume this was the output of a DAC somewhere and can therefore take a range of voltage values.

Open-drain: if set to "0", a FET will be activated to connect this to ground. If set to "1", it will be left floating. Used for I2C and similar buses where there are multiple open-drain drivers and a single pullup resistor somewhere.

Push-pull: contains both high and low output transistors. Fast, capable of actually driving things which require a positive voltage, but must not be connected to other drivers. If set to "1", connects the positive supply rail to the output via a FET.

\$\endgroup\$
  • 2
    \$\begingroup\$ The normal difference between "floating" and "analog" is that the former will route the pin into a logic-level input buffer, allowing code (or other logic) to see its state, but also causing extra current to be drawn if it doesn't represent a valid high or low; the latter will disconnect the pin from the logic-level input buffer, thus allowing the pin's voltage to vary anywhere between the supply rails without causing excess current draw. \$\endgroup\$ – supercat Sep 12 '13 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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