Deep sleep wake up time

krajaan
Posts: 16
Joined: Mon Mar 20, 2017 5:59 pm

Deep sleep wake up time

Postby krajaan » Tue Mar 21, 2017 3:35 pm

Hi,
the project we are working on requires waking up under certain conditions and gathering quite a lot of data in a very short time. The issue of boot up time has come up, it seems the booting process takes somewhere around a second (same for waking up from deep sleep) and light sleep is not implemented yet. From what I understand RTC core can not use SPI and all GPIO pins, correct? Is it possible to speed up the boot process somehow? Or set the ESP32 to a more power hungry state that it can wake up faster from?

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

Re: Deep sleep wake up time

Postby ESP_Sprite » Wed Mar 22, 2017 3:44 am

Depending on the amount of code, you may use the deep sleep wake-up stub for this. This is essentially 8KiB of RTC memory where you can stash code that *immediately* gets executed when the CPU wakes from deep sleep. I'm not sure if 8KiB is enough to hold whatever you want to execute plus the data it writes, and doing WiFi or BT in that mode is pretty much a no go, but it may be enough to do what you want.

ESP_Angus
Posts: 1873
Joined: Sun May 08, 2016 4:11 am

Re: Deep sleep wake up time

Postby ESP_Angus » Wed Mar 22, 2017 4:07 am

krajaan wrote:Is it possible to speed up the boot process somehow?
As well as Sprite's suggestion, the biggest speed boost in IDF boot time can come from disabling UART output.
  • Driving MTDO (GPIO15) low on reset will disable UART output from the bootloader (see ESP32 datasheet for more details).
  • Setting the "Default log verbosity" (under menuconfig Component Configuration -> Log Output) to a high severity.
Also, configuring the SPI flash speed to be the maximum value the external hardware supports and enabling QIO mode can give a significant speed boost (both these options come under "Serial Flasher Config").


A third suggestion, the ULP can do some basic data gathering - but it's a much more restrictive programming environment than either IDF or using the wakeup boot stub.

Relevant docs: Angus

krajaan
Posts: 16
Joined: Mon Mar 20, 2017 5:59 pm

Re: Deep sleep wake up time

Postby krajaan » Wed Mar 22, 2017 7:08 am

Thank you for the quick answers, setting QIO mode and the fastest SPI clock speed made a huge difference! I'll have to time boot up and waking up from deep sleep to see if I need to speed things up even further. I'll try to remember to post the numbers once I do.

I have to say the community (both documentation and support-wise) has been amazing so far.

ESP_igrr
Posts: 1521
Joined: Tue Dec 01, 2015 8:37 am

Re: Deep sleep wake up time

Postby ESP_igrr » Wed Mar 22, 2017 7:42 am

We did some measurements here, and the time spent between deep sleep wakeup (triggered by the ULP, for example) and entry into app_main is around 230ms, with default flash settings (40MHz, DIO mode) and all kinds of debugging output disabled (per comment from Angus above).

krajaan
Posts: 16
Joined: Mon Mar 20, 2017 5:59 pm

Re: Deep sleep wake up time

Postby krajaan » Wed Mar 22, 2017 5:25 pm

We just finished doing some tests as well:
Running at 240 MHz in QIO SPI mode clocked at 80 Mhz a boot from deep sleep took around 138ms with UART output at boot fully disabled.

Disabling all logging but keeping the UART disable pin high only increased boot time by around 20 ms.

Interestingly enough we found that booting at 80 MHz with SPI flash configured to be DIO at 40 MHz coming out of deep sleep only took 180 ms while running the main clock at 240 MHz and leaving flash at 40 MHz in DIO mode lengthened the process by only 40 ms.

System clock at 240 MHz vs 80 MHz barely had any impact while 80 MHz QIO vs 40 MHz DIO was a 40 ms difference, as state above.

Who is online

Users browsing this forum: Baidu [Spider] and 19 guests