Hi,
I have a custom board, it has integrated USB/UART bridge CP2102,
with usual 2xNPN circuit for Auto-program switching:
It works correctly, I have already programmed the module many times,
no need to press any Reset or Boot buttons.
There appeared a problem when I started to experiment with Deep-Sleep mode.
I followed example:
my code makes some LED blinking, SPI transfers, I2C transfers, and ends with:
struct timeval now;
gettimeofday(&now, NULL);
printf(“deep sleep (%lds since last reset, %lds since last boot)\n”, now.tv_sec, now.tv_sec-last);
last = now.tv_sec;
// config Timer
esp_sleep_enable_timer_wakeup(1000000LL * 10); // 10s
// config IO
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_AUTO);
gpio_pullup_en((gpio_num_t)PIN_NUM_EGPIO0); // use pullUp on GPIO0
gpio_pulldown_dis((gpio_num_t)PIN_NUM_EGPIO0); // not use pullDown on GPIO0
esp_sleep_enable_ext0_wakeup((gpio_num_t)PIN_NUM_EGPIO0, 0);
printf(“deep sleep\n”);
esp_deep_sleep_start();
So the module should switch to Deep-Sleep, wake up via Timer after 10s or via Button on GPIO0.
I found it works, but only if terminal is not running.
I use Teraterm v4.71 @115200, with setting FlowControl: None.
I used logic analyzer and captured a record of 3 situations:
(UART signals RX,TX,DTR,RTS,
and generated outputs CHIP_PU(EN) and GPIO0)
- first 1/3 shows what happens during programming via PlatformIO
- after programming PIO makes Reset (approx.time “+10s”) and module works about 8s (deep-sleep)
- I start TeraTerm (approx.time “+20s”), DTR,RTS go Low and strange pulses appear on GPIO0,
it shows period of resetting, about 2.3s, pulses starts 2.1ms after printing the “deep sleep”,
probably at the moment when it calls esp_deep_sleep_start();
Detail of the pulses on GPIO0:
Why it keeps resetting every 2.3s when Terminal runs ?
Without the Terminal it works correctly and makes cycles of 10s deep-sleep.
I checked +3V3 power rail of ESP32, it seems to be solid, just little (<80us) pulses
when it drops 3.3V → 3.15V, probably because PFET switching power to rail with cap.10uF.
Anyway, I disabled Brownout Reset in Menuconfig. No change.
There are only 4 links between CP2102 and ESP32: U0TXD,U0RXD,CHIP_PU(EN) and GPIO0.
I see only this difference:
a) Terminal not running … DTR=1, RTS=1 (both Idle) → CHIP_PU(EN)=1, GPIO0=1
b) Terminal is running … DTR=0, RTS=0 (both Active) → CHIP_PU(EN)=1, GPIO0=1
I think all 4 signals connected to ESP32 are the same logic levels in both cases.
So why in case b) it keeps resetting instead of switching to deep-sleep ?
And what is explanation of the pulses on GPIO0 ? (program never removes pullUp)