LoPy4: External I2C pull-ups cause leakage current(?)
Adding external 10kΩ I2C pull-ups (from 3.3V to SDA/SCL) increases current consumption in deep sleep by at least 80uA.
- On the left and right (the non-dense parts) you can see the power consumption without pull-ups, it's ~25uA average.
- The left (non-highlighted) part in the dense area is where I connected a 10kΩ pull-up to the SDA pin. It's ~94uA average (+72uA).
- The highlighted part is where I connected pull-ups to both SDA and SCL pins. Average current is ~108uA (+83uA).
As long as no data is sent, no current should be flowing through the pull-ups. Any ideas? Could this be a firmware or hardware bug?
I don't have the right setup at the moment so this is just an idea but can you try deiniting I2C, then instantiating the corresponding Pins with and hold(true)? Like
sda = Pin('XX', mode=Pin.OPEN_DRAIN)
scl = Pin('XX', mode=Pin.OPEN_DRAIN)
before entering deepsleep? I'm thinking that when going to deepsleep the I2C peripheral is disabled but there's still some path to ground causing the leakage.
This probably is due to the weak pull down which is internally connect to
SDA (MTDI, pin 18). You are talking about this pin right?
This is one of the strapping pins which is by default pulled down internally in the esp32 .. (see the datasheet searching for strapping http://espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf).
Software can read the value of these five bits from the register ”GPIO_STRAPPING”.
During the chip’s system reset (power-on reset, RTC watchdog reset and brownout reset), the latches of the
strapping pins sample the voltage level as strapping bits of ”0” or ”1”, and hold these bits until the chip is powered
down or shut down. The strapping bits configure the device boot mode, the operating voltage of VDD_SDIO and
other system initial settings.
Each strapping pin is connected with its internal pull-up/pull-down during the chip reset. Consequently, if a strapping
pin is unconnected or the connected external circuit is high-impendence, the internal weak pull-up/pull-down
will determine the default input level of the strapping pins.
To change the strapping bit values, users can apply the external pull-down/pull-up resistances, or apply the host
MCU’s GPIOs to control the voltage level of these pins when powering on ESP32.
After reset, the strapping pins work as the normal functions pins.
Refer to Table 3 for detailed boot modes’ configuration by strapping pins.
BTW: I also found this:
The drive strength of the internal pull-up (wpu) and pull-down (wpd) is ~75 µA.
This matches your value quite well.