ESP32 (DOIT) power consumption drops after connect and disconnect micro USB

I have an ESP32 project in use. After esp_deep_sleep_start (); * the ESP uses much less power, but still 6 mA (milliamps). Everything works fine, wake up with an input and sleep deeply after the code. But when I connect the microUSB to the computer USB (also with only the data / date +), the power consumption drops to micro Ampere. And this is nice, even after the code has been executed, the consumption remains low. This works until I disconnect the ESP32 and connect it to the power supply, that I use 6 Mon again.

Can I simulate the USB connection with the micro-USB in the sketch? So that the ESP32 also uses less power after a (hard) power reset?

I think the UART is not going to deep sleep after a power reset...... only after it's connected with a 'PC'.

  • and also: esp_wifi_stop(); esp_bluedroid_disable(); esp_bt_controller_disable(); //adc_power_off();

Sleep modes of the ESP32 https://github.com/espressif/esp-idf/blob/master/components/esp32/sleep_modes.c You may notice

static void IRAM_ATTR suspend_uarts(void)

static void IRAM_ATTR flush_uarts(void)

static void IRAM_ATTR resume_uarts(void)

How/where are you measuring the current, and what is the power supply besides the USB port?