Thanks @projectgus for the reply. I guess you mean the variable
CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY
in file C:.…\Arduino\hardware\espressif\esp32\tools\sdk\include\config\sdkconfig.h which was already 2000.
I didn’t test this Arduino example again as there was nothing to change.
I tried testing a modified version of the sntp example app with additional logic to alternate between flashing one of two leds for 1 second each wake up with a 1 second deep sleep time giving a cycle time of approximately 2 seconds. It had a
CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY 2000
too. It also failed once after a day or so with the console output being:-
rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_dr
I couldn’t get it to fail again though after testing a further 107,000 deep sleeps so it is rare and behaves differently to the Arduino example.
The time of day values though, were nonsensical. They look about right when the app is started but become nonsensical later. A sample was:
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:24:25 2017
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:25:55 2017
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:25:37 2017
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:24:58 2017
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:24:46 2017
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:25:34 2017
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:29:06 2017
e[0;33mW (891) example: The current date/time in Canberra is: Sun Jun 11 13:29:52 2017
The time of day is changing by minutes and going backwards and forward when the cycle is approximately 2 seconds. The date was also wrong being the date the test was started even though it was 3 days previous. I guess this is part of the problem documented on the espressif forum.
Previously I referenced a claim that the time required to wake from deep sleep send a message and sleep again with BLE was 120 milliseconds. This can’t be the case when @eyal found the user app doesn’t start until 250 milliseconds after wake up. BLE sensors e.g. bicycle cadence sensors, heart rate sensors, etc run for months on a single button battery. Due to the long boot time the ESP32 would consume too much energy for that.
Looking at the potential to reduce the boot time. Boot is in two stages. The first stage runs from ROM and can’t be changed. Stage 2 starts at 14 milliseconds and takes a long time. The second stage is not required as espressif advises:
“It is possible to write a fully featured application which would work when flashed to offset 0x1000”
which is the normal second stage boot loader address but much of what the boot loader does would have to be done by the application so it is uncertain how much time can be saved. For example WiFi requires quite a lot of code to be loaded and just commenting out line 90 obtain_time(); which removes loading the WiFi code reduces startup time by 260 ms to 601 ms with the extra time being consumed in the
boot: Loading app partition at offset 00010000
step. I can’t get the 250ms boot time reported by @eyal.
I wonder why?