In the documentation, it says it's ok to power down flash using:
Code: Select all
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF);
If the rtc timer is not set as wake source *or* the sleep timer is long enough. Lifted verbatim from the docs:
Calling esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF) powers down flash when the RTC timer is not enabled as a wakeup source or the sleep time is longer than the flash power-down period.
In terms of logic statement, does that translate to:
Code: Select all
!rtcTimerAsWakeupSrc || sleepTimeLongEnough
Because if so, does that mean:
rtcTimerAsWakeupSrc = true,
sleepTimeLongEnough = true is ok?
Also, is this really safe in cases where the wakeup source is a GPIO pin - but there is a possibility that the wake interrupt might be when the flash has not powered down yet, i.e.
rtcTimerAsWakeupSrc = false,
sleepTimeLongEnough = false ?
----
Additional note for others that might see this thread. Due to a bug, it seems you need to do this instead
Code: Select all
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_ON);
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF);