2

I've designed a custom ESP32 board around the WROVER-IE module. To keep power low, I'm using a GPIO-controlled high-side FET to turn off unused peripherals when in deep sleep mode.

The issue: I've pulled up an SSD1306 I2C OLED to this AUX rail. It works great when the device is awake. On setup() I start the OLED via ssd1306.begin() and from that point on, the SCL and SDA pins (22, 21) are always tied to 3.3V until I reset the ESP32.

The I2C bus always being tied to 3.3 ends up bleeding through the pull-up resistors and into the AUX rail, resulting unwanted current draw when in sleep mode.

Is there any way to turn off the internal I2C pullups on the ESP32?

Things I've tried so far:

  • Setting SDA, SCL as OUTPUT and writing LOW (does not work)
  • Setting SDA, SCL as INPUT and/or writing LOW (does nothing)
  • Calling gpio_hold_dis(gpio_num_t(SDA));(does nothing)

I'm now trying to dissect the esp32-hal-i2c.c lib but am not finding any fixes. Any help is greatly appreciated!

Edit, added diagram: enter image description here

-N

2
  • "The I2C bus always being tied to 3.3 ends up bleeding through the pull-up resistors" - how do you know that? The pullups don't consume any power as long as you don't communicate on the bus.
    – Sim Son
    Mar 3 at 14:55
  • If I remove the OLED display, the AUX voltage on the AUX rail dissipates. I will create a digram Mar 3 at 19:16
2

I have solved this problem. For anyone who would like to turn off the internal pullups on the I2C bus of the ESP32, you need to disable the entire driver before putting the device to sleep.

First, include the peripheral driver library from the IDF:

#include "driver/periph_ctrl.h"

Next, call the following before sleep:

rtc_gpio_isolate(gpio_num_t(SDA));
rtc_gpio_isolate(gpio_num_t(SCL));
periph_module_disable(PERIPH_I2C0_MODULE);  
digitalWrite(SDA, 0);
digitalWrite(SCL, 0);

This will stop the ESP32 from pulling up pins 21 and 22 while in deep sleep. Calling display.begin() or wire.begin() will restartthe driver upon wake.

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.