RTC Watchdog Timer

Posts: 2
Joined: Thu Mar 12, 2020 8:01 pm

RTC Watchdog Timer

Postby hydedw » Thu Mar 12, 2020 8:14 pm


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?


Posts: 376
Joined: Tue Aug 21, 2018 5:28 am

Re: RTC Watchdog Timer

Postby boarchuz » Fri Mar 13, 2020 12:06 am

If I understand correctly, this is all you're after:

Code: Select all

#include "esp_system.h"


Posts: 2
Joined: Thu Mar 12, 2020 8:01 pm

Re: RTC Watchdog Timer

Postby hydedw » Fri Mar 13, 2020 12:53 pm

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.

Posts: 213
Joined: Fri Jun 02, 2017 6:50 am

Re: RTC Watchdog Timer

Postby ESP_Dazz » Fri Mar 13, 2020 3:22 pm

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:
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include "soc/rtc_wdt.h"
  5. void app_main()
  6. {
  7.     rtc_wdt_protect_off();      //Disable RTC WDT write protection
  8.     //Set stage 0 to trigger a system reset after 1000ms
  9.     rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_SYSTEM);
  10.     rtc_wdt_set_time(RTC_WDT_STAGE0, 1000);
  11.     rtc_wdt_enable();           //Start the RTC WDT timer
  12.     rtc_wdt_protect_on();       //Enable RTC WDT write protection
  13. }

Who is online

Users browsing this forum: No registered users and 12 guests