PlatformIO Community

ESP32 Firebeetle fast boot after deep sleep

DFRobot Firebeetle needs in deep sleep only 10µA but the start up time after deep sleep is around 200ms. Connecting GPIO 15 to ground reduces the time by 20ms (see Otii recording).

Espressif offers a faster boot it you change the boot loader option “CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP”
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html#config-bootloader-skip-validate-in-deep-sleep

How can I set this parameter in Platformio?

Thank you!

DFR Firebeetle boot|382x500

I’m assuming you’re using ESP-IDF here. Try running pio run -t menuconfig to get in to the sdkconfig configuration, the obotloader option should be there. This should result in that macro being added to your project’s sdkconfig.h.

Please, how could I get a fast boot from deep sleep within the Arduino framework?

This option is already activated, so you don’t need to do anything.

@maxgerhardt, thak you for your answer. You are right but let me rephrase the question.
I am using a PICO-DevKitM-2 and from the time the Deep Sleep Wake Up is triggered to the start of the setup() execution, it takes 560 ms, which is too long for me. How could I reduce that time using Platformio’s Arduino framework?

Is wakeup time equally bad in the Arduino IDE? Then please have Arduino-ESP32 people have look at it (Issues · espressif/arduino-esp32 · GitHub). If PlatformIO and Arduino IDE behavior differs (for the same selected core version, which would be 2.0.3 at the moment), then we have a problem.

I’m not familiar with other wakeup options. You can however reconfigure the ESP-IDF base for testing, just use the project platform-espressif32/examples/espidf-arduino-blink at develop · platformio/platform-espressif32 · GitHub as a base and enter menuconfig per documentation.

I have made several tests for different devices with the same program, in Platformio-Arduino and in Arduino IDE (both in version 2.0.3) and these are the results in ms (PlatformIO / Arduino IDE):

LOLIN D1 Mini ESP32: 126 / 108
ESP32-DevKitV1: 126 / 108
LOLIN S2 Mini: 240 / 240
ESP32-PICO-DevKitM-2: 562 / 101

D1 Mini Esp32 and DevKitV1 have the same MCU (ESP32-WROOM-32) and their results match.
Lolin S2 Mini (ESP32-S2FN4R2) gives the same result in PlatformIO and in Arduino IDE (not very good anyway).
DevKitM-2 has the best MCU (ESP32-PICO-MINI-02) and gives the worst results on PlatformIO and the best on Arduino IDE.

Since in Arduino IDE the wakeup times are better than in PlatformIO, I think this is not a problem concerning espressif/arduino-esp32

As for what you tell me about ESP-IDF, I have to look at it more carefully because I don’t know anything about ESP-IDF.

Thank you very much

I’ve continued to test on PlatformIO and I’ve realized that the long delay of DevKitM-2 is related to the configuration in platformio.ini

[env]
platform = espressif32
framework = arduino
board_build.filesystem = fatfs
board_upload.speed = 2000000
monitor_speed = 115200
monitor_filters = time

[env:PICODEVKITM2]
board = pico32
board_upload.maximum_ram_size = 532480
board_upload.flash_size = "8MB"
board_upload.maximum_size = 8388608
board_build.partitions = my_partition_esp32_8m.csv
build_flags = 
	-D PICODEVKITM2
	-D BOARD_HAS_PSRAM

With the above configuration, the delay is 562 ms, but if I remove the last line (-D BOARD_HAS_PSRAM), then the delay is 126 ms (same as D1 Mini Esp32 and DevKitV1 devices) and no change in another line changes the result.

On the other hand, the Lolin S2 Mini board also has 2MB PSRAM, but whether or not I add the BOARD_HAS_PSRAM flag, it has no effect on the wakeup time (always 240 ms)

[env:LOLINS2MINI]
board = lolin_s2_mini
board_upload.maximum_ram_size = 327680
board_build.partitions = my_partition_esp32_4m.csv
build_flags =
  -D LOLINS2MINI
  -D BOARD_HAS_PSRAM

PSRAM settings also affect the Arduino IDE. Finally, this is an issue that concerns Espressif/Arduino