1
\$\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
    Mar 19 '20 at 10:38
  • \$\begingroup\$ just added the schematic \$\endgroup\$ Mar 19 '20 at 10:52
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\$ Mar 19 '20 at 13:14
  • \$\begingroup\$ @F.Heisenberg Yes. And output pins are always driven - by themselves. \$\endgroup\$
    – user253751
    Mar 19 '20 at 14:06
  • 1
    \$\begingroup\$ What if the ouput pin is open drain? \$\endgroup\$ Mar 19 '20 at 14:08
  • \$\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\$
    – user253751
    Mar 19 '20 at 14:09
  • \$\begingroup\$ Okay, i think i2c ouputs are open drain \$\endgroup\$ Mar 19 '20 at 14:11
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
    Mar 19 '20 at 10:47
  • \$\begingroup\$ I thought so too. But should I add a pull-up or pull-down resistor? Can I add both? \$\endgroup\$ Mar 19 '20 at 10:51
  • \$\begingroup\$ @Justme: can you provide a equivalent circuit of the output? Why is there no internal pull-up for example? \$\endgroup\$ Mar 19 '20 at 10:52
  • \$\begingroup\$ @SteveSh in that case, it's not an output pin! \$\endgroup\$
    – user253751
    Mar 19 '20 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\$
    – user253751
    Mar 19 '20 at 12:51

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.