ESP32S3 Sleep behaviour using alarm instead of timer

Kowshik_Bevara
Posts: 20
Joined: Wed Mar 02, 2022 2:39 pm

ESP32S3 Sleep behaviour using alarm instead of timer

Postby Kowshik_Bevara » Wed Apr 20, 2022 2:49 pm

Hi,

1. I'm trying to implement a constant alarm for ESP32S3 to wake up from deep sleep, instead of using the esp_sleep_enable_timer_wakeup(TIME) function.

2. There are normal alarm timers that can be set to generate interrupt in normal mode. But I want an alarm that generates interrupt even in deep sleep mode.

3. There is a resource available in the python version saying that we can set the alarm for deep sleep mode.
- The link for the same is here: https://docs.circuitpython.org/en/lates ... index.html

NOTE: The difference between alarm setting and the esp_sleep_enable_timer_wakeup(TIME) function:

a. In the case of alarm setting the device generates interrupt after every desired interval of time even if the device is [/b]in deep sleep mode. And we need to set the alarm setting only once.
b. In the case of the esp_sleep_enable_timer_wakeup(TIME) function the device wakes up after a desired interval of time after going to deep sleep which means I have to set the timer every time before going to deep sleep.

Is there any version available in C for the above resource I have attached? or
Is there any way we can set the alarm timer that works in deep sleep?


Could someone please help me with this?

Thanks & Regards,
Kowshik.
Last edited by Kowshik_Bevara on Wed Apr 27, 2022 5:24 am, edited 1 time in total.

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32S3 Sleep behaviour using alarm instead of timer

Postby ESP_Sprite » Thu Apr 21, 2022 1:22 am

I see no proof for your behaviour A in the circuitpython link you mention. In deep sleep, everything except for possibly the ULP will be turned off, so there's no other peripheral to wake up the CPU that can have a periodic alarm. The RTC will continue ticking, though, so it would not be hard to pick the right time to deep sleep right before you do it when going to deep sleep.

Kowshik_Bevara
Posts: 20
Joined: Wed Mar 02, 2022 2:39 pm

Re: ESP32S3 Sleep behaviour using alarm instead of timer

Postby Kowshik_Bevara » Thu Apr 21, 2022 2:14 am

Thanks for the quick reply.
The RTC will continue ticking
So, Is there any way we can set an RTC alarm that works in deep sleep?

According to what you have mentioned I have understood that we cannot create any kind of RTC alarm that needs to be set only once. And we need to set the esp_sleep_enable_timer_wakeup(TIME) every time before going to deep sleep.

Please do correct me if I'm wrong.

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32S3 Sleep behaviour using alarm instead of timer

Postby ESP_Sprite » Thu Apr 21, 2022 5:20 am

Kowshik_Bevara wrote:
Thu Apr 21, 2022 2:14 am
So, Is there any way we can set an RTC alarm that works in deep sleep?
That is what you're doing with esp_sleep_enable_timer_wakeup().
According to what you have mentioned I have understood that we cannot create any kind of RTC alarm that needs to be set only once. And we need to set the esp_sleep_enable_timer_wakeup(TIME) every time before going to deep sleep.

Please do correct me if I'm wrong.
This is true. However, there's no inherent architectural limitation in this, as in, with esp_sleep_enable_timer_wakeup you can do everything you would be able to do with a periodic wakeup as well.

Kowshik_Bevara
Posts: 20
Joined: Wed Mar 02, 2022 2:39 pm

Re: ESP32S3 Sleep behaviour using alarm instead of timer

Postby Kowshik_Bevara » Thu Apr 21, 2022 9:55 am

It's really helpful. Thank you!

Who is online

Users browsing this forum: No registered users and 71 guests