2
\$\begingroup\$

When configuring a pin as output on the ESP32, does it set an internal pull-up or pull-down resistor?

I am connecting a bus buffer to an output pin, and I am not sure whether I should use a pull-up or pull-down resistor on the bus.

EDIT - Schematic: ESP32 with bus buffer

\$\endgroup\$
2
  • \$\begingroup\$ How are you connecting the bus buffer? Can you draw a schematic? \$\endgroup\$
    – anrieff
    Commented Mar 19, 2020 at 10:38
  • \$\begingroup\$ just added the schematic \$\endgroup\$ Commented Mar 19, 2020 at 10:52

2 Answers 2

2
\$\begingroup\$

Output pins output a certain voltage. Adding internal pull-up or pull-down resistors to output pins is silly because they won't do anything except for wasting power.

The output pin is equivalent to a 0-ohm pull-up or pull-down resistor already (depending on whether your software makes it high or low).

\$\endgroup\$
11
  • \$\begingroup\$ is it correct to say that only input pins require pullup/pulldown resistor to avoid floating potential if nothing is driving it? \$\endgroup\$ Commented Mar 19, 2020 at 13:14
  • \$\begingroup\$ @F.Heisenberg Yes. And output pins are always driven - by themselves. \$\endgroup\$ Commented Mar 19, 2020 at 14:06
  • 2
    \$\begingroup\$ What if the ouput pin is open drain? \$\endgroup\$ Commented Mar 19, 2020 at 14:08
  • 1
    \$\begingroup\$ @F.Heisenberg Well then it's floating instead of high, so you want a pull-up resistor to make it high. Most microcontroller outputs aren't open drain. \$\endgroup\$ Commented Mar 19, 2020 at 14:09
  • 1
    \$\begingroup\$ I2C outputs are open-drain, but internal pull-ups are too weak to use with I2C pins, they are in the order of tens of kilo-ohms. I am not saying that it does not work, it will just be extremely slow if it works, and not within rise time specs. \$\endgroup\$
    – Justme
    Commented Mar 19, 2020 at 14:33
2
\$\begingroup\$

An output pin that is a push-pull output is a strong output - using an internal pull resistor (down or up) makes no sense.

Edit (due to new information): Since the ESP32 pin may not be an output when it boots up, it can be a floating input so the buffer output state is not known. Obviously to keep buffer output state stable and known during ESP32 boot, you need a pull-down (or pull-up) at the buffer input.

\$\endgroup\$
10
  • \$\begingroup\$ True. But, if you're concerned that the bus might float if nothing is driving it (in the case of a shared bus) then it is considered good design practice to put weak pullups or pulldowns on the bus. You could use the pullups/pulldowns on the buffer, if they are provided by the device manufacturer, to do this, rather than adding a bunch of discrete resistors. \$\endgroup\$
    – SteveSh
    Commented Mar 19, 2020 at 10:47
  • \$\begingroup\$ I thought so too. But should I add a pull-up or pull-down resistor? Can I add both? \$\endgroup\$ Commented Mar 19, 2020 at 10:51
  • \$\begingroup\$ @Justme: can you provide a equivalent circuit of the output? Why is there no internal pull-up for example? \$\endgroup\$ Commented Mar 19, 2020 at 10:52
  • \$\begingroup\$ @SteveSh in that case, it's not an output pin! \$\endgroup\$ Commented Mar 19, 2020 at 12:50
  • \$\begingroup\$ @F.Heisenberg An output pin has a 0 ohm pull-up or pull-down resistor, depending on whether you set it high or low. \$\endgroup\$ Commented Mar 19, 2020 at 12:51

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.