User Tools

Site Tools


esp32:watchdog

This is an old revision of the document!


esp32 watchdog

<code cpp>

#include “esp_system.h” void IRAM_ATTR resetModule() {

ets_printf("reboot\n");
esp_restart();

}

timer = timerBegin(0, 80, true);                  //timer 0, div 80
timerAttachInterrupt(timer, &resetModule, true);  //attach callback
const int wdtTimeout = 3000;  //time in ms to trigger the watchdog
timerAlarmWrite(timer, wdtTimeout * 1000, false); //set time in us
timerAlarmEnable(timer);                          //enable interrupt


timerWrite(timer, 0); //reset timer (feed watchdog)

<code>

esp32/watchdog.1650905912.txt.gz · Last modified: by aistis