Page 1 of 1

Automatic Light Sleep

Posted: Tue Apr 09, 2024 9:26 am
by mtaz78
Hi,
I am trying to implement automatic light sleep, I have followed all the indications in the ble/power_save example and the instructions in this discussion:

https://github.com/espressif/esp-idf/is ... -500312453.

Unfortunately I have a consumption that is about three times as high as with 'forced' light sleep. I have tried both ESP32S3 with main xtal and ESP32 with crystal. The connection and adv intervals are set at 800ms.

This is the output I receive with the command:

Code: Select all

esp_pm_dump_locks(stdout)
Screenshot (74).png
Screenshot (74).png (44.12 KiB) Viewed 1147 times
From this dump it would appear that the chip is sleeping, so what could be the reason for this high consumption?

I also tried to get the reason for waking up and I get 'timer' rather than 'bt'.

Thanks in advance.

Re: Automatic Light Sleep

Posted: Tue Apr 09, 2024 10:03 am
by MicroController
mtaz78 wrote:
Tue Apr 09, 2024 9:22 am
what could be the reason for this high consumption?
https://docs.espressif.com/projects/esp ... fore-sleep:
FreeRTOS will enter light sleep mode if no tasks need to run for this number of ticks.
i.e. it will likely sleep less than in 'manual' mode because it doesn't go to sleep when it knows in advance it won't be sleeping for longer than 2 (min.) - 3 (default) ticks.

Re: Automatic Light Sleep

Posted: Tue Apr 09, 2024 12:59 pm
by mtaz78
Hi MicroController,

thank you for your answer.

Sorry I wasn't clear, I meant that when it sleeps, with automatic light sleep, the power consumption is higher than when it sleeps with manual light sleep, I'm not talking about total time sleeping or total consumption. I am only referring to power consumption during the sleep phase.

MicroController wrote: i.e. it will likely sleep less than in 'manual' mode because it doesn't go to sleep when it knows in advance it won't be sleeping for longer than 2 (min.) - 3 (default) ticks.
From the dump it looks like it sleeps, in fact having set the FreeRTOS ticks rate to 100Hz, in theory it should sleep after 3 ticks (30ms) idle, and since the ble connection interval is 800ms, it will surely sleep for more than 30ms (you can see light_sleep_rejected_counts = 0).