Page 1 of 1

open drain output

Posted: Wed Nov 06, 2019 11:13 am
by eowesi
My first question is: Does all digital pins support open drain?
Second is: I'm trying to set the fourth pin as open drain.The arduino code below didn't work. Where am I making a mistake?(Is code OK?)

Code: Select all

void setup()
{
  REG_WRITE(GPIO_PIN4_REG, GPIO_PIN4_PAD_DRIVER);
}

void loop()
{
  REG_WRITE(GPIO_OUT_W1TS_REG, BIT4); //Close output
        delay(250);
  REG_WRITE(GPIO_OUT_W1TC_REG, BIT4); //Set pin to ground
        delay(250);
}


Re: open drain output

Posted: Thu Nov 07, 2019 12:04 am
by idahowalker
https://docs.espressif.com/projects/esp ... /gpio.html look for gpio pull down and pull up disable.

Re: open drain output

Posted: Fri Nov 08, 2019 3:38 pm
by Edje11
eowesi wrote:
Wed Nov 06, 2019 11:13 am
My first question is: Does all digital pins support open drain?
No.
It's all in the datasheet described.

Re: open drain output

Posted: Sun Jan 05, 2020 2:53 pm
by trilbytim
I'm trying to use an ESP32 to drive a BTS50085 (https://www.infineon.com/dgdl/Infineon- ... 35bccd114b) intelligent power switch. This needs an open circuit to switch off. I'm assuming that a pin configured as open drain would do that? I'm sorry but I don't understand from the datasheet how to do that. Also I don't understand Edje11's answer, do you mean No, not all pins support that mode (so some do), or do you mean No, none of the pins support that mode? I currently have the power switch on GPIO#27, I'm programming it with Micro Python. I tried setting Pin.OPEN_DRAIN when I initialised the pin, but I can't see any change in it's behaviour.

Re: open drain output

Posted: Mon Jan 06, 2020 1:37 am
by ESP_Sprite
Not all pins support open-drain because not all pins can be configured as output (specifically GPIO34 and higher are input only). Furthermore, open-drain at least in theory seems to satisfy the datasheet requirements: configure the pin as open-drain, then write a '0' ad an output value to turn the switch on and '1' to turn it off.