open drain output

eowesi
Posts: 11
Joined: Sat Jun 09, 2018 8:55 am

open drain output

Postby eowesi » Wed Nov 06, 2019 11:13 am

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);
}


idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

Re: open drain output

Postby idahowalker » Thu Nov 07, 2019 12:04 am

https://docs.espressif.com/projects/esp ... /gpio.html look for gpio pull down and pull up disable.

Edje11
Posts: 18
Joined: Thu May 17, 2018 10:33 am
Contact:

Re: open drain output

Postby Edje11 » Fri Nov 08, 2019 3:38 pm

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.

trilbytim
Posts: 1
Joined: Sun Jan 05, 2020 2:44 pm

Re: open drain output

Postby trilbytim » Sun Jan 05, 2020 2:53 pm

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.

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: open drain output

Postby ESP_Sprite » Mon Jan 06, 2020 1:37 am

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.

Who is online

Users browsing this forum: No registered users and 153 guests