]> granicus.if.org Git - esp-idf/commitdiff
watchdogs: make sure timer group peripherals are enabled
authorIvan Grokhotkov <ivan@espressif.com>
Fri, 1 Dec 2017 04:11:37 +0000 (12:11 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Fri, 1 Dec 2017 12:10:26 +0000 (20:10 +0800)
components/esp32/int_wdt.c
components/esp32/task_wdt.c

index 8179fca5d8d8dff525032b5e29c84fec609b5e5c..debd675c41be8df9cf718732572bfd889e07eccb 100644 (file)
@@ -29,7 +29,7 @@
 #include "soc/timer_group_struct.h"
 #include "soc/timer_group_reg.h"
 #include "driver/timer.h"
-
+#include "driver/periph_ctrl.h"
 #include "esp_int_wdt.h"
 
 #if CONFIG_INT_WDT
@@ -71,6 +71,7 @@ static void IRAM_ATTR tick_hook(void) {
 
 
 void esp_int_wdt_init() {
+    periph_module_enable(PERIPH_TIMG1_MODULE);
     TIMERG1.wdt_wprotect=TIMG_WDT_WKEY_VALUE;
     TIMERG1.wdt_config0.sys_reset_length=7;                 //3.2uS
     TIMERG1.wdt_config0.cpu_reset_length=7;                 //3.2uS
index dc46e1c9b8572d77d66eafee58e6ce6cd4ec8a60..0e0b87c658f9a5db4b849d32a4f041e9952baeb9 100644 (file)
@@ -33,7 +33,7 @@
 #include "soc/timer_group_reg.h"
 #include "esp_log.h"
 #include "driver/timer.h"
-
+#include "driver/periph_ctrl.h"
 #include "esp_task_wdt.h"
 
 //Assertion macro where, if 'cond' is false, will exit the critical section and return 'ret'
@@ -183,6 +183,7 @@ esp_err_t esp_task_wdt_init(uint32_t timeout, bool panic)
         ESP_ERROR_CHECK(esp_intr_alloc(ETS_TG0_WDT_LEVEL_INTR_SOURCE, 0, task_wdt_isr, NULL, &twdt_config->intr_handle))
 
         //Configure hardware timer
+        periph_module_enable(PERIPH_TIMG0_MODULE);
         TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE;               //Disable write protection
         TIMERG0.wdt_config0.sys_reset_length=7;                 //3.2uS
         TIMERG0.wdt_config0.cpu_reset_length=7;                 //3.2uS