Skip to content

Instantly share code, notes, and snippets.

@PRosenb
PRosenb / esp32_wdt.cpp
Last active Apr 6, 2019
When using ESP32 with the Arduino IDE, it does not support the native watchdog timer. The following gist does not use the official watchdog timer but employs a normal timer to reset the CPU if wdt_reset() is not called in time.
View esp32_wdt.cpp
#include "esp32_wdt.h"
#include <esp32-hal-timer.h>
static hw_timer_t *timer = NULL;
/**
* iInterrupt service routine called when the timer expires.
*/
void IRAM_ATTR resetModule() {
ets_printf("watchdog reboot\n");
You can’t perform that action at this time.