ESP32-S3 watch dog timer reset (TG1WDT_SYS_RST ) on wifi connection

arfejes
Posts: 4
Joined: Sun Mar 26, 2023 12:07 am

ESP32-S3 watch dog timer reset (TG1WDT_SYS_RST ) on wifi connection

Postby arfejes » Sun Mar 26, 2023 12:36 am

Hi All,

I'm developing software for esp32-s3 where the goal is to fetch commands from a wss server (websocket with ssl) and then display an image on a small tft screen.

For this I use two libraries: From both libraries I tried 1-1 example and everything worked perfectly:
I was able to display the panda image using this example:
https://github.com/Bodmer/TFT_eSPI/blob ... sh_PNG.ino

I was able to fetch commands from the secured websocket server with this exapmle:
https://github.com/Links2004/arduinoWeb ... entSSL.ino

After this I tried to put the two examples together and display the image on command from the wss server but no matter what I do the esp crashes and restarts during the setup phase:

Code: Select all

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x8 (TG1WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40377a89
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a38
entry 0x403c98d4
If the tft setup runs second then it crashes during tft.begin().
If the wifi connect runs second it crashes during WiFiMulti.addAP(ssid,password).
(Also tried with WiFi library, in those cases it crashes during WiFi.begin(ssid, password).

Can someone please help me how to interpret the above error message?
What can I do for debugging?
What can possibly cause this kind of behavior?


I am using an ESP32-S3-WROOM-1-N8R8 module, arduino framework together with platformio environment.

arfejes
Posts: 4
Joined: Sun Mar 26, 2023 12:07 am

Re: ESP32-S3 watch dog timer reset (TG1WDT_SYS_RST ) on wifi connection

Postby arfejes » Tue Mar 28, 2023 4:33 pm

I did some testing since than. So this seemed to me that it runs out of some resource and I came to know that the arduino framework is just a layer on top of FreeRTOS and the default stack size for the arduino task is 8k. I thought this could be the limit so I printed out some information multiple times during startup to monitor the stack size and the heap size:

Code: Select all

Serial.printf("FreeHeap: %d\n",ESP.getFreeHeap());
Serial.printf("xPortGetFreeHeapSize: %d\n", xPortGetFreeHeapSize());
Serial.printf("stackHWM: %d\n", uxTaskGetStackHighWaterMark(NULL));
This turned to be not the case, even at 8k it did not consume more than 4k of stack at any given point. Just to be sure I bumped up the amount to 32k but nothing changed.

I also checked with other graphics libraries, and the results were the same, doesn't really matter which lib I used, the libs worked fine but when I added the ws client it crashes and restarts without a stacktrace / error message. :cry: (ws client also still works fine by itself)

The last thing I did is that I dug up an old generic ESP32 I had laying around and tried the exact same code on that. To my surprise even thought that has way less memory it still worked... Now I am even more confused. I want this to run on the ESP32-S3 because I need the extra memory and the psram.

arfejes
Posts: 4
Joined: Sun Mar 26, 2023 12:07 am

Re: ESP32-S3 watch dog timer reset (TG1WDT_SYS_RST ) on wifi connection

Postby arfejes » Wed Mar 29, 2023 7:53 am

I figured out something, wouldn't call it a solution because now PSRAM is not working but the ESP is not crashing anymore.

In a nutshell what happens, is that if I enable the PSRAM (opi mode as per documentation) and run my code, it crashes however:
If I disable psram it runs just fine.
If I set psram to qspi the esp doesn't crash anymore but then the psram won't work (E (181) psram: PSRAM ID read error: 0x00ffffff).
If the psram is set to opi and recognized properly, then if I only use the Arduino_GFX_Library or the WiFiClientSecure+WiFi+ArduinoJson trio it works fine, but if I use both (gfx and trio) it crashes.

Could this be a hardware issue with my wroom module?
Last edited by arfejes on Thu Mar 30, 2023 9:12 pm, edited 1 time in total.

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 watch dog timer reset (TG1WDT_SYS_RST ) on wifi connection

Postby ESP_Sprite » Thu Mar 30, 2023 6:48 am

Are you possibly reconfiguring one of the GPIOs the PSRAM is connected to? That'd explain the error.

arfejes
Posts: 4
Joined: Sun Mar 26, 2023 12:07 am

Re: ESP32-S3 watch dog timer reset (TG1WDT_SYS_RST ) on wifi connection

Postby arfejes » Thu Mar 30, 2023 9:16 pm

Ah come on... :lol:
That was it.... I reused pins 36 and 37 for the display. To be honest I checked it before and I remembered the not usable gpios were in the 10s.
Boy I was wrong:
In module variants that have embedded OSPI PSRAM, i.e., that embed ESP32-S3R8, pins IO35,
IO36, and IO37 connect to the OSPI PSRAM and are not available for other uses
Thank you a lot, if it weren't for you I don't know when would have I double checked this.

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 watch dog timer reset (TG1WDT_SYS_RST ) on wifi connection

Postby ESP_Sprite » Fri Mar 31, 2023 12:18 am

No worries, glad you figured it out.

Who is online

Users browsing this forum: ignisuti, Majestic-12 [Bot], MicroController and 96 guests