Hi,
I'm trying to use coaps protocol, I want esp32 goes to deep sleep without closing the current DTLS session. I have no idea if it is possible in deep sleep mode or not?
I have to say that I succeeded keeping the DTLS session alive during light sleep and it works as expected.
can any one guide me for deep sleep mode?
Keep Coaps DTLS session during deep sleep
-
- Posts: 190
- Joined: Wed Jan 24, 2018 6:51 am
Re: Keep Coaps DTLS session during deep sleep
Please refer to https://docs.espressif.com/projects/esp ... modes.html
In deep sleep mode, CPUs, most of the RAM, and all the digital peripherals which are clocked from APB_CLK are powered off. The only parts of the chip which can still be powered on are: RTC controller, RTC peripherals (including ULP coprocessor), and RTC memories (slow and fast). Hence, it is unlikely that DTLS session can be kept active. (In addition, please also note that exit from deep-sleep is equivalent to reset, firmware will start executing as if system reset has happened)
In deep sleep mode, CPUs, most of the RAM, and all the digital peripherals which are clocked from APB_CLK are powered off. The only parts of the chip which can still be powered on are: RTC controller, RTC peripherals (including ULP coprocessor), and RTC memories (slow and fast). Hence, it is unlikely that DTLS session can be kept active. (In addition, please also note that exit from deep-sleep is equivalent to reset, firmware will start executing as if system reset has happened)
Mahavir
https://github.com/mahavirj/
https://github.com/mahavirj/
Re: Keep Coaps DTLS session during deep sleep
It should be possible if you save your DTLS context into rtc ram and restore it after boot and use the same port number and assuming the server doesn't kill the session.
Re: Keep Coaps DTLS session during deep sleep
I think so too, but I was hoping to keep it alive by saving the session in RTC memory.ESP-MJ wrote: ↑Wed Sep 04, 2019 4:36 pmPlease refer to https://docs.espressif.com/projects/esp ... modes.html
In deep sleep mode, CPUs, most of the RAM, and all the digital peripherals which are clocked from APB_CLK are powered off. The only parts of the chip which can still be powered on are: RTC controller, RTC peripherals (including ULP coprocessor), and RTC memories (slow and fast). Hence, it is unlikely that DTLS session can be kept active. (In addition, please also note that exit from deep-sleep is equivalent to reset, firmware will start executing as if system reset has happened)
I saved almost everything in the RTC-MEMORY, but esp32 crashed and reset every time.
I guess this happens because of some static variable inside libraries but Im not sure.
Re: Keep Coaps DTLS session during deep sleep
Not sure what you tried but you will have to at least recreate the socket and insert it into the saved session. You should try to get it working first without deepsleep.
Who is online
Users browsing this forum: igormoo and 70 guests