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

thomas_fogh
Posts: 3
Joined: Tue Nov 28, 2023 9:06 am

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

Postby thomas_fogh » Tue Nov 28, 2023 9:47 am

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.)
Attachments
wifi_not_reconnecting.txt
wifi log
(29.56 KiB) Downloaded 3977 times

thomas_fogh
Posts: 3
Joined: Tue Nov 28, 2023 9:06 am

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

Postby thomas_fogh » Tue Dec 05, 2023 6:39 am

No one has any experience with this?

uC_Jon
Posts: 18
Joined: Fri Jan 05, 2024 7:03 pm

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

Postby uC_Jon » Sun Jan 07, 2024 8:40 am

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).

thomas_fogh
Posts: 3
Joined: Tue Nov 28, 2023 9:06 am

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

Postby thomas_fogh » Mon Jan 08, 2024 12:41 pm

Thanks, Jon. 😊
I'll take a look at that.

Who is online

Users browsing this forum: No registered users and 9 guests