TG1WDT_SYS_RESET or RTCWDT_RTC_RESET During Light Sleep

rh_dan
Posts: 1
Joined: Wed Jul 13, 2022 1:33 am

TG1WDT_SYS_RESET or RTCWDT_RTC_RESET During Light Sleep

Postby rh_dan » Thu Jul 14, 2022 3:11 am

Hello everyone. I have a product based on the ESP32-WROOM-32E module that has been working perfectly fine in all regards until I changed out a delay sequence from a normal delay(); to a light sleep esp_light_sleep_start();. At random, the device now resets with either TG1WDT_SYS_RESET or RTCWDT_RTC_RESET. It can run for hours without a problem then resets multiple times in a row.

Code: Select all

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
This is the code during which the problem occurs.

Code: Select all

  esp_err_t sleepRet = ESP_OK;
  uint32_t pulseDelay = pulseLengthmillis * 1000;         // how many microseconds will the pulse last, since the sleeptimer uses uS
  pulseDelay          = pulseDelay / (brightLevel*2);     // how long to delay between each brightness iteration  

  esp_sleep_enable_timer_wakeup(pulseDelay);
  
  for (uint8_t i = 0; i < brightLevel; i++) {
    digitalWrite(PIN_LED_SHDN, LOW);
    Set_LED_Color(ledDisplay, 1, 0x00, 0x00, i);
    Set_LED_Color(ledDisplay, 2, 0x00, 0x00, i);
    Set_LED_Color(ledDisplay, 3, 0x00, 0x00, i);
    Set_LED_Color(ledDisplay, 4, 0x00, 0x00, i);
    Set_LED_Color(ledDisplay, 5, 0x00, 0x00, i);
    Update_Display(ledDisplay);
    digitalWrite(PIN_LED_SHDN, HIGH);
    sleepRet = esp_light_sleep_start();
  }
The Update_Display(ledDisplay); function writes 19 bytes of data to an LED Driver over I2C. The code calling this sequence winds up generating a 4032uS lightsleep, 62 times in a row. This was done in an attempt to lower current consumption by sleeping instead of delaying during the brightening / dimming of the LEDs. Works pretty well too... except for the resetting :)

I isolated the pulse code, and running it independently of everything else, it functions just fine, as it did in testing.

When I connect to wifi first, though, it resets due to RTCWDT_RTC_RESET after 18 pulses (one pulse = 62 x 4032uS lightsleep entries / exits).

Code: Select all

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
I can't seem to force the TG1WDT to trigger though. Not sure how I would test that.

Based on other posts here that might be related to this issue, I verified that the power supply was sufficient by powering the system directly with 3.3V from my bench supply with no current limit.

This is pretty vanilla code, I'm not using FreeRTOS or touching any watchdog timers at all (that I'm aware of).

Who is online

Users browsing this forum: No registered users and 73 guests