Hello,
I need to force a system reset on the ESP32-PICO-D4 and from my understanding the RTC Watchdog is the only way from software to force the system reset. The register description and discussion of the Main System Watchdog Timer is quite good with a lot of detail about the registers. However, the description of the RTC watchdog is almost nonexistent and the register bits are not discussed. Is there a better description of RTC watchdog available? Has anyone been able to implement a software driven system reset with the RTC watchdog or possibly with a different method?
Thanks!
David
RTC Watchdog Timer
Re: RTC Watchdog Timer
If I understand correctly, this is all you're after:
Code: Select all
#include "esp_system.h"
esp_restart();
Re: RTC Watchdog Timer
I think esp_restart causes a CPU reset, not a system reset. A CPU reset resets either one or both CPU cores but a system reset is similar to a power-on reset where the entire ESP32 is reset (CPUs and peripherals). The documentation states that system resets are only caused by the RTC watchdog timeout or power cycling the device.
Re: RTC Watchdog Timer
The registers and features of the RTC WDT are almost identical to the Main System Watchdogs. Use the APIs provided in the RTC WDT driver. Example below:
- #include <stdlib.h>
- #include <stdio.h>
- #include "soc/rtc_wdt.h"
- void app_main()
- {
- rtc_wdt_protect_off(); //Disable RTC WDT write protection
- //Set stage 0 to trigger a system reset after 1000ms
- rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_SYSTEM);
- rtc_wdt_set_time(RTC_WDT_STAGE0, 1000);
- rtc_wdt_enable(); //Start the RTC WDT timer
- rtc_wdt_protect_on(); //Enable RTC WDT write protection
- }
Re: RTC Watchdog Timer
@ESP_Dazz: I tried your code, but failed to get a benefit. I now hope for some further help.
I am using an ESP32 under vscode with platformio, using the Arduino framework. Overall the program works, but fails on WiFi transfer with a Task-WDT fail when a binary file to be transferred is bigger than a very few 10kB. I use the static serve, like:
The error message is:
I had put your code sample under setup(), and into the loop() task I had put "rtc_wdt_feed();". My guess is it fails because I am "protecting" the looptask, while the watchdog is actually triggering the "async_tcp" task? Unfortunately, I do not see if, how and where a timeout is set in the async_tcp task.
What can I do for a solution?
I am using an ESP32 under vscode with platformio, using the Arduino framework. Overall the program works, but fails on WiFi transfer with a Task-WDT fail when a binary file to be transferred is bigger than a very few 10kB. I use the static serve, like:
Code: Select all
server.serveStatic("/cam.data", *myFS, "/cam.data");
Code: Select all
E (51702) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (51702) task_wdt: - async_tcp (CPU 0)
E (51702) task_wdt: Tasks currently running:
E (51702) task_wdt: CPU 0: IDLE
E (51702) task_wdt: CPU 1: loopTask
E (51702) task_wdt: Aborting.
What can I do for a solution?
Re: RTC Watchdog Timer
Hi, my code as follow,
ESP32 OK,but ESP32S3 error RTC_WDT_STG_SEL_OFF not define
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <freertos/timers.h>
#include <freertos/queue.h>
#include <driver/gpio.h>
#include "driver/timer.h"
#include "esp_task_wdt.h"
#include "soc/rtc_wdt.h"
#include "sdkconfig.h"
#include "nvs_flash.h"
#include <sys/unistd.h>
#include <sys/stat.h>
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#include <Arduino.h>
#include <esp_log.h>
void setup()
{
rtc_wdt_protect_off(); //Disable RTC WDT write protection
//Set stage 0 to trigger a system reset after 1000ms
rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_SYSTEM);
rtc_wdt_set_time(RTC_WDT_STAGE0, 1000);
rtc_wdt_enable(); //Start the RTC WDT timer
rtc_wdt_protect_on(); //Enable RTC WDT write protection
}
platformio.ini
[env:esp32s3box]
board = esp32s3box
platform = espressif32
framework = arduino, espidf
monitor_speed = 115200
upload_speed = 921600
upload_port = COM[3]
ESP32 OK,but ESP32S3 error RTC_WDT_STG_SEL_OFF not define
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <freertos/timers.h>
#include <freertos/queue.h>
#include <driver/gpio.h>
#include "driver/timer.h"
#include "esp_task_wdt.h"
#include "soc/rtc_wdt.h"
#include "sdkconfig.h"
#include "nvs_flash.h"
#include <sys/unistd.h>
#include <sys/stat.h>
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#include <Arduino.h>
#include <esp_log.h>
void setup()
{
rtc_wdt_protect_off(); //Disable RTC WDT write protection
//Set stage 0 to trigger a system reset after 1000ms
rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_SYSTEM);
rtc_wdt_set_time(RTC_WDT_STAGE0, 1000);
rtc_wdt_enable(); //Start the RTC WDT timer
rtc_wdt_protect_on(); //Enable RTC WDT write protection
}
platformio.ini
[env:esp32s3box]
board = esp32s3box
platform = espressif32
framework = arduino, espidf
monitor_speed = 115200
upload_speed = 921600
upload_port = COM[3]
Who is online
Users browsing this forum: No registered users and 99 guests