xtensa/esp32s2: fix for timers and watchdog init on startup

This commit is contained in:
Filipe Cavalcanti 2024-08-28 10:39:45 -03:00 committed by Xiang Xiao
parent 2e884cbd11
commit 4915338857
2 changed files with 16 additions and 0 deletions

View File

@ -39,6 +39,9 @@
#include "hardware/esp32s2_systimer.h"
#include "hardware/esp32s2_tim.h"
#include "soc/periph_defs.h"
#include "esp_private/periph_ctrl.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -1254,6 +1257,15 @@ struct esp32s2_tim_dev_s *esp32s2_tim_init(int timer)
#endif
}
if (tim->gid == GROUP0)
{
periph_module_enable(PERIPH_TIMG0_MODULE);
}
else
{
periph_module_enable(PERIPH_TIMG1_MODULE);
}
/* Verify if it is in use */
if (tim->inuse == false)

View File

@ -38,6 +38,9 @@
#include "hardware/esp32s2_rtccntl.h"
#include "hardware/esp32s2_tim.h"
#include "soc/periph_defs.h"
#include "esp_private/periph_ctrl.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -1042,6 +1045,7 @@ struct esp32s2_wdt_dev_s *esp32s2_wdt_init(enum esp32s2_wdt_inst_e wdt_id)
}
else
{
periph_module_enable(PERIPH_TIMG1_MODULE);
wdt->inuse = true;
}