Page 1 of 1

How to use WatchDog on esp32-s3-devkitc-1

Posted: Wed Jun 19, 2024 11:56 am
by Carlos Costa
Hello together.
On my esp32dev board i was using the watchdog as follows and it was working perfectly.

Code: Select all

// 1) include

#include <Arduino.h>
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <esp_task_wdt.h>
#include <esp_log.h>
#include <soc/rtc_wdt.h>


// 2) activate the watchdog

watchdogRTC();


// 3) reset timer of the  watchdog
 rtc_wdt_feed(); //Alimenta o RTC WDT


// 4) code to test

     if (Serial.available())
     {
      while(1){
      Serial.println("preso");
      delay(1000);
      }
     }


// 5) final functio

void watchdogRTC()
{
    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_RTC);
    rtc_wdt_set_time(RTC_WDT_STAGE0, 9000);
    rtc_wdt_enable();           //Start the RTC WDT timer
    rtc_wdt_protect_on();       //Enable RTC WDT write protection
}

platformio.ini

Code: Select all

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
board_build.f_flash = 80000000L
On my esp32-s3-devkitc-1 using the same approach i get the errors:
‘RTC_WDT_STG_SEL_OFF’ was not declared in this scope,
‘RTC_WDT_STG_SEL_INT’ was not declared in this scope
‘RTC_WDT_STG_SEL_RESET_CPU’ was not declared in this scope
‘RTC_WDT_STG_SEL_RESET_SYSTEM’ was not declared in this scope
‘RTC_WDT_STG_SEL_RESET_RTC’ was not declared in this scope

Code: Select all

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
board_build.f_flash = 80000000L