Page 1 of 1

ESP32-C6: Not able to connect to wifi after deep sleep

Posted: Tue Nov 28, 2023 9:47 am
by thomas_fogh
If I call esp_deep_sleep_start() to put the ESP32-C6 to sleep the wifi won't reconnect after the processor wakes up again.

connect wifi
connect to cloud
wait
disconnect cloud
stop wifi
esp_sleep_enable_timer_wakeup(...)
esp_deep_sleep_start()
chip restarts after wake up
try to connect wifi fails
check wake reason, if equal 4 => try esp_restart()
connecting to wifi still fails

If I reset the chip by starting Monitor the chip connects to wifi again. (My com port is just connected to USB_DN and USB_DP so not connected to EN pin.)

Re: ESP32-C6: Not able to connect to wifi after deep sleep

Posted: Tue Dec 05, 2023 6:39 am
by thomas_fogh
No one has any experience with this?

Re: ESP32-C6: Not able to connect to wifi after deep sleep

Posted: Sun Jan 07, 2024 8:40 am
by uC_Jon
I don't have experience of the issue you are having, and I'm very new to all of this (c and esp32c6's)... however the sntp_example has code very similar to yours where it logs on to wifi, gets the ntp, sets the initial time, puts the device in a timed deep sleep using esp_deep_sleep(1000000LL * deep_sleep_sec), wakes up and re-logs on to the wifi, gets the ntp, slews the time... and so on.

I've noticed a couple of possible bugs in that 1) the RTC_SLOW_ATTR static int boot_count = 0; (global varable) doesn't increment and that 2) there is massive clock drift of the RTC (seconds of drift for a 30 min sleep) which may be valid but feels "wrong" or could be down to chip revision or the dev board (ESP32-C6-DEVKITC-1-N4) or any multitude of things.

But despite those issues it seems to work as expected so it my be worth looking at that example and seeing what your program does differently. I should note also that I'm using the master branch (I'm only a hobbyist, so don't mind the moving target).

Re: ESP32-C6: Not able to connect to wifi after deep sleep

Posted: Mon Jan 08, 2024 12:41 pm
by thomas_fogh
Thanks, Jon. 😊
I'll take a look at that.