We are facing a very peculiar problem. We are designing a board based on ESP32 with various peripherals like motor drivers, sensors etc. We are using GPIO 4,5 on the ESP32 as I2C lines and have hooked up three devices on the bus. The first one is the MCP23017 which is connected to the ESP32 using a bidirectional level shifter (it operates on 5v), other is the CAP1206 touch IC and finally we have the MPU6050 interfaced with it. For powering the board we have three options. - DC adapter in which the voltage from the adapter is lowered to 5v using a buck converter and supplied to the system. - USB port for power and programming (We are using the CH340G for programming the ESP32 module) - Finally we use a 18650 cell in conjunction with a TP5410 based circuit which functions as a charger and boost converter (Converting the 3.7V of the battery to 5V) The problem is that when we run our device on DC adapter or the USB power, everything runs fine. However, when using on a battery, the MPU6050 device suddenly seems to hang after some 10-20s. I will include the schematics of our USB,MPU6050 and charging circuit with this post. The problem only occurs when using the battery and does not occur in any case when using USB/DC as power source. What have we tried: - Triple checked that all the connections on the PCB were right - We found that when we remove the diode marked "D2"in the charger circuit, everything seems to work fine with battery too. We thank you for taking time in reading this and hopefully giving us some solution.