Wake up after deep sleep

aleksboshnakov
Posts: 5
Joined: Wed Feb 19, 2020 7:33 am

Wake up after deep sleep

Postby aleksboshnakov » Wed Feb 19, 2020 7:44 am

Hi, I am new to esp32.
In the last two days I have tried to run different types of code and I have focused on how deep-sleep works that I can't understand. Is it normal that when the device wakes up it goes into the bootloader? Is it possible to avoid the bootloader and on wake up to resume the code from where it went in deep-sleep? I ask this because I notice that it takes about 300ms for the bootloader each time it wakes up and this is not good for the kind of purpose for which I am using esp32.

I await your news regarding the precise functioning of deep-sleep and wake up. Also because I could not find any information about this behavior.

Aleks.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Wake up after deep sleep

Postby WiFive » Wed Feb 19, 2020 11:11 am

Only light sleep can resume

aleksboshnakov
Posts: 5
Joined: Wed Feb 19, 2020 7:33 am

Re: Wake up after deep sleep

Postby aleksboshnakov » Wed Feb 19, 2020 1:18 pm

After I tried light sleep I realized that it resumes the code from the point where the device goes to sleep.

Thx.

boarchuz
Posts: 559
Joined: Tue Aug 21, 2018 5:28 am

Re: Wake up after deep sleep

Postby boarchuz » Wed Feb 19, 2020 1:18 pm

If you're using IDF v4 you can try CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP for significantly faster wakeup.

aleksboshnakov
Posts: 5
Joined: Wed Feb 19, 2020 7:33 am

Re: Wake up after deep sleep

Postby aleksboshnakov » Thu Feb 20, 2020 7:49 am

I can't understand then what the deep-sleep mode is for if every time the device wakes up it has to bootloader.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Wake up after deep sleep

Postby WiFive » Fri Feb 21, 2020 2:01 am

aleksboshnakov wrote:
Thu Feb 20, 2020 7:49 am
I can't understand then what the deep-sleep mode is for if every time the device wakes up it has to bootloader.
To use the least current, you have to shut everything down. If you can sleep for long periods then you will happily trade the wakeup time for the power savings.

ESP_alisitsyn
Posts: 203
Joined: Fri Feb 01, 2019 4:02 pm
Contact:

Re: Wake up after deep sleep

Postby ESP_alisitsyn » Thu Feb 11, 2021 8:01 am

Hello @aleksboshnakov,

I just found your message but later. Want to add something to this discussion. When the chip starts the boot loader take place but you can start your code that can check some conditions and then continue to sleep or wake up after timeout or pin state change and load software normally on specific condition. This would significantly decrease power consumption and allows to use your logic after power up. This user code is called wake stub, please refer:
https://docs.espressif.com/projects/esp ... -stub.html

Let me know if you need more information.

aleksboshnakov
Posts: 5
Joined: Wed Feb 19, 2020 7:33 am

Re: Wake up after deep sleep

Postby aleksboshnakov » Wed Mar 10, 2021 8:22 am

ESP_alisitsyn wrote:
Thu Feb 11, 2021 8:01 am
Hello @aleksboshnakov,

I just found your message but later. Want to add something to this discussion. When the chip starts the boot loader take place but you can start your code that can check some conditions and then continue to sleep or wake up after timeout or pin state change and load software normally on specific condition. This would significantly decrease power consumption and allows to use your logic after power up. This user code is called wake stub, please refer:
https://docs.espressif.com/projects/esp ... -stub.html

Let me know if you need more information.
Hello,

It's an interesting feature, but it's not for me. My problem is that as soon as possible I should wake up from deep sleep. By changing some configuration within "sdkconfig" I managed to decrease it to about 150ms but that's still a lot for what I should be doing.

boarchuz
Posts: 559
Joined: Tue Aug 21, 2018 5:28 am

Re: Wake up after deep sleep

Postby boarchuz » Wed Mar 10, 2021 9:13 am

aleksboshnakov wrote: I managed to decrease it to about 150ms but that's still a lot for what I should be doing.
Did you try the option I mentioned above? Is GPIO low on power on (or esp_rom_disable_logging)? Bootloader logging as minimal as acceptable?

I think a typical application with all optimisations should be able to do sleep->app_main in about 20-25ms; the lowest I've seen is 15ms.

aleksboshnakov
Posts: 5
Joined: Wed Feb 19, 2020 7:33 am

Re: Wake up after deep sleep

Postby aleksboshnakov » Wed Mar 10, 2021 9:50 am

boarchuz wrote:
Wed Mar 10, 2021 9:13 am
aleksboshnakov wrote: I managed to decrease it to about 150ms but that's still a lot for what I should be doing.
Did you try the option I mentioned above? Is GPIO low on power on (or esp_rom_disable_logging)? Bootloader logging as minimal as acceptable?

I think a typical application with all optimisations should be able to do sleep->app_main in about 20-25ms; the lowest I've seen is 15ms.
Which GPIO are you referring to?
For now I have disabled image verification using

Code: Select all

bootloader_load_image_no_verify()
, commented

Code: Select all

memset(start, FREE_FILL_PATTERN, size)
and set QIO flash mode and 80MHz speed. Also, BOOTLOADER_LOG_LEVEL is set to "ERRORS".

Who is online

Users browsing this forum: No registered users and 102 guests