espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.41k stars 7.37k forks source link

flash read err, 1000 when ESP_PD_DOMAIN_RTC_FAST_MEM is OFF #1953

Closed MadDogMayCry0 closed 5 years ago

MadDogMayCry0 commented 5 years ago

Wroom-32

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) flash read err, 1000 ets_main.c 371 ets Jun 8 2016 00:22:57

#include "esp_deep_sleep.h"
#include <sys/time.h>
#include "time.h"
struct timeval tv;

void printLocalTime(){
  struct tm timeinfo;
  if(!getLocalTime(&timeinfo)){
    Serial.println("Failed to obtain time");
    return;
  }
  Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
}
void setup(){
  Serial.begin(115200);
  delay(50);
  gettimeofday(&tv,NULL);
  if (tv.tv_sec < 1539178840){
    tv.tv_sec = 1539178840+7200;
    settimeofday(&tv, NULL);
  }

  esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
  esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
  esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
  esp_sleep_enable_timer_wakeup(5000000);
  printLocalTime();
  //Serial.println(tv.tv_sec);
  delay(10);
  esp_deep_sleep_start();
}

void loop(){}

if esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_ON); then it's ok.

BUG?

lbernstone commented 5 years ago

Not terrific behavior, but documented. https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/sleep_modes.html#power-down-of-rtc-peripherals-and-memories

MadDogMayCry0 commented 5 years ago

@lbernstone

Note: in revision 0 of the ESP32, RTC fast memory will always be kept enabled in deep sleep, so that the deep sleep stub can run after reset. This can be overridden, if the application doesn’t need clean reset behaviour after deep sleep.

I have rev 0 of the chip? :)

Hello world example sais "This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash" Arduino ide sais Chip is ESP32D0WDQ6 (revision 1)

lbernstone commented 5 years ago

I guess the first sentence applies to rev 0, the second applies to all :) You need clean reset behavior after the sleep, so you need RTC fast to be active.

MadDogMayCry0 commented 5 years ago

@lbernstone I don't understand. :( When esp going to restart the app just loading from flash is'nt? Why it's need to be loaded in fast mem? Real time clock uses fast mem? but I just need to use the RTC counter.. Ohh.. :(

lbernstone commented 5 years ago

You may get a better answer from an espressif employee in https://github.com/espressif/esp-idf/issues. I am just another user. I would guess that the system needs to read something out of the fast memory to boot cleanly. If you don't care about the clean reboot, perhaps it can be ignored. How much power does it save to turn off the fast memory domain?

MadDogMayCry0 commented 5 years ago

Thx you @lbernstone maby 2 -3 uA... not sure. I try to found it out and post issue later.

MadDogMayCry0 commented 5 years ago

@lbernstone hello ) i recive answer from idf

esp-idf/components/esp32/Kconfig

Lines 765 to 781 in 594dcd5 config ESP32_DEEP_SLEEP_WAKEUP_DELAY int "Extra delay in deep sleep wake stub (in us)" default 2000 range 0 5000 help When ESP32 exits deep sleep, the CPU and the flash chip are powered on at the same time. CPU will run deep sleep stub first, and then proceed to load code from flash. Some flash chips need sufficient time to pass between power on and first read operation. By default, without any extra delay, this time is approximately 900us, although some flash chip types need more than that.

By default extra delay is set to 2000us. When optimizing startup time

MadDogMayCry0 commented 5 years ago

I did ESP32_DEEP_SLEEP_WAKEUP_DELAY 5000 but still

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) flash read err, 1000 ets_main.c 371

I think this is a Hardware issue about flash chip model... try to found it out :(

lbernstone commented 5 years ago

That define is compiled into the libraries. To change it, you would need to use arduino as an esp-idf component

MadDogMayCry0 commented 5 years ago

@lbernstone i do.. Arduino as IDF-component. In make menuconfig Component config -> esp32 specific -> ESP32_DEEP_SLEEP_WAKEUP_DELAY 5000

MadDogMayCry0 commented 5 years ago

I think this is a Hardware issue about flash chip model.

My chip is HJ1723 (GIGADEVICE) 25Q16CT AP0T866 Datasheet I will try Winbond w25q16

MadDogMayCry0 commented 5 years ago

No issue. @igrr recomend enable fast mem... Closed.