I was profiling the duration of some parts of my code and I noticed there are 500ms since the chip powers-up to the first line of the setup(), that seems a lot so I started digging what is done during this time.
At this page the startup process is explained and here is where the setup() is called I understand some initialization of chip peripherals are done, probably inside initArduino() but I don't find what is taking to much.
The program I'm using:
#include "Arduino.h"
void setup() {
uint64_t start_time = esp_timer_get_time();
Serial.begin(115200);
Serial.printf("Start time: %lldus\n", start_time);
esp_sleep_enable_timer_wakeup(30 * 1000000ULL);
esp_deep_sleep_start();
}
void loop()
{
// Never reached because in deep sleep
}
Hi gfvalvo, I'm mainly curious, that's why omitted the use case explanation, but here it goes:
I have a ESP32CAM with some sensors to record weather conditions that I have left unattended in a remote location, I have modified the circuit to draw as low as 150uAh in deep sleep. The first thing it does when it wakes-up is measuring battery level and if it's below some level it does less measurements and returns to sleep, this process is just 30ms but that's insignificant compared to the boot-up duration of 500ms. Depending on who often you set the wakeup timer the boot-up process is what accounts for major energy expense.
The battery is recharged using a MPPT Solar Charge Controller, during winter it can be cloudy for serveral days in a row, I have extend the wake-up period in low battery sitiations so the issue is not so important, but I'm still curious about what is done during boot-up that takes so much as the things I see are in the range of few microseconds, my guess is that can be related to Flash memory initialization.